PostMessage (WM_USER) from another process

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
sash
Competition winner
Posts: 35
Joined: Thu Nov 05, 2009 8:46 am
Location: Novosibirsk

PostMessage (WM_USER) from another process

Post by sash »

Hello,

Is it possible to handle in Irrlicht (Win32) application WM_USER messages sent from another process to "embedded" Irrlicht window ?
PostMessage(hwnd, WM_USER..) call from the same Irrlicht application works ok and generates EET_USER_EVENT as expected ... however PostMessage from another application seems like just ignored in

Code: Select all

while( device->run() ) {}
Any hints / ideas about this ?

Thanks.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Maybe the app needs to set up for receiving messages from elsewhere? Don't know if there's some configuration to deal with this.
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

It shouldn't matter whether the message is internal or external, provided you're passing it using the right HWND. Are you sure the problem isn't elsewhere?
sash
Competition winner
Posts: 35
Joined: Thu Nov 05, 2009 8:46 am
Location: Novosibirsk

Post by sash »

slavik262 wrote:It shouldn't matter whether the message is internal or external, provided you're passing it using the right HWND. Are you sure the problem isn't elsewhere?
Well, yes, (it seems like :)) I'm sure it's ok with HWND and inter-process messages - because PostMessage from Irrlicht to another application works too ...
Now I'm trying to figure out if soemthing can be done with CIrrDeviceWin32.cpp:

Code: Select all

//! runs the device. Returns false if device wants to be deleted
bool CIrrDeviceWin32::run()
{
	os::Timer::tick();

	MSG msg;

	while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
	{
		// No message translation because we don't use WM_CHAR and it would conflict with our
		// deadkey handling.

		if (ExternalWindow && msg.hwnd == HWnd)
			WndProc(HWnd, msg.message, msg.wParam, msg.lParam);
		else
			DispatchMessage(&msg);

		if (msg.message == WM_QUIT)
			Close = true;
	}

	if (!Close)
		resizeIfNecessary();

	if(!Close)
		pollJoysticks();

	_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
	return !Close;
}
Post Reply