Entra:     


Forum: VirtualDJ Plugins

Topic: Using WndProc in a Plugin ?!

Questo argomento è obsoleto e potrebbe contenere informazioni obsolete o errate.

What is the easiest way to set up a WndProc function in a Plugin ? I want to monitor some windows messages.
 

Inviato Mon 11 Aug 08 @ 12:24 pm
To elaborate:

I want to monitor "WM_COPYDATA", So no strange stuff ;-)

Can i use the handle returned by GetInfo("hwnd") or do i have to create an invisible window and add it to that ? Or is there any other way ?
 

What window are you trying to capture the message from - surely it would have to be the target control of the original SendMessage() call, which means you would have to have created that control, and thus already have a callback function attached to handle it's messages?
 

The best would be if i could attach it to the main VDJ window and use the handle i get from GetInfo(). Can i setup a WndProc function, attach it to the main VDJ window in a plugin ? Or do i have to create an invisible window and use for this.

It's my code that generate the SendMessage() from another process so i just a need a WndProc function with a valid handle in the Plugin to Send it to.

I'm still testing different IPC methods with VDJ to evaluate the best one for my use.
 

If it's only to get message, try something like this. I didn't test it but maybe it's enough in your case


MSG msg;


while(GetMessage(&msg,NULL,0,0))
{
if(msg.message==WM_XX)
// your code
}


Do not use the function "PeekMessage" instead of GetMessage() because PeekMessage will use your CPU at 100% with the "while" whereas it's not the case with GetMessage()
The NULL of GetMessage is a HWND
 

Doesn't that take a lot of CPU ? A WndProc must be better, or ?
 

pern wrote :
Doesn't that take a lot of CPU ? A WndProc must be better, or ?

A WndProc uses the same system. It's common for all the window to communicate: loop of MSG

MSG msg;

while(GetMessage(&msg,NULL,0,0)==TRUE)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
 

ok , well i will do some testing .....
 



(Vecchi argomenti e forum sono automaticamente chiusi)