How to get hWnd for calling WinAPI function from NW?

5 views
Skip to first unread message

nguyend...@gmail.com

unread,
Mar 7, 2014, 8:10:01 AM3/7/14
to node-...@googlegroups.com
Hi all,
I have a problem with taskbar icon. I want to set the overlay icon for taskbar icon in Win7.8. I found the WinAPI function SetOverlayIcon, and it needs hWnd for it.
I can run native addon successfully (sample helloWorld) using nw-gyp in NW . But can I call this WinAPI function in this add-on? I tried to find the window handle in NW's api but not found.
Is there solution for it?
Thanks in advance.

nguyend...@gmail.com

unread,
Mar 8, 2014, 5:14:34 AM3/8/14
to node-...@googlegroups.com, nguyend...@gmail.com
Hi again,
So I found that there is a Node-qt addon, every object they will create its wrapper for it. So can we use V8 to write the wrapper for WinAPI function and call it in addon?
Or the last solution is that I need to rebuild the NW from scratch?
Thanks.

Luke

unread,
Mar 14, 2014, 4:07:24 AM3/14/14
to node-...@googlegroups.com, nguyend...@gmail.com
Did you have any luck with this?  It would be nice if this was added to the node-webkit.  Also on the Mac it could be used to add badges to the dock icon, not sure if there is a similar feature that could be added for the Linux platform.

Duc Tai Nguyen

unread,
Mar 14, 2014, 11:47:40 PM3/14/14
to node-...@googlegroups.com, nguyend...@gmail.com, luker...@gmail.com
Hi Luke,

I tried to do this in WIndows. And the result is:
solution 1. Using V8 native addon to call the WinAPI (ITaskBarList3 interface to call SetOverlayIcon) 
solution 2. Using another process to call ITaskBarList3 ::SetOverlayIcon to taskbar of our program.

Both of these solutions don't work, because the hWnd in setOverlayIcon need to get from the main process. (Windows made this rule, don't know why, but the other functions (for. ex. ITaskBarList3 ::SetProcessState) works normally for these solutions. 
So the last solution is rebuild node-webkit from scratch and add this function into main process nw.exe. Or we will wait the NW team to add this feature.


(in NW issues, there was the same thread: https://github.com/rogerwang/node-webkit/issues/925)

And when I try to build NW from scratch, i have the problem when glient sync, but don't know how to solve, and it post here. 

Luke

unread,
Mar 15, 2014, 1:34:41 AM3/15/14
to node-...@googlegroups.com, nguyend...@gmail.com, luker...@gmail.com
Looks like the only way is for this to be extended into the node-webkit JS API.  I see there is already an issue open at https://github.com/rogerwang/node-webkit/issues/925 for the Mac dock badges.  Is there a Linux equivalent for this functionality so we can cover all platforms?

It would be nice to see an option like win.setBadgeText() for Mac OS X as well as win.setOverlayImage() for Windows 7 / 8 systems.  Is the node-webkit project adding platform specific features such as this, or this not the goal of the project?

I don't have any experience in c++ so can't really help with this, however I willing to assist financially to have this added sooner than later.
Reply all
Reply to author
Forward
0 new messages