Date: 02-16-2022
Return to Index
created by gbSnippets
'An online tutorial on templates can be found at:
'http://www.garybeene.com/power/pb-tutor-templates.htm
'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:
1
.bas
Simple: Dialog + Selected Messages
#Compile EXE
#Dim All
%Unicode=1
#Include "win32api.inc"
Function PBMain () As Long
Local hDlg As Dword
Dialog New Pixels, 0, "Test",300,300,200,200, %WS_OverlappedWindow To hDlg
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case CB.Msg
'life-cycle
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)
'control notifications
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
'resize
Case %WM_Size 'after its size has changed.
Case %WM_GETMINMAXINFO 'size/position of window is about to change
'mouse click
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
'mouse movement
Case %WM_SETCURSOR 'sent if mouse causes cursor to move
Case %WM_MouseMove 'when cursor moves
'keyboard
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
'application status
Case %WM_ActivateApp 'focus returns to app from another app
Case %WM_Activate 'sent to both the window being activated and the window
'being deactivated.
'graphic/drawing events
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.
'recurring events
Case %WM_Timer 'when a timer expires
'menu activity
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
'user action
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
End Select
End Function
'gbs_00256
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm