#Include "windows.bi" Dim As HWND Window_Main, Static_Text, Button_Click Dim As MSG msg Dim As Integer Num_Click Dim As String Text 'Create a window with a static text control and a button: Window_Main = CreateWindow("#32770", "Simple Windowed Application", WS_OVERLAPPEDWINDOW Or WS_VISIBLE, 100, 100, 350, 200, 0, 0, 0, 0) Static_Text = CreateWindow("STATIC", "There have been no clicks yet", WS_VISIBLE Or WS_CHILD Or WS_BORDER, 10, 30, 300, 20, Window_Main, 0, 0, 0) Button_Click = CreateWindow("BUTTON", "Click me", WS_VISIBLE Or WS_CHILD, 100, 70, 100, 20, Window_Main, 0, 0, 0) 'Windows message loop: Num_Click = 0 While GetMessage(@msg, Window_Main, 0, 0) TranslateMessage(@msg) DispatchMessage(@msg) Select Case msg.hwnd Case Button_Click If msg.message = WM_LBUTTONDOWN Then Num_Click = Num_Click + 1 If Num_Click = 1 Then Text = "Button has been clicked once" Else Text = "Button has been clicked " + Str(Num_Click) + " times" End If SetWindowText(Static_Text, Text) End If Case Window_Main If msg.message = WM_COMMAND Then End End Select Wend End