Thursday, January 27, 2011

How to find the position of a taskbar button on Windows 7 or Vista

In this article I'm going to show you how to find the position of your application's taskbar button on the Windows 7 taskbar. The example code is Qt/C++ but it easy to adapt it for another language.
First of all we have to find the taskbar window (its HWND). We do this by searching for a specific window class:
HWND hwndTrayWnd = ::FindWindowW(L"Shell_TrayWnd", NULL);
Then we must find a child window which contains all the buttons:

Tuesday, January 25, 2011

J7Goodies version 1.0.6 released

J7Goodies version 1.0.6 has been released. This version brings the following improvements.



1. Improved native library unloading.
Now the ClassLoader is forced at application exit to unload the native library. This should prevent a rare situation when the native library was kept in the temp directory.

2. Keeping the thumbnail toolbar visible.
When you hide and then show again a window that has a thumbnail toolbar then the toolbar will stay hidden. This is how Windows 7 works. Now you can show the toolbar again be calling it's show() method (only after your window is visible).

3. Detecting when a taskbar button is created.
When you hide and show your application window then its taskbar button is destroyed and recreated every time. You cannot access the button until it is created and sometimes it happens some time after the window became visible. Now you can be informed about this event by adding a TaskbarButtonListener to your TaskbarButton.
taskbarButton.addTaskbarButtonListener(new TaskbarButtonListener() {
    public void taskbarButtonCreated(TaskbarButtonEvent tbe) {
        thumbnailToolBar.show();
    }
});
4. New license manager.
The license verification code has been rewritten. Previously license files were encrypted. Now they are plain-text files. This will help to spot a situation when someone steals your license and uses it in his/her own application.

5. Fixed TaskbarButton.isSupported()
This method was throwing UnsatisfiedLinkError instead of returning false when was not supported.

6. Performance improvements for thumbnails and live previews
Now the code that deals with window thumbnails and live previews is more efficient.

7. Native library has been refactored
The native library has been refactored so now it should be more reliable and efficient.

Tuesday, January 4, 2011

Introducing SevenBeans: NetBeans Windows 7 integration module

SevenBeans, a module for NetBeans IDE (or any other NetBeans Platform application), provides all Windows 7 taskbar extensions, excluding the thumbnail toolbar. First of all, SevenBeans allows you to pin NetBeans IDE to the taskbar. This is very handy if you use the taskbar a lot. Unfortunately, Java applications cannot be pinned to the taskbar so SevenBeans makes a difference here. When you click a taskbar button for NetBeans IDE, a jump list appears:


It contains your recent projects, so you can open them directly. There are also shortcuts for a new project and a new file.