MainWndProc

As its name implies, the MainWndProc function handles messages sent to the program's parent (main) window. These messages signal that the user has made a menu selection, resized the window, or changed the pen system through Control Panel. These actions generate, respectively, the following messages:

  • WM_COMMAND message. If the user selects a command from the Options menu, the program notes the selection in the global flag viMenuSel. The state of this flag determines whether subsequent input goes to the system recognizer or the sample recognizer SREC, or is collected into an HPENDATA object for conversion to a mirror image.

  • WM_SIZE message. PENAPP resizes its windows according to the information in the lParam variable.

  • WM_PENMISCINFO message. The procedure allows this message to fall through to DefWindowProc for default handling.

LRESULT CALLBACK MainWndProc(

HWND hwnd, // Window handle

UINT message, // Message

WPARAM wParam, // Varies

LPARAM lParam ) // Varies

{

LONG lRet = 0L;

.

.

.

switch (message)

{

case WM_COMMAND:

switch (wParam)

{

case miExit:

DestroyWindow( vhwndMain );

break;

case miSample:

case miSystem:

case miMirror:

ResetWindow( wParam );

break;

}

break;

.

.

.

case WM_DESTROY:

if (vhpendata)

{

// PKPD.DLL API: function pointer not needed:

DestroyPenData( vhpendata );

  • hpendata = NULL;

}

//

// Unload sample recognizer. (Don't

// unload system default recognizer.)

//

UninstallRecognizer( vhrec );

  • hrec = NULL;

PostQuitMessage( 0 );

break;

default:

lRet = DefWindowProc( hwnd, message, wParam, lParam );

break;

}

return lRet;

}

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database