L
lallous
Hello
I am not very experienced with this issue and would your opinion on
whether it is healthy or not:
1) I created an ATL COM object (say MyCOM):
- that supports connection points
- that exposes couple of methods such as:
BeginOperation()
GetInformation()
- Exposed some events in the _IMyCOMEvents interface which was created
automatically by the wizard, such as:
OnNewItem()
OnProgressItem()
OnEndItem()
2) Implemented the connection points, etc...
Some information about BeginOperation():
1) It takes some initial parameters and stores them in the class member
variables
2) It creates a thread (CreateThread API), passing "this" as context
3) returns to the caller
The thread proc of BeginOperation():
1) do some lenghty operations (like file copying)
2) while doing the operations, fire the events when needed:
Fire_OnItemProgress() ....
I wanted to test this COM from C#, so:
1)Added reference to the COM
2)created a new instance of the object in the form' s constructor
3)Added new delegates to the object's OnNew, OnEnd, ...
The delegates updates the screen such as:
void OnNewItem(int itemNo)
{
StatusLabel.Text = "Currently processing item #" + itemNo.ToString();
}
etc...
Now, I am facing some weird issues:
1)sometimes, events are called, but only one line is being executed,
and then directly another event is being fired, w/o the first one
finishing
2)if application is ran w/ the debugger, it looks like the screen is
not updated as if some events are not triggered.
Please advise if this is the correct way of doing this.
Regards,
Elias
I am not very experienced with this issue and would your opinion on
whether it is healthy or not:
1) I created an ATL COM object (say MyCOM):
- that supports connection points
- that exposes couple of methods such as:
BeginOperation()
GetInformation()
- Exposed some events in the _IMyCOMEvents interface which was created
automatically by the wizard, such as:
OnNewItem()
OnProgressItem()
OnEndItem()
2) Implemented the connection points, etc...
Some information about BeginOperation():
1) It takes some initial parameters and stores them in the class member
variables
2) It creates a thread (CreateThread API), passing "this" as context
3) returns to the caller
The thread proc of BeginOperation():
1) do some lenghty operations (like file copying)
2) while doing the operations, fire the events when needed:
Fire_OnItemProgress() ....
I wanted to test this COM from C#, so:
1)Added reference to the COM
2)created a new instance of the object in the form' s constructor
3)Added new delegates to the object's OnNew, OnEnd, ...
The delegates updates the screen such as:
void OnNewItem(int itemNo)
{
StatusLabel.Text = "Currently processing item #" + itemNo.ToString();
}
etc...
Now, I am facing some weird issues:
1)sometimes, events are called, but only one line is being executed,
and then directly another event is being fired, w/o the first one
finishing
2)if application is ran w/ the debugger, it looks like the screen is
not updated as if some events are not triggered.
Please advise if this is the correct way of doing this.
Regards,
Elias