Return to Index
created by gbSnippets
'An online tutorial on templates can be found at:
'Use this template by copying everything below "'Copy below here:"
'and put in a file with a ".pbtpl" extension under pbwin90\bin.
'When PB IDE starts, the template will be available under the
'toolbar "Create New File" dropdown menu.
'Copy below here:
Standard: Dialog + Selected Messages
#Debug Error On 'catch array/pointer errors - OFF in production
#Debug Display On 'display untrapped errors - OFF in production
#Tools Off 'use ON only when needed for Trace/Profile/CallStk
'use these inside procedures:
'#Debug Print "msg" 'on as-needed basis only
'#Debug Code ON 'ignored in production, use OFF for speed in development testing
Function PBMain () As Long
Local hDlg As Dword
Sub MakeDialog(hDlg As Dword)
Dialog New Pixels, 0, "Test",300,300,200,200, %WS_OverlappedWindow To hDlg
'... test code goes here
Dialog Show Modal hDlg Call DlgProc
Sub CPrint (SOut As String) 'Semen Matusovski's CPrint code:
Static hConsole As Long, cWritten As Long
If hConsole = 0 Then AllocConsole: hConsole = GetStdHandle(-11&)
WriteConsole hConsole, ByCopy sOut + $CrLf, Len(sOut) + 2, cWritten, ByVal 0&
CallBack Function DlgProc() As Long
'Console message list
CPrint Str$(iMsgCount&)+ " " + WinMsg(CB.Msg)
Select Case CB.Msg
Case %WM_Create 'when an application requests that a window be created
'after window is created, but before it becomes visible
Case %WM_InitDialog 'immediately before a dialog box is displayed
'typically used to initialize controls and carry out any other
'initialization tasks that affect the appearance of the dialog box.
Case %WM_Destroy 'window is being destroyed
'after windows is removed from screen (children still exist)
Case %WM_Command 'user selects a command item from a menu
'control sends a notification message to its parent window
'accelerator keystroke is translated.
Case %WM_Notify 'by control to its parent window when an event has occurred
Case %WM_Size 'after its size has changed.
Case %WM_GETMINMAXINFO 'size/position of window is about to change
Case %WM_PARENTNOTIFY 'sent to parent when child window is create/destrory
'sent to parent when user clicks mouse button over child
Case %WM_SYSCOMMAND 'user choose command from Window menu, max/min/restore/close buttons
Case %WM_SETCURSOR 'sent if mouse causes cursor to move
Case %WM_MouseMove 'when cursor moves
Case %WM_Char 'to window with keyboard focus when WM_KEYDOWN message is translated
'by the TranslateMessage function. contains the character code of the
'key that was pressed.
Case %WM_GETDLGCODE 'intercept keyboard input to child control
Case %WM_Help 'F1 is pressed
Case %WM_ActivateApp 'focus returns to app from another app
Case %WM_Activate 'sent to both the window being activated and the window
Case %WM_ERASEBKGND 'sent when the window background must be erased (such as resizing)
Case %WM_Paint 'set when request is made to paint a portion of an application's window.
Case %WM_Timer 'when a timer expires
Case %WM_INITMENUPOPUP 'when pop-up menu is about to become active
Case %WM_CONTEXTMENU 'user clicked the right mouse button (right-clicked) in a window.
Case %WM_MENUSELECT 'sent when user selects a menu item
Case %WM_PASTE 'application sends a WM_PASTE message to an edit control or combobox
Case %WM_DROPFILES 'sent when user drops file on application that's is registered as file recipient
'The WM_CREATE message is sent when an application requests that a window
'be created by calling the CreateWindowEx or CreateWindow function. (The
'message is sent before the function returns.) The window procedure of the
'new window receives this message after the window is created, but before
'the window becomes visible.
'The WM_INITDIALOG message is sent to the dialog box procedure immediately
'before a dialog box is displayed. Dialog box procedures typically use this
'message to initialize controls and carry out any other initialization tasks
'that affect the appearance of the dialog box.
'The WM_DESTROY message is sent when a window is being destroyed. It is
'sent to the window procedure of the window being destroyed after the
'window is removed from the screen. This message is sent first to the
'window being destroyed and then to the child windows (if any) as they
'are destroyed. During the processing of the message, it can be assumed
'that all child windows still exist.
'The WM_COMMAND message is sent when the user selects a command item from
'a menu, when a control sends a notification message to its parent window,
'or when an accelerator keystroke is translated.
'WM_NOTIFY Sent by a common control to its parent window when an event has
'occurred or the control requires some information.
'The WM_SIZE message is sent to a window after its size has changed.
'The WM_GETMINMAXINFO message is sent to a window when the size or position of
'the window is about to change. An application can use this message to override
'the window's default maximized size and position, or its default minimum or
'maximum tracking size.
'The WM_PARENTNOTIFY message is sent to the parent of a child window when
'the child window is created or destroyed, or when the user clicks a mouse
'button while the cursor is over the child window. When the child window is
'being created, the system sends WM_PARENTNOTIFY just before the CreateWindow
'or CreateWindowEx function that creates the window returns. When the child
'window is being destroyed, the system sends the message before any processing
'to destroy the window takes place.
'WM_SYSCOMMAND. A window receives this message when the user chooses a
'command from the Window menu (formerly known as the system or control
'menu) or when the user chooses the maximize button, minimize button,
'restore button, or close button.
'The WM_SETCURSOR message is sent to a window if the mouse causes the cursor
'to move within a window and mouse input is not captured.
'The WM_MOUSEMOVE message is posted to a window when the cursor moves. If
'the mouse is not captured, the message is posted to the window that
'contains the cursor. Otherwise, the message is posted to the window
'that has captured the mouse.
'The WM_CHAR message is posted to the window with the keyboard focus when
'a WM_KEYDOWN message is translated by the TranslateMessage function. The
'WM_CHAR message contains the character code of the key that was pressed.
'The WM_GETDLGCODE message is sent to the window procedure associated with
'a control. By default, the system handles all keyboard input to the control;
'the system interprets certain types of keyboard input as dialog box navigation
'keys. To override this default behavior, the control can respond to the
'WM_GETDLGCODE message to indicate the types of input it wants to process itself.
'The WM_ACTIVATEAPP message is sent when a window belonging to a different
'application than the active window is about to be activated. The message is
'sent to the application whose window is being activated and to the application
'whose window is being deactivated.
'The WM_ACTIVATE message is sent to both the window being activated and the
'window being deactivated. If the windows use the same input queue, the message
'is sent synchronously, first to the window procedure of the top-level window
'being deactivated, then to the window procedure of the top-level window being
'activated. If the windows use different input queues, the message is sent
'asynchronously, so the window is activated immediately.
'The WM_NCACTIVATE message is sent to a window when its nonclient area needs to
'be changed to indicate an active or inactive state.
'The WM_SYSCOLORCHANGE message is sent to all top-level windows when a change is
'made to a system color setting.
'The WM_ERASEBKGND message is sent when the window background must be erased
'(for example, when a window is resized). The message is sent to prepare an
'invalidated portion of a window for painting.
'WM_PAINT. Sent by an application when Windows or another application makes a
'request to paint a portion of an application's window.
'The WM_TIMER message is posted to the installing thread's message queue when a timer expires.
'WM_INITMENUPOPUP. This message is sent when a pop-up menu is about to become
'active. This enables an application to modify the pop-up menu before it is
'displayed, without changing the entire menu.
'The WM_CONTEXTMENU message notifies a window that the user clicked the right
'mouse button (right-clicked) in the window.
'The WM_MENUSELECT message is sent to a menu's owner window when the user selects a menu item.
'WM_PASTE. An application sends a WM_PASTE message to an edit control or combo
'box to copy the current content of the clipboard to the edit control at the current
'caret position. Data is inserted only if the clipboard contains data in CF_TEXT format.
'WM_DRAGDROP. Sent when the user drops a file on the window of an application that has
'registered itself as a recipient of dropped files.
created by gbSnippets