LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use RegisterHotkey and WM_HOTKEY to do global hotkey application

Hi all,

I try to register windows hotkey through using user32.dll RegisterHotkey function and get the windows message to process future applications.

My code is attached as follows, and the user32.dll is called in the Register Hotkey and Unregister Hotkey subVI.

 

Main.jpg

 

 

This is the Register Hotkey SubVI. The x0 is the hWnd.

Register Hotkey.jpg

 

 

This is the Unregister Hotkey SubVI.

unregister hotkey.jpg

 

The Windows Message Queue Library can be found here.

http://sine.ni.com/devzone/cda/epd/p/id/4394

 

I don't know why I am not getting any windows message out of this scenario, even though the RegisterHotkey function seems to work.

Please provide some suggestion for this application.

 

Thank you

 

Bboyz

0 Kudos
Message 1 of 6
(4,530 Views)

Seems nobody know the answer.....@@...

0 Kudos
Message 2 of 6
(4,494 Views)

In this particular case it would be better if you posted the actual VIs so your Call Library Function Nodes can be inspected. You do not need to upload the library VIs, as those can be downloaded directly. Be sure to upload the subVIs you created.

0 Kudos
Message 3 of 6
(4,485 Views)

Hi,

 

The Main VI and the subVI are here.

Please help me to check if the Call Library Function Node can work properly.

 

Thank you

Download All
0 Kudos
Message 4 of 6
(4,475 Views)

I think the problem you have is that the Message Queue library is written to create a message queue tied to a window. It does not see messages that are "global" in nature. Thus, you'd have to do a RegisterHotKey and specify the window refnum of your main VI's window.

0 Kudos
Message 5 of 6
(4,470 Views)

Hi Smercurio,

 

I don't have the idea of how to get the windows procedures.

I realized that the reason it didn't work was because of the function of windows procedure is not properly declared.

 

Here are some example codes.

http://www.developerfusion.com/code/271/create-a-hot-key/

http://www.vb-helper.com/howto_hotkey.html

 

Both of them were utilizing CallWindowProc lib, but I really don't know how to use it in LabVIEW.

Could you give me some more idea about my application?

 

Actually, I want to make the hotkey function global, but not only within the main VI.

 

Thank you for your reply.

 

Ting

 

 

 

 

0 Kudos
Message 6 of 6
(4,390 Views)