Click here to Skip to main content
15,914,111 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: configuration of windows update Pin
Girish6017-Oct-05 22:52
Girish6017-Oct-05 22:52 
GeneralRe: configuration of windows update Pin
Saksida Bojan8-Oct-05 2:40
Saksida Bojan8-Oct-05 2:40 
GeneralRe: configuration of windows update Pin
Girish6018-Oct-05 3:11
Girish6018-Oct-05 3:11 
GeneralRe: configuration of windows update Pin
Saksida Bojan12-Oct-05 19:49
Saksida Bojan12-Oct-05 19:49 
QuestionMFC v VC++.Net Pin
Klempie7-Oct-05 9:44
Klempie7-Oct-05 9:44 
AnswerRe: MFC v VC++.Net Pin
Christian Graus8-Oct-05 3:55
protectorChristian Graus8-Oct-05 3:55 
AnswerRe: MFC v VC++.Net Pin
Nemanja Trifunovic8-Oct-05 5:02
Nemanja Trifunovic8-Oct-05 5:02 
QuestionHow to signal an event from a managed event handler to an unmanaged callback in a different thread? Pin
mav.northwind7-Oct-05 0:16
mav.northwind7-Oct-05 0:16 
Hi folks!

I'm struggling to find a reliable way to build an interface between an unmanaged C++ application and a managed C# remoting application.

I've got to build an interface dll that's capable of signalling events by calling callback methods in given feedback objects.
This callback has to be called from the same thread the interface dll is being loaded in.
Something like this:
class MyObj
{
 public:
   virtual void OnXChanged(int arg) = 0;
}
as declaration for the callback function.

The C# server is signalling the corresponding event by calling an asynchronous event handler in a managed class in my mixed mode interface dll.
Something similar to this:
void InitManagedServerComm()
{
  ManagedCallbackObj* managedCallbackHandler = new ManagedCallbackObj();
  pRemotingServer->RegisterEventClient(managedCallbackHandler);
}
where ManagedCallbackObj is implementing an interface consisting of callback functions the remoting server is able to signal events with:
__gc class ManagedCallbackObj : public IEventClient
{
  public:
    void OnEventX(System::Object *pObj, MyEventArgs* pArgs);
...
}
So far, so good, the remoting server successfully calls my managed callbacks (i.e. runs through OnEventX()), but this managed event handler function gets called from a different thread, not the one the dll was loaded in, of course.
So I need a way to transfer the event from the managed event handler to an unmanaged method in a different threat that's calling the given callback.

If I was in a pure C# world I'd simply create a Control and call Invoke(), but how to do this between managed and unmanaged?

Any ideas how to accomplish this?

Really stumped,

mav
AnswerRe: How to signal an event from a managed event handler to an unmanaged callback in a different thread? Pin
mikanu10-Oct-05 5:45
mikanu10-Oct-05 5:45 
GeneralRe: How to signal an event from a managed event handler to an unmanaged callback in a different thread? Pin
mav.northwind10-Oct-05 7:51
mav.northwind10-Oct-05 7:51 
Questionconfiguration of windows update Pin
Anonymous7-Oct-05 0:13
Anonymous7-Oct-05 0:13 
AnswerRe: configuration of windows update Pin
Saksida Bojan7-Oct-05 22:39
Saksida Bojan7-Oct-05 22:39 
Questionhow to link .lib file to my project (managed C++) in .Net Pin
vic120006-Oct-05 18:34
vic120006-Oct-05 18:34 
AnswerRe: how to link .lib file to my project (managed C++) in .Net Pin
Anonymous6-Oct-05 21:37
Anonymous6-Oct-05 21:37 
GeneralRe: how to link .lib file to my project (managed C++) in .Net Pin
vic120007-Oct-05 9:00
vic120007-Oct-05 9:00 
GeneralRe: how to link .lib file to my project (managed C++) in .Net Pin
mikanu10-Oct-05 5:50
mikanu10-Oct-05 5:50 
GeneralRe: how to link .lib file to my project (managed C++) in .Net Pin
vic1200011-Oct-05 19:01
vic1200011-Oct-05 19:01 
QuestionNeed help Base36 encoding large number (~45 digits) Pin
Suresh C T6-Oct-05 7:21
sussSuresh C T6-Oct-05 7:21 
AnswerRe: Need help Base36 encoding large number (~45 digits) Pin
Anonymous6-Oct-05 21:34
Anonymous6-Oct-05 21:34 
GeneralRe: Need help Base36 encoding large number (~45 digits) Pin
Anonymous9-Oct-05 21:36
Anonymous9-Oct-05 21:36 
QuestionConvert String to LPSTR ? Pin
Phernando6-Oct-05 6:53
Phernando6-Oct-05 6:53 
AnswerRe: Convert String to LPSTR ? Pin
Sheng Jiang 蒋晟7-Oct-05 12:56
Sheng Jiang 蒋晟7-Oct-05 12:56 
QuestionWindows Message disappearing Pin
mav.northwind5-Oct-05 22:28
mav.northwind5-Oct-05 22:28 
AnswerRe: Windows Message disappearing Pin
mav.northwind6-Oct-05 5:26
mav.northwind6-Oct-05 5:26 
QuestionWindows Services Pin
Laji594-Oct-05 18:02
Laji594-Oct-05 18:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.