|
Leslie Sanford wrote: One thing you may want to consider is to use the System class as a wrapper around the EventQueue class. So instead of using message objects, a plugin would call a method on the system object itself. So...
The only problem for me with this approach is that my message object inherits from a Data item and also can cantain a list of this data items. It is very flexible and can be used to send lists of any type of data.
Leslie Sanford wrote: One thing that I think needs clearing up is the event handlers in the plugins. If a plugin sends an event to the other plugins, would you require those events to be handled in the OnMessage method, or would you have other methods for handling events from other plugins?
I'm trying to find out if a plugin distinquishes between events sent from the System and from other plugins.
Yes, all plugins would receive events via the OnMessage function whether it be from the system or
another plugin. I haven't mentioned it but there is a separate send function for sending a message to another plugin.
bool SendTo( plugin handle )
Something to that effect, I haven't worked out the detail yet.
So, a message is a message regardless of who send it. It could be from the system or any number
of plugins. If you are subscribed to it you will get your OnMessage function called.
|
|
|
|
|
smesser wrote: The only problem for me with this approach is that my message object inherits from a Data item and also can cantain a list of this data items. It is very flexible and can be used to send lists of any type of data.
Ok. Well, you could keep the message classes around but still move the event sending to the System class:
public bool OnMessage(ISystem system, IMessage message)
{
if(message...)
{
}
system.Send("Completed", this, new SomeMessage());
return true;
}
|
|
|
|
|
Thanks for all the input. I need to put some serious thought into all this with a fresh mind.
|
|
|
|
|
Hi
I added an axMaskedEdit control to my project, i had no problem until i developed exe file, Now I can't open all forms that i used this control in them when i run the program. Microsoft says register that, but why? how ?
Thanks
-- modified at 16:03 Saturday 24th June, 2006
|
|
|
|
|
Please Help Me
I have an application in C#, and the objective is capture a image using grabberCapture (DSHOWNET),apply some filters,rotations,etc and use sqlcomands(ACCESS Database). I also have a timer that make many captures.
The problem is after capture three or four images, give this error:
An unhandled exception of type 'System.InvalidOperationException' occurred in system.drawing.dll
Additional information: The object is currently in use elsewhere.
PS: Sorry my Writen English!! but Help ME
MD
|
|
|
|
|
Hi!
Could it be that the image is being accessed from another thread as well?
You could try securing the painting of the image (or whatever you do with it) with a lock statement.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|
|
All,
I have written a COM Object in C++. I have a C# application that calls this COM object. One method in the COM object requires a variable to be modified to inform C# of an error. I create a variable of type Object in C Sharp and pass it by reference to the COM method. The com method receives this variable as a VARIANT*. In my C++ method I use variant_t to assign the integer value I want and assign it to the VARIANT* passed to the COM Method. This seems to work well in Debug mode but in Release I get the following error:
An unhandled exception of type 'System.NullReferenceException' occurred in CSharp Test Harness.exe
Additional information: Object reference not set to an instance of an object.
Can anyone help unscramble what I am doing wrong or offer a suggestion as to how to code this properly.
Kind regards
Dave
broken code is only broken if it's not yours
|
|
|
|
|
Check to see if the variant_t and the integer you are using are being initialized explicitly (in the COM component). Debug mode will initialize all locals for you, release won't... If you don't have access to the COM component source, then make sure you either initialize your return value object to something, or test to see if it is null before testing the value.
|
|
|
|
|
Hi all,
I'm writing a presentation application which uses a lot of graphics stuff. I'm very conscious of the memory management issues this throws up and would like to be able to test any object to find the current size in bytes so that I can do background loading/unloading of images. The sort of objects I need to query are: Image objects, ImageList objects, arrays.
In C++ I would call sizeOf() but I can't find an equivalent in .Net. I know a little bit about Marshal.sizeOf() but I want to be able to do this for Managed objects not Unmanaged stuff.
Surely this is a basic building block for application development. If it doesn't exist in C# then can someone explain to me why not!?
Thanks a lot guys,
Simon
|
|
|
|
|
You can use sizeof in C# too, but only on value types.
There is no method to get the size of objects, as that rarely makes any sense. If you for an example do like this:
string s = new string('x', 50000);<br />
string[] a = new string[10000];<br />
for (int i=0; i<10000; i++) a[i] = s;
Now you have an array of 10000 strings that each uses 100 kb. That adds up to about one gigabyte. But as all the strings reference the same memory area, it actually only uses about 140 kb.
If you want the memory size of an array you have to add the items yourself, and if there can be items referencing the same object, you have to decide how to handle that.
---
b { font-weight: normal; }
|
|
|
|
|
Even in C++, sizeof does not always tell how much memory your object uses. For example, sizeof(some_pointer) only tells the size of the pointer variable, not the size of the instance it points to.
Best,
Jun
|
|
|
|
|
i want to generate table from sql script but dont know how to execute the sql script so i m using selected code from script file to generate table.
String strQuery="CREATE TABLE tblServer (ServerName nvarchar(50) NOT NULL,UserId nvarchar(50) NOT NULL,Password nvarchar(50) NOT NULL)";
SqlConnection conn= new SqlConnection(strConn);
conn.Open();
SqlCommand cmd=new SqlCommand(strQuery,conn);
cmd.ExecuteNonQuery();
conn.Close();
but it gives sql exception i dont know why.what i want to do is create table when app starts on sql server. if you tell me technique of executing sql srcipt file or other method
Tasleem Arif
|
|
|
|
|
the strQuery is correct...
so what is the exception ??
Tamimi - Code
|
|
|
|
|
it gives system.data.sql exception
Tasleem Arif
|
|
|
|
|
it could by the connection string format
Tamimi - Code
|
|
|
|
|
tasleem143 wrote:
but it gives sql exception i dont know why.what i want to do is create table when app starts on sql server. if you tell me technique of executing sql srcipt file or other method
Which line throws the exception? The exception should also give you more information that just sql exception. When you catch the exception what other information does the exception variable have?
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
|
it works i had found where exception was.thanks for reply.
Tasleem Arif
|
|
|
|
|
hi!!
I am trying to build an application using .net and C# which will allow me to push objects from my desktop to all nearby devices. Its like a program to alert all nearby devices.
I have been trying to find ways to access the bluetooth stack on my desktop using .net but havent been able to do so.
Can any one tell me how can i achieve this?
thanks
p.s :I am eagerly waiting a reply ..its kinda urgent!!
|
|
|
|
|
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.DoubleBuffer, true);
works for forms
but what about panel or other controls ?.. is there a way to stop the flickering while drawing on a paint event?
modified 30-Nov-21 21:01pm.
|
|
|
|
|
mihaila mihai wrote: this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.DoubleBuffer, true);
SetStyle is inherited from Control so will work with all classes derived from Control at some point, so Panel yes, other controls almost certainly yes.
The Welsh will always support two teams: The Welsh, and anyone playing England
|
|
|
|
|
I'm trying to insert a record into a sql server 2000 database using a store
procedure (vs.net is my develop tool) on the button click event but I keep
getting the following error after clicking the button:
Object must implement IConvertible.
When i try to read TemplateColumns from datagrid and to insert in sql server table, i think is the problem.
I don't have any trace.
Code:
public void inscriereemail()
{
string conn = ConfigurationSettings.AppSettings["conn"];
SqlConnection objConnection = new SqlConnection(conn);
SqlCommand mycmd = new SqlCommand("add_email", objConnection);
mycmd.CommandType = CommandType.StoredProcedure;
lblint.Text = Request.QueryString["id"];
SqlParameter expeditorp=new SqlParameter ("@expeditor", SqlDbType.VarChar, 4);
expeditorp.Direction=ParameterDirection.Input;
expeditorp.Value= lbluser.Text;
mycmd.Parameters.Add(expeditorp);
SqlParameter destinatar1p=new SqlParameter ("@destinatar", SqlDbType.VarChar, 5);
destinatar1p.Direction=ParameterDirection.Input;
destinatar1p.Value = dgdest.Items[0].FindControl("lbldest"); <- Problemns
mycmd.Parameters.Add(destinatar1p);
SqlParameter destinatarp=new SqlParameter ("@destinatar_camion", SqlDbType.VarChar, 4);
destinatarp.Direction=ParameterDirection.Input;
destinatarp.Value= lblint.Text;
mycmd.Parameters.Add(destinatarp);
SqlParameter titlup=new SqlParameter ("@titlu", SqlDbType.VarChar, 25);
titlup.Direction=ParameterDirection.Input;
titlup.Value=txttitlu.Text;
mycmd.Parameters.Add(titlup);
SqlParameter mesajp=new SqlParameter ("@mesaj", SqlDbType.VarChar, 800);
mesajp.Direction=ParameterDirection.Input;
mesajp.Value=txtmesaj.Text;
mycmd.Parameters.Add(mesajp);
SqlParameter cititp=new SqlParameter ("@citit", SqlDbType.VarChar, 1);
cititp.Direction=ParameterDirection.Input;
cititp.Value = "1";
mycmd.Parameters.Add(cititp);
SqlParameter trashp=new SqlParameter ("@trash", SqlDbType.VarChar, 1);
trashp.Direction=ParameterDirection.Input;
trashp.Value = "1";
mycmd.Parameters.Add(trashp);
SqlParameter data_adaugarep=new SqlParameter ("@data_adaugare", SqlDbType.VarChar, 35);
data_adaugarep.Direction=ParameterDirection.Input;
data_adaugarep.Value = lblTime.Text;
mycmd.Parameters.Add(data_adaugarep);
try
{
objConnection.Open();
mycmd.ExecuteNonQuery();
}
finally
{
if (objConnection.State == ConnectionState.Open)
{
objConnection.Close();
}
}
}
|
|
|
|
|
ujupanmester wrote: destinatar1p.Value = dgdest.Items[0].FindControl("lbldest"); <- Problemns
destinatar1p.Value = ((Label)dgdest.Items[0].FindControl("lbldest")).Text;
|
|
|
|
|
Thanks.
Your code work fine and thanks a lot because you help me.
|
|
|
|
|
hi all
i have 2 com+ is A AND B
i want if client can call B have to after call A
if client call B will have Exception
Ex:
if client call A
after call A will return for client
C = New B
return C
Client call
B b = C
---------------
if Client call
B b = new B;
will Exception
-- modified at 6:35 Saturday 24th June, 2006
|
|
|
|