[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.
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.