|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How do you send a windows message?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. [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 Show quote "bern11" <ber***@yahoo.com> wrote in message news:LZWdnWj8dL7_M-LZnZ2dneKdnZydnZ2d@comcast.com... > 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. 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.... Greg Young wrote: Show quote > [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 > > "bern11" <ber***@yahoo.com> wrote in message > news:LZWdnWj8dL7_M-LZnZ2dneKdnZydnZ2d@comcast.com... > >>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. > > > 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.... bern11 wrote: Show quote > > 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.... > > Greg Young wrote: > >> [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 >> >> "bern11" <ber***@yahoo.com> wrote in message >> news:LZWdnWj8dL7_M-LZnZ2dneKdnZydnZ2d@comcast.com... >> >>> 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. >> >> >> >> Check out pinvoke.net; they have several different versions and some good
info on the sendmessage function. Show quote "bern11" wrote: > 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. > |
|||||||||||||||||||||||