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 / .NET Framework / New Users / June 2006

Tip: Looking for answers? Try searching our database.

How do you send a windows message?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bern11 - 02 Jun 2006 04:20 GMT
How do you send a windows message in the .net framework?  Creating
messages is easy, so is intercepting messages, but I cannot find a .net
equivalent to the windows api sendmessage() function.
Greg Young - 02 Jun 2006 04:22 GMT
[DllImport("user32.dll")]
         public static extern int SendMessage(
              int hWnd,      // handle to destination window
              uint Msg,       // message
              int wParam,  // first message parameter
              int lParam   // second message parameter
              );

Cheers,

Greg Young
MVP - C#
http://geekswithblogs.net/gyoung

> How do you send a windows message in the .net framework?  Creating
> messages is easy, so is intercepting messages, but I cannot find a .net
> equivalent to the windows api sendmessage() function.
bern11 - 03 Jun 2006 01:53 GMT
    Well, yeah.  I meant how do you do it within the .Net framework?  What
is the point of having a Message class if you can't Send them?

    I'm going to try one last gimmick I thought of, then I'm off to
#include <Windows.h> world....

> [DllImport("user32.dll")]
>           public static extern int SendMessage(
[quoted text clipped - 13 lines]
>>messages is easy, so is intercepting messages, but I cannot find a .net
>>equivalent to the windows api sendmessage() function.
bern11 - 03 Jun 2006 03:55 GMT
    I isolated the code that opened a second form out of the header and
into the .cpp file.  That way the main form header didn't have to
include the 2nd form header, so I could then include the main form
header in the 2nd form header and declare a pointer as a member, which I
then set the 'this' pointer to, and then accessed the main form callback
through the pointer.

    It's not 1/2 a confusing as it sounds:

in MainForm.cpp:
    #include NewForm.h

    NewForm^ form2 = gcnew NewForm;
    form2->mainFormPtr = this;
    form2->ShowDialog();

in NewForm.h
    #include MainForm.h;
    ...
    Proj::MainForm^ mainFormPtr;

    mainFormPtr->ExecMemberFunction();

It was HeaderA including HeaderB which included HeaderA causing the
problem....

>     Well, yeah.  I meant how do you do it within the .Net framework?  
> What is the point of having a Message class if you can't Send them?
[quoted text clipped - 19 lines]
>>> messages is easy, so is intercepting messages, but I cannot find a
>>> .net equivalent to the windows api sendmessage() function.
William Sullivan - 02 Jun 2006 13:53 GMT
Check out pinvoke.net; they have several different versions and some good
info on the sendmessage function.

> How do you send a windows message in the .net framework?  Creating
> messages is easy, so is intercepting messages, but I cannot find a .net
> equivalent to the windows api sendmessage() function.

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.