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.

Tuesday, December 14, 2010

We are now a Nokia Qt Ambassador

We are happy to announce that we have become an official Nokia Qt Ambassador. This is very flattering for us because Nokia's Qt is our technology of choice as it emerges as the most sophisticated C++ framework available.


Friday, December 3, 2010

Our new product: J7Goodies

Today we are releasing another product for Windows 7 integration. J7Goodies is a Java library that provides Windows 7 features like jump list, taskbar thumbnails, thumbnail toolbar and more, the Java way. This is a complete package, it does everything you can think of in terms of the new Windows 7 taskbar extensions.

Sunday, November 14, 2010

Sketch - an unbloated sketching app released

We are happy to announce the release of Sketch - a simple application for drawing drafts. Stop fine-tuning your drafts and get the job done. Finally a prototyping application that focuses on productivity. Sketch by its simplicity forces you to think about the big picture.

Tuesday, September 28, 2010

How to connect a Samsung Syncmaster P2270HD to your PC with a HDMI cable

If you connect a Samsung Syncmaster to your PC/laptop using a HDMI cable the quality isn't very good. It looks a little blurry. It took me a lot of research to find the solution.

You have to go to the Source menu in your Samsung, then choose Rename and select a PC as the name. After this you will get a crystal clear picture.

Wednesday, September 15, 2010

Q7Goodies evaluation version released

We just created and uploaded an evaluation version of Q7Goodies. This version has the same features as the full one but it works only for 30 days and appends the 'Q7Goodies' string to window title, jump list entries, taskbar thumbnail title, etc.

The evaluation version contains dynamic and static libraries for both: Microsoft Visual C++ and MinGW (QtCreator). There are also two demo applications and their source code. The header files are self-contained, it means that you don't need to install the Windows 7 SDK.

Ok, where to download it? Just go to the demos section.

Wednesday, August 11, 2010

Embedding Application Manifest and Version Information using QtCreator

Modern applications for Microsoft Windows should include an embedded manifest and version information. The version information is used for example by the UAC dialog and it is displayed in Explorer's file properties. The manifest is even more important because without it Vista and Windows 7 will virtualize your application's access to the registry and file system. Unfortunately it is not obvious how to embed such information using QtCreator, so we publish this post in hope it will save you time.

Application Manifest

First, we have to prepare an application manifest file. This one below is for application that does not require administrator rights:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <assemblyIdentity version="2.0.2.0" processorArchitecture="X86" type="win32"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>
Second, we need the MT.exe tool from the Microsoft Windows SDK to embed this XML in our executable. To do it use the following command:
mt.exe –manifest MyApp.exe.manifest -outputresource:MyApp.exe;1

Tuesday, August 3, 2010

Our company has received funding from the European Union

We are very happy to announce that our company has received funding from the European Union. The money come from the Human Capital National Cohesion Strategy within the European Social Fund. We hope to put the funds to good use that will allow Strix Code to grow and introduce a few more interesting products.

Saturday, June 5, 2010

Luabind converter for QString

Luabind is a very convenient tool for binding C++ code to Lua. If you want to use Lua inside your Qt project then support for QString type is a must. By adding a little C++ template you can teach Luabind how to convert between QString and Lua string types. Just copy and paste the following code.
namespace luabind
{
    template <>
    struct default_converter
      : native_converter_base
    {
        static int compute_score(lua_State* L, int index)
        {
            return lua_type(L, index) == LUA_TSTRING ? 0 : -1;
        }

        QString from(lua_State* L, int index)
        {
            return QString(lua_tostring(L, index));
        }

        void to(lua_State* L, QString const& x)
        {
            lua_pushstring(L, x.toAscii());
        }
    };

    template <>
    struct default_converter
      : default_converter
    {};
}

Monday, May 10, 2010

Windows 7 or Vista UAC Shield Icon in Qt

(For a way to embed an application manifest with QtCreator see here)

In a Qt application you cannot use the BCM_SETSHIELD message to show the UAC shield icon on a QWidget. This is because Qt does its own painting. The good news is that, it is very simple to access this icon in Qt.


QIcon icon = QApplication::style()->standardIcon(QStyle::SP_VistaShield);
pushButton->setIcon(icon);
commandLinkButton->setIcon(icon);

The above code will return null icon on systems older then Windows Vista.
If you are developing for Windows 7 then check out Q7Goodies - a Qt add-on that provides Windows 7 features like jump list, taskbar thumbnails, thumbnail toolbar and more in a Qt way. It integrates seamlessly with existing applications by using Qt design patterns and API style. It comes with the full source code and a royalty-free license.