Basic Dialog

Up
Basic Dialog
CEGetDev
CEGetSys
CEMandelBrot
CEPolyBezier
CEPolyDraw
DrawingLines
DrawingText
DrawSplines
EnumerateFonts
HelloWinCE
Minimal
MouseResolution
MultiScreen Dialog
Palette Animation
Palette Gradient
Palette Viewer
CommandBands
ShowingFontInfo
Tray Application
What OS Version

Home
Up

 

Name: BasicDialog

Download: BasicDialog.zip

What is it: A dialog based application.

Image57.gif (3217 bytes)

Features:

Allows the developer to quickly build an application which has a large number of controls. For example a calculator. All you need to do is layout the controls you wish to use, using the dialog resource editor. Then response to the messages in the BasicDialogProc.
Quick application UI prototyping

 

The Code:

The code maintains a global HWND to the dialog that is used as a form in the application.

HWND g_hwndBasicDialog; //The basic dialog for the controls

In the WM_CREATE message the commanbar height is retrieved and stored in a global variable. The 'IDD_BASICDIALOG' is then created as a child window of the MainWindow. If this creation is successful it is moved to fill the full Client space of the MainWindow. Following this it is shown and updated.

nCBrHeight = CommandBar_Height(g_hwndCB);
GetClientRect(hWnd, &rect);
g_hwndBasicDialog = CreateDialog(hInst, MAKEINTRESOURCE(IDD_BASICDIALOG), hWnd, (DLGPROC)BasicDlgProc);
if ( g_hwndBasicDialog )
{
MoveWindow(g_hwndBasicDialog, 0, nCBrHeight, rect.right-rect.left,rect.bottom - (rect.top + nCBrHeight), TRUE);
ShowWindow(g_hwndBasicDialog, SW_SHOW);
UpdateWindow(g_hwndBasicDialog);
}

 

When the 'IDD_BASICDIALOG' was created as a child window of the MainWindow it was given a WindowProc called BasicDlgProc. It is in this WndProc that all the Basic Dialog message processing is done..

//------------------------------------------------------
// BasicDlgProc
//------------------------------------------------------
LRESULT CALLBACK BasicDlgProc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp){ 
LRESULT lResult = TRUE;

switch(msg)
{
case WM_COMMAND:

default:
return(FALSE);
break;
}

  UNREFERENCED_PARAMETER(wp);
  UNREFERENCED_PARAMETER(lp);
return (lResult);
}

 

 Feedback mailto:ppcdev@conduits.com