PocketPC/EVC/ProgGuide.htm

Home Up

bullet

Tips & Tricks for EVC MFC PocketPC 2002

bullet

Remove the "OK" button ("X" will show instead) on dialog-based MFC apps:

bullet
Add this line to OnInitDialog():     SHDoneButton(m_hWnd, SHDB_HIDE);
bullet

Multiline text:

bullet
You should set Multiline flag in style and text in control should contain 'new line' symbols. For different controls you should use either \n or \r\n to divide lines. For button and edit controls use \r\n for all other control types use \n.
bullet
eg:  m_edit.SetWindowText(_T("Line one\r\nLine two")); 
bullet
see:  http://www.pocketpcdn.com/articles/multiline.html 
bullet

HTML Dialog with .png images:  HTML_Dialog

bullet
Add files "HTML_Dialog.cpp" and "HTML_Dialog.h" to your project
bullet
Under "Project Settings" and the "Link" tab, type "htmlview.lib" (including quotes) on the "Object/Library Modules" line
bullet
Add #include "HTML_Dialog.h" to the dialog or view .cpp file that will launch the html dialog window.
bullet
Add a new dialog resource and rename it to:  IDD_HTML_DIALOG. Delete the "OK" and "Cancel" buttons.
bullet
Create a new HTML resource and rename it to:  IDR_TestPage_HTML.  Create an HTML web page in your favorite editor and copy the text into this resource.
bullet
If your HTML file contains pictures, add them as "GIF" resources:  "Import" the picture into the resources and give it the type "GIF" (including the quotes).
bullet
Add a new menubar and call it IDR_HTML_MENUBAR1.  Add one item and give it the caption Tools.  Add two sub-items to Tools with IDs ID_FORCEFIT and ID_EDIT_COPY and captions Force Fit and Copy, respectively. 
bullet
Add the following code to launch the HTML dialog in response to, e.g., a button push on another dialog:
void CRayTestHTMLDlg::OnButton1() 
{//show the HTML dialog
    HTML_Dialog* pDlg=new HTML_Dialog;  //create the dialog
    pDlg->m_resID=IDR_TestPage_HTML;  //tell the dialog where the HTML text is located in resources
    pDlg->RegisterHtmlImage(IDR_GIF1,_T("rays_rpn8.png"));  //tell the dialog where images are located in resources
    pDlg->DoModal();  //show the window
}
You will need to modify the pDlg->RegisterHtmlImage(IDR_GIF1,_T("rays_rpn8.png")); line to reflect the name of the image in your HTML document.
bullet
Notes: 
HTML_Dialog is based, in part, on STHtmlDialog, which you can find here:  http://www.codeproject.com/ce/sthtmldialog.asp
You can also use other types of images, but .png are usually the most compressed.
The emulator may want to locate a bunch of ".dll" files to help with debugging but just close those windows. 
Download a sample project here.
bullet

Add color to your Dialog/View background, controls...

bullet
You need to handle the WM_CTLCOLOR message.  You may need to change the message filter to add it with ClassWizard See this page: http://www.experts-exchange.com/Programming/Programming_Languages/MFC/Q_21088854.html
bullet
 
bullet

Remove the "X" (smart-minimize) button from MFC apps:

bullet
add WS_NONAVDONEBUTTON to the window style
bullet
see:  http://www.pocketpcdn.com/articles/remove_x_button.html