Ingreso rápido:  

Forum: VirtualDJ Plugins

Tema: Using WndProc in a Plugin ?!

Este tópico es antiguo y puede contener información incorrecta para la nueva versión.

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

Mensajes Mon 11 Aug 08 @ 12:24 pm
pernPRO InfinityMember since 2004
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 ?
 

Mensajes Mon 11 Aug 08 @ 12:51 pm
SBDJPRO Infinity Member since 2006
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?
 

Mensajes Mon 11 Aug 08 @ 3:15 pm
pernPRO InfinityMember since 2004
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.
 

Mensajes Tue 12 Aug 08 @ 12:44 am
djcelPRO InfinityModeratorMember since 2004
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
 

Mensajes Tue 12 Aug 08 @ 6:59 am
pernPRO InfinityMember since 2004
Doesn't that take a lot of CPU ? A WndProc must be better, or ?
 

Mensajes Tue 12 Aug 08 @ 12:33 pm
djcelPRO InfinityModeratorMember since 2004
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);
}
 

Mensajes Tue 12 Aug 08 @ 2:00 pm
pernPRO InfinityMember since 2004
ok , well i will do some testing .....
 

Mensajes Tue 12 Aug 08 @ 2:03 pm


(Los tópicos y foros antiguos son automáticamente cerrados)