Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
Global hDlg,hDlgB As Dword, dRC,cRC As Rect
Function PBMain() As Long
Dialog New Pixels, 0, "Parent",300,300,200,200, %WS_OverlappedWindow To hDlg
Dialog Set Color hDlg, %Black, %White
Control Add Button, hDlg, 500, "Show Child", 10,10,75,25
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local x,y As Long
Select Case Cb.Msg
Case %WM_Command
If Cb.Ctl = 500 And Cb.CtlMsg = %BN_Clicked Then
Dialog Get Loc hDlg To x,y
Dialog New Pixels, 0, "Child",x+30,y+30,125,100, %WS_OverlappedWindow To hDlgB
Dialog Show Modeless hDlgB Call DlgBProc
Control Kill hDlg, 500
End If
Case %WM_Size, %WM_Move
GetWindowRect(hDlg,dRC) 'will use later
dRC.nTop = dRC.nTop + Metrics(Caption) 'so that dRC.nTop has client area
End Select
End Function
CallBack Function DlgBProc() As Long
Local pRC As Rect Ptr, commonRC As Rect, iResult As Long
Static cRCold As Rect
Select Case Cb.Msg
Case %WM_SysCommand
If (Cb.WParam And &HFFF0) = %SC_Minimize Then ? "run minimize routine" : Function = %True
If (Cb.WParam And &HFFF0) = %SC_Maximize Then ? "run maximize routine" : Function = %True
Case %WM_Moving, %WM_Sizing
pRC = Cb.LParam : cRC = @pRC
iResult = IntersectRect(commonRC, dRC, cRC) '0 if not intersect
If EqualRect(commonRC,cRC) Then '0 if not same
cRCold = cRC
Else
@pRC = cRCold
Function = %True
End If
End Select
End Function
'gbs_00752
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm