[lazarus] wndproc

Markku Niskanen markku.niskanen at laatumikro.fi
Mon Aug 16 23:11:09 EDT 1999


On Mon, 16 Aug 1999 18:21:19 -0700 (PDT), you wrote:

>I don't remember enough about what all WndProc does, but we should to be careful
>here because from what I remember (and have gained from the discussion), I think
>the WndProc procedure handles API specific messages that are passed to the

	Ever since the very beginning of the Windows SDK there have
	been two functions that every piece of Windows software has 
	had:

	1.	Winmain()

	This one creates the window, makes some initialization
	stuff, for instance and then enters the message loop:

     	while (GetMessage (&msg, NULL, 0, 0)) {
	         TranslateMessage (&msg) ;
	         DispatchMessage (&msg) ;
	  }	

	2)	WndProc

	This one processes the windows messages:

	long    FAR PASCAL WndProc (hWnd, iMessage, wParam, lParam)

	HWND     hWnd ;
	UINT iMessage ;
	WPARAM   wParam ;
	LPARAM   lParam ;
	{
	/* variable stuff etc */
	switch (iMessage) {
        	case WM_DESTROY:
                /* Clean up and quit */
                KillTimer(hWnd,1);
                PostQuitMessage(0); /* Quit */
                break ;
        	case WM_CREATE:
                /* some stuff from an old app...*/
                pLogPal = (NPLOGPALETTE) LocalAlloc( LMEM_FIXED,
                                            (sizeof(LOGPALETTE) 
			+ (sizeof(PALETTEENTRY)*(MAXP
                if (achFileName[0] && !InitDIB(hWnd))
                        PostQuitMessage (3) ;

	/* lots of case XX_XXX lines, including
	  mouse and keyboard messages etc,
	  API related stuff, anyhow*/

	}

-- 
markku.niskanen at laatumikro.fi






More information about the Lazarus mailing list