It depends on what you want to do.
If you are implementing a WinForms app, Control.BeginInvoke is the function
you want. It expects any delegate and an argument array. If you call it on a
control, and internally calls PostMessage with the control's HWND to ensure
that the control's thread will handle the event. The event handler on the
control's thread will the call the delegate with the arguments.
If you are not implementing a WinForms app, you may call PostMessage by just
including windows.h. The compiler will automatically generate a quite
interesting PInvoke function for you.
Marcus
> Hi,
>
[quoted text clipped - 3 lines]
>
> Hugo
H.B. - 03 Jun 2005 13:44 GMT
I just want to make something like the following code and the easiest way
possible ... (I have a Windows Forms Application)
/////////////////////////////// VC++ 6.0 Old Code
///////////////////////////////////
#define WM_MYMSG WM_APP+100
PostMessage(this->GetSafeHwnd(), WM_MYMSG, 0, 0);
////////////////////////////////////////////////////////////////////////////
////////////////////////
> It depends on what you want to do.
>
[quoted text clipped - 17 lines]
> >
> > Hugo
Marcus Heege - 03 Jun 2005 14:50 GMT
System::Windows::Forms::Control supports IWin32Windows which allows you to
get a HWND via it's handle property.
If you compile with /clr or /clr:pure, you can include windows.h and call
PostMessage(this->Handle, WM_MYMSG, 0, 0);
without any extra efforts.
Marcus
>I just want to make something like the following code and the easiest way
> possible ... (I have a Windows Forms Application)
[quoted text clipped - 35 lines]
>> >
>> > Hugo