.Example Snippet

Category: PowerBASIC Snippets

Date: 07-21-2011

Return to Index


 
'The snippets supplied with gbSnippets generally consist of 3 sections:
 
'- Introductory text/reference material
 
'- Primary code section which lists and discusses the key code that
'  makes the snippet perform its primary task
 
'- Compilable Example which can be opened in the PowerBASIC IDE (F4)
'  or in the PowerBASIC compiler (F5)
 
'However, you can put pretty much put whatever you want into each
'snippet. The only real requirement is that to use the options
'to put a snippet into the PowerBASIC IDE or to compile the snippet
'you must put the executable code below the following line, as 
'shown in this example.
 
'Compilable Example:
'This simple example minimizes when you press the button.
#Compile Exe
#Dim All
#Include "Win32API.inc"
Global hDlg as DWord
Function PBMain() As Long
   Dialog New Pixels,0,"Test",300,300,200,200,%WS_OverlappedWindow To hDlg
   Control Add Button, hDlg, 100,"Push", 50,10,100,20
   Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
   If CB.Msg = %WM_Command AND CB.Ctl = 100 Then
      ShowWindow hDlg, %SW_Minimize
   End If
End Function
   
'gbs_00002   unique number assigned to each snippet


created by gbSnippets
http://www.garybeene.com/sw/gbsnippets.htm