LRESULT CCloseOnMinFrame::OnSize(UINT /*uMsg*/,WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled){
if(wParam == SIZE_MINIMIZED) {
PostMessage(WM_CLOSE);
bHandled = TRUE;
return 0;
}
// Not handled here
bHandled = FALSE;
return 1;
}
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:
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.
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).
Enjoy!
At firt look they added installation support for VS2008 (setup90.js).
Enjoy!
Thursday, October 9, 2008
Oriented Dialogs and SP platform
Some new SP devices supports screen rotation (ex: HTC S7xx series) but all 'CStdOrientedDialog' classes are only supported for PPC platform in WTL8.0.
So i changed some WTL files to add those classes to SP too.
The only file to change is: 'atlwince.h'
If you want support also in wizard you need to change also: 'AppType.htm' and 'Platforms.htm' in 'AppWizMobile\Files\HTML\1033' folder.
You can find the modified files here
Bye :)
So i changed some WTL files to add those classes to SP too.
The only file to change is: 'atlwince.h'
If you want support also in wizard you need to change also: 'AppType.htm' and 'Platforms.htm' in 'AppWizMobile\Files\HTML\1033' folder.
You can find the modified files here
Bye :)
Wednesday, October 1, 2008
CStdDialogImpl and the OK button
Are using CStdDialogImpl as the base class for your WTL dialogs? Are you having difficulty hiding the "ok" button? Here's a simple solution:
Derive your dialog class (say CMyDialog) from
CStdDialogImpl<CMyDialog, SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_SIPDOWN>
On the OnInitDialog handler, call:
SHDoneButton(m_hWnd, SHDB_HIDE);
ModifyStyle(0, WS_NONAVDONEBUTTON, SWP_NOSIZE);
Make sure you change all the calls to CStdDialogImpl<CMyDialog> methods with the new base (you can use a typedef for that).
Derive your dialog class (say CMyDialog) from
CStdDialogImpl<CMyDialog, SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_SIPDOWN>
On the OnInitDialog handler, call:
SHDoneButton(m_hWnd, SHDB_HIDE);
ModifyStyle(0, WS_NONAVDONEBUTTON, SWP_NOSIZE);
Make sure you change all the calls to CStdDialogImpl<CMyDialog> methods with the new base (you can use a typedef for that).
Subscribe to:
Posts (Atom)