| |
|
|
Georg Teles | so can the Fenstergröße to Belieben limit - The Message to that Change the position / Size the Fensters becomes aufgefangen, changed & on the window versendet
'###############################################
'# #
'# Fenstergröße limit through MINMAXINFO #
'# #
'# Georg Teles on the 27.12.2018 #
'# #
'###############################################
$H structs.ph
$H windows.ph
$H messages.ph
Declare OldWndProc&, ico&, e%
'-------------# Definitionen
Def GetWindowLong(2)!"USER32","GetWindowLongA"
Def SetWindowLong(3)!"USER32","SetWindowLongA"
Def CallWindowProc(5)!"USER32","CallWindowProcA"
Def RtlMoveMemory(3)!"KERNEL32","RtlMoveMemory"
'-------------# Structures
'reserved, no usage
Struct ptReserved = ptReservedX&, ptReservedY&
'maximum wide (x) & Höhe (y) at Maximierten Window
Struct ptMaxSize = ptMaxSizeX&, ptMaxSizeY&
'position left (x) & supra (y) at Maximierten Window
Struct ptMaxPosition = ptMaxPositionX&, ptMaxPositionY&
'smallest wide (x) & Höhe (y) at enhance/Verkleindern the Fensters
Struct ptMinTrackSize = ptMinTrackSizeX&, ptMinTrackSizeY&
'most wide (x) & Höhe (y) at enhance/Verkleindern the Fensters
Struct ptMaxTrackSize = ptMaxTrackSizeX&, ptMaxTrackSizeY&
'MINMAXINFO structure
Struct MinMax = ptReserved, ptMaxSize, ptMaxPosition, ptMinTrackSize, ptMaxTrackSize
'Variable for MINMAXINFO
Declare MMI#
Dim MMI#, MinMax
'-------------# CallBack routine
Proc WindowProc
Parameters hWnd&, Message&, wParam&, lParam&
' alternatively in the Loop regulate
'If Message& = ~WM_KEYFIRST ' TASTEN auswertung
'Case WParam& = 27:~PostQuitMessage(0) 'zB %Key = 27 for ESC
'Endif
If Message& = ~WM_GETMINMAXINFO' Message snatch
' Pointer lParam snatch and MMI fill
RtlMoveMemory(MMI#, lParam&, SizeOf(MMI#))
' values to Belieben adjust
'-------------# alternative 1
With MMI#
.ptMinTrackSizeX& = 355
.ptMinTrackSizeY& = 282
.ptMaxTrackSizex& = 500
.ptMaxTrackSizey& = 500
Endwith
'-------------# alternative 2
'MMI#.ptMinTrackSizeX& = 355
'MMI#.ptMinTrackSizeY& = 282
'MMI#.ptMaxTrackSizex& = 500
'MMI#.ptMaxTrackSizey& = 500
' MMI the lParam Pointer again allocate
RtlMoveMemory(lParam&, MMI#, SizeOf(MMI#))
EndIf
' alternatively in the Loop regulate
'If Message& = ~wm_Destroy
' ~PostQuitMessage(0)
'Endif
Return CallWindowProc(OldWndProc&, hWnd&, Message&, wParam&, lParam&)
ENDPROC
'-------------# Program
Set("FastMode",1)
Set("TrueColor",1)
Windowtitle "Fenstergröße Begrenzen"
Window 100,100 - 355,282
ico& = Create("hIcon",Par$(0),0)' Icon erwünscht ?
SendMessage(%HWnd,$80,1,ico&)' Icon settle
SetWindowLong(%HWnd,-16,$92CE0000)' suitable Style dial
OldWndProc& = GetWindowLong(%hWnd, -4)' original WndProc Save
SetWindowLong(%hWnd, -4, ProcAddr("WindowProc",4))' WindowProc allocate
WhileNot e%
Waitinput
If %Key = 27
Inc e%
ElseIf %Key = 2
Inc e%
EndIf
EndWhile
SetWindowLong(%hWnd, -4, OldWndProc&)' original WndProc restore
DeleteObject ico&
DisPose MMI#
Regards Georg |
|
|
| |
|
|