Wednesday, December 9, 2009

HOWTO: Close Application on Minimize

This is a popular question lately: how do I close my application when the user clicks the "smart minimize button"? This button does exactly that - it minimizes your application and does not close it. Your main application window is minimized when it receives a WM_SIZE message with the SIZE_MINIMIZED constant in the wParam parameter. All you have to do is call PostMessage(WM_CLOSE) and you are done. Here's a sample WTL handler:

LRESULT CCloseOnMinFrame::OnSize(UINT /*uMsg*/,WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled){
if(wParam == SIZE_MINIMIZED) {
bHandled = TRUE;
return 0;
// Not handled here
bHandled = FALSE;
return 1;

Article about Windows Mobile 6.5 Gestures

There is a new article on CodeProject about Windows Mobile 6.5 Gestures, and it's fully written in native code. Go there and have a look!

Tuesday, July 14, 2009

Windows Mobile 6.5 Gestures documented

The documentation for Windows Mobile 6.5 Gestures is now online here.

unresolved external symbol CLSID_ImagingFactory

Just started out a new sample project that illustrates how to use the WM libraries I'm writing, and got the following link errors:

1>wmfw.lib(Image.obj) : error LNK2001: unresolved external symbol CLSID_ImagingFactory
1>wmfw.lib(Image.obj) : error LNK2001: unresolved external symbol IID_IImagingFactory

This means that the linker cannot find the symbols CLSID_ImagingFactory and
IID_IImagingFactory, required to use the imaging library on Windows Mobile. If you look at the documentation, you will see that a link to the imaging.lib file is required but it will not work (at least it does not work for me).

The solution I found is to force the inclusion of these symbols using a dummy file that I usually name guids.cpp. Here's the content:

#include "stdafx.h"
#include <initguid.h>
#include <imgguids.h>

The initguid.h include redefines the DEFINE_GUID macro that is used by imgguids.h so that it declares a GUID along with its value instead of making an external reference to the same symbol.

Compile and link and the error goes away.

Tuesday, May 19, 2009

WTL 8.1.9127 is out!

WTL 8.1.9127 is out since May 7 2009.
At firt look they added installation support for VS2008 (setup90.js).