Quick Sign In:  

Forum: VirtualDJ Plugins

Topic: Using WndProc in a Plugin ?!

This topic is old and might contain outdated or incorrect information.

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.
 

Posted 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 ?
 

Posted 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?
 

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

Posted 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
 

Posted 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 ?
 

Posted 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);
}
 

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

Posted Tue 12 Aug 08 @ 2:03 pm


(Old topics and forums are automatically closed)