Date: 02-16-2022
Return to Index
'Compilable Example: (Jose Includes)
created by gbSnippets
#Compile Exe
#Dim All
%Unicode = 1
#Include "Win32API.inc"
%IDC_Button = 500
%IDC_Label = 501
Global hDlg,hTop As Dword, SelectOn, wDeskTop, hDeskTop As Long
Function PBMain() As Long
Dialog New Pixels, 0, "PowerBASIC",300,300,200,200, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, %IDC_Button,"Push", 20,10,100,20
Control Add Label, hDlg, %IDC_Label,"... Points ...", 20,50,150,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case Cb.Msg
Case %WM_Command
Select Case Cb.Ctl
Case %IDC_Button
SelectOn = 1
Desktop Get Size To wDeskTop, hDeskTop
Dialog New Pixels, 0, "", 0,0,wDeskTop,hDeskTop, %WS_Popup, %WS_Ex_Layered To hTop
Dialog Show Modal hTop, Call DlgProcTop
End Select
End Select
End Function
CallBack Function DlgProcTop() As Long
Static ptA, ptB As Point
Select Case Cb.Msg
Case %WM_InitDialog
SetLayeredWindowAttributes(hTop, 0, 40, %LWA_ALPHA)
Case %WM_ContextMenu
Dialog End hTop
Case %WM_LButtonUp
Incr SelectOn
If SelectOn = 2 Then Beep: GetCursorPos ptA : Control Set Text hDlg, %IDC_Label, Str$(ptA.x) + "," + Str$(ptA.y)
If SelectOn = 3 Then
Beep
GetCursorPos ptB : Control Set Text hDlg, %IDC_Label, Str$(ptA.x) + "," + Str$(ptA.y) + "," + Str$(ptB.x) + "," + Str$(ptB.y)
SelectOn = 0
Dialog End hTop
End If
End Select
End Function
http://www.garybeene.com/sw/gbsnippets.htm