Code:
'PBWIN 9.00 - WinApi 05/2008 - XP Pro SP3 #Dim All #Compile Exe #Include "WIN32API.INC" ' Global hdlg As Dword %Id_Label_01 = 100 %Id_Demonstrate = 101 %Id_Quit = 102 ' Macro Common_Locals 'Macro easier than retyping and maintains coding consistency Local ctr, ctr1, ctr2, ctr3 As Long Local s As String Local Row&, col& End Macro ' Sub Variable_Demo common_locals Randomize Timer For ctr = 1 To 10 ctr1 = Rnd(1, 1000000) ctr2 = Rnd(1, 1000000) ctr3 = Rnd(1, 1000000) s$ = Using$("#, Look at me changing up here too ", ctr3) Sleep 100 Show_Variables (ctr, ctr1, ctr2, s$) Next ctr End Sub ' Function Show_Variables (Var1&, var2&, var3&, var$) As Long common_locals s$ = Using$(" Var1 = #, ", var1&) & $CrLf & _ Using$(" Var2 = #, ", var2&) & $CrLf & _ Using$(" Var3 = #, ", var3&) Control Set Text hdlg, %Id_Label_01, s$ Dialog Set Text hdlg, var$ End Function ' CallBack Function Dialog_Processor common_Locals Static ctr4 As Long Select Case CbMsg 'This is TO determine the message TYPE ' Case %WM_INITDIALOG'<- Initialiaton when the program loads ' Case %WM_SYSCOMMAND 'Traps Any Alt key but only F4 closes ' Case %WM_COMMAND 'This processes command messages Select Case CbCtl Case %Id_Demonstrate Select Case CbCtlMsg Case %bn_clicked Call Variable_Demo Incr ctr4 Control Set Text CbHndl, CbCtl, Using$("Demonstration #?", ctr4 + 1) End Select ' Case %Id_Quit Select Case CbCtlMsg Case %bn_clicked ? "I've had enough",,"Quitting" Dialog End CbHndl End Select End Select End Select End Function ' Function PBMain Common_locals 'set them up Dialog New Pixels, hdlg, "Dynamically Display Variables Demonstration", , , 400, 400, %WS_SYSMENU To hdlg s$ = "Showing Dynamic Variables" & $CrLf & _ "Using a Label " & $CrLf & _ "and the" & $CrLf & _ "Dialog Caption" Col = 20 Row = 10 Control Add Label, hdlg, -1, s$, Col, Row, 300, 50, %SS_center Row = 12 * 10 ' lines down Control Add Label, hdlg, %Id_Label_01, s$, Col, Row, 300, 150, %SS_center Row = Row + 150 + 25 Control Add Button, hdlg, %Id_Demonstrate, "Demonstrate", col, Row, 300, 25 Row = Row + 50 Control Add Button, hdlg, %Id_Quit, "Quit for Pete's sake, I get it!", col, Row, 300, 25 Dialog Show Modal hDlg Call Dialog_Processor End Function '
The germ of destruction of our nation
is in the power of the judiciary,
an irresponsible body
working like gravity by night and by day,
gaining a little today and a little tomorrow,
advancing its noiseless step like a thief
over the field of jurisdiction
until all shall render powerless
the checks of one branch over the other
and will become as venal and oppressive
as the government from which we separated."
Thomas Jefferson, 1821
============================================================