Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / June 2005

Tip: Looking for answers? Try searching our database.

Posting Message in .NET

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
H.B. - 02 Jun 2005 21:25 GMT
Hi,

What is the equivalent of PostMessage() in Managed C++;

Thanks,

Hugo
Marcus Heege - 02 Jun 2005 21:58 GMT
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

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.