Posted: Thu Jul 23, 2009 12:44 am
I'm using a beta version of the OS so I wouldn't worry about it if it's working everywhere else. It's not the first time it's let me down 

http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
Procedure WinCallback(hwnd, msg, wParam, lParam)
result = #PB_ProcessPureBasicEvents
Select msg
Case #WM_NCDESTROY
RemoveProp_(hwnd, "minimize")
;... Allow Minimizing from Window Caption
Case #WM_SYSCOMMAND
If wParam = #SC_MINIMIZE
SetProp_(hwnd, "minimize", 1)
result = 0
EndIf
Case #WM_SIZE , #WM_WINDOWPOSCHANGING
min = GetProp_(hwnd, "minimize")
;... Prevnt minimizing with show desktop
If wParam = #SIZE_MINIMIZED And min = 0
ShowWindow_(hwnd, #SW_RESTORE)
SetWindowPos_(hwnd, #HWND_TOPMOST, 0, 0, 0, 0, #SWP_NOSIZE | #SWP_SHOWWINDOW )
EndIf
SetProp_(hwnd, "minimize", 0)
EndSelect
ProcedureReturn result
EndProcedure
OpenWindow(0, 0, 0, 320, 240, "", #PB_Window_SystemMenu | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget )
SetProp_(WindowID(0), "minimize", 0)
SetWindowCallback(@WinCallback())
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
Code: Select all
Procedure WinCallback(hwnd, msg, wParam, lParam)
Global xpos = WindowX(0)
Global ypos= WindowY(0)
result = #PB_ProcessPureBasicEvents
Select msg
Case #WM_NCDESTROY
RemoveProp_(hwnd, "minimize")
;... Allow Minimizing from Window Caption
Case #WM_SIZE
min = GetProp_(hwnd, "minimize")
;... Prevnt minimizing with show desktop
If wParam = #SIZE_MINIMIZED And min = 0
ShowWindow_(hwnd, #SW_RESTORE)
SetWindowPos_(hwnd, #HWND_TOPMOST,xpos,ypos, 0, 0, #SWP_NOSIZE | #SWP_SHOWWINDOW)
EndIf
SetProp_(hwnd, "minimize", 0)
EndSelect
ProcedureReturn result
EndProcedure
OpenWindow(0, 0, 0, 320, 240, "", #PB_Window_ScreenCentered|#PB_Window_SystemMenu | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget)
SetProp_(WindowID(0), "minimize", 0)
SetWindowCallback(@WinCallback())
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
Code: Select all
Procedure WinCallback(hwnd, msg, wParam, lParam)
Global xpos = WindowX(0)
Global ypos= WindowY(0)
result = #PB_ProcessPureBasicEvents
Select msg
Case #WM_NCDESTROY
RemoveProp_(hwnd, "minimize")
;... Allow Minimizing from Window Caption
Case #WM_SIZE,#WM_SYSCOMMAND
If wParam = #SC_MINIMIZE
SetProp_(hwnd, "minimize", 1)
result = 0
Else
min = GetProp_(hwnd, "minimize")
;... Prevnt minimizing with show desktop
;If wParam = #SIZE_MINIMIZED And min = 0
ShowWindow_(hwnd, #SW_RESTORE)
SetWindowPos_(hwnd, #HWND_TOPMOST,xpos,ypos, 0, 0, #SWP_NOSIZE | #SWP_SHOWWINDOW)
EndIf
SetProp_(hwnd, "minimize", 0)
EndSelect
ProcedureReturn result
EndProcedure
OpenWindow(0, 0, 0, 320, 240, "", #PB_Window_ScreenCentered|#PB_Window_SystemMenu | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget)
StickyWindow(0,1)
SetProp_(WindowID(0), "minimize", 0)
SetWindowCallback(@WinCallback())
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
Hi RASHAD,RASHAD wrote:Code: Select all
Global hwnd,count Procedure Restoresize(count) Delay(count) If GetWindowLong_(hwnd, #GWL_STYLE) & #WS_MINIMIZE ShowWindow_(hwnd, #SW_RESTORE ) EndIf Goto again EndProcedure count=2000 hwnd = OpenWindow(0, 0, 0, 400, 250, "Anti Minimize", #PB_Window_ScreenCentered| #PB_Window_SizeGadget | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget) again: Thread = CreateThread(@Restoresize(), count) Repeat EventID.l = WaitWindowEvent() If EventID = #PB_Event_CloseWindow Quit = 1 EndIf Until Quit = 1 End
Code: Select all
Procedure Restoresize(count)
Repeat
Delay(count)
If GetWindowLong_(hwnd, #GWL_STYLE) & #WS_MINIMIZE
ShowWindow_(hwnd, #SW_RESTORE )
EndIf
ForEver
EndProcedure
Code: Select all
Procedure Restoresize(count)
Repeat
If GetWindowLong_(hwnd, #GWL_STYLE) & #WS_MINIMIZE
Delay(count)
ShowWindow_(hwnd, #SW_RESTORE )
EndIf
ForEver
EndProcedure