Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
Global hDlg,hChild As Dword, MinX As Long
Function PBMain() As Long
Dialog New Pixels, 0, "",400,200,200,100,%WS_ThickFrame Or %WS_Popup To hDlg 'no caption, allow resizig
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local Style,w,h,ww,hh As Long, pt As Point, MM As MinMaxInfo Ptr
Select Case Cb.Msg
Case %WM_GETMINMAXINFO
MM=Cb.LParam
@MM.ptMinTrackSize.x = MinX
@MM.ptMinTrackSize.y = 30
Case %WM_InitDialog
Style = %WS_Overlapped Or %WS_Caption Or %WS_SysMenu Or %WS_MinimizeBox Or %WS_MaximizeBox
Dialog New Pixels, hDlg, "Upside Down Dialog",0,0,0,0, Style To hChild
Dialog Show Modeless hChild Call ChildProc
Case %WM_Size
Dialog Get Size hDlg To w,h
If w < MinX Then Dialog Set Size hDlg, MinX,h
Dialog Get Size hChild To ww,hh
Dialog Set Size hChild,w-4,hh
Dialog Set Loc hChild,-1,h-32
End Select
End Function
CallBack Function ChildProc() As Long
Local x,y,w,h As Long, ptm,ptc,pt As Point, MM As MINMAXINFO Ptr
Select Case Cb.Msg
Case %WM_GETMINMAXINFO
MM=Cb.LParam
MinX = @MM.ptMinTrackSize.x + 3
Case %WM_Move
Dialog Get Size hDlg To w,h
pt.x = Lo(Word,Cb.LParam)
pt.y = Hi(Word,Cb.LParam)
Dialog Set Loc hDlg, pt.x-5, pt.y - h + 7
Case %WM_NCActivate
If IsFalse(Cb.WParam) Then Function = 1
Case %WM_Destroy
Dialog End hDlg
End Select
End Function
'gbs_00761
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm