Code: Select all
SendMessage_(HWND0,#WM_SHOWWINDOW, #SIZE_MINIMIZED, 0)
PostMessage_(HWND0,#WM_SHOWWINDOW, #SIZE_MINIMIZED, 0)
Code: Select all
SendMessage_(HWND0,#WM_SHOWWINDOW, #SIZE_MINIMIZED, 0)
PostMessage_(HWND0,#WM_SHOWWINDOW, #SIZE_MINIMIZED, 0)
Yes as I commented above, that is the exact command I was using. Just now I changed that to this and seems to be more stable:

Code: Select all
ShowWindow_(WindowID(?),#SW_RESTORE )
InvalidateRect_(WindowID(?),0,1)
OR
ShowWindow_(WindowID(?),#SW_RESTORE )
UpdateWindow_(WindowID(?))
OR
SendMessage_(WindowID(?),#WM_SYSCOMMAND,#SC_RESTORE,1)
PostMessage_(GadgetID(0), #WM_LBUTTONDOWN, 0, 0)
PostMessage_(GadgetID(0), #WM_LBUTTONUP, 0, 0)

I'm not using any code to restore the window. I'm just clicking the icon in the taskbar to do restore. Or using relaunch which tells the current process to restore and take foreground and then the new process terminates. I also tried catching the WM_RESTORE so I could tell it to InvalidateRect_ the window but had no affect.RASHAD wrote: Wed Oct 29, 2025 7:03 am TryCode: Select all
ShowWindow_(WindowID(?),#SW_RESTORE ) InvalidateRect_(WindowID(?),0,1) OR ShowWindow_(WindowID(?),#SW_RESTORE ) UpdateWindow_(WindowID(?)) OR SendMessage_(WindowID(?),#WM_SYSCOMMAND,#SC_RESTORE,1) PostMessage_(GadgetID(0), #WM_LBUTTONDOWN, 0, 0) PostMessage_(GadgetID(0), #WM_LBUTTONUP, 0, 0)
Code: Select all
Case #WM_SYSCOMMAND
Select wParam
Case #SC_RESTORE
PostMessage_(WindowID(?), #WM_LBUTTONDOWN, 0, 0)
PostMessage_(WindowID(?), #WM_LBUTTONUP, 0, 0)
EndSelect
Code: Select all
Case #WM_SYSCOMMAND
Select wParam
Case #SC_RESTORE
PostMessage_(GadgetID(?), #WM_LBUTTONDOWN, 0, 0)
PostMessage_(GadgetID(?), #WM_LBUTTONUP, 0, 0)
EndSelect
RightBarryG wrote: Wed Oct 29, 2025 8:47 am Why are you using API calls instead of the SetWindowState() command?
And try to post a standalone snippet of code that shows the problem.

Such a good question! Primarily because I didn't know that was an available option.BarryG wrote: Wed Oct 29, 2025 8:47 am Why are you using API calls instead of the SetWindowState() command?

Not using Canvas Container but I did follow the above suggestion, Now just have to wait to see if any improvement. (Problem being intermittent as it is.) I also substituted code suggested by BarryG to replace the minimize API.RASHAD wrote: Wed Oct 29, 2025 8:15 am If you are using SetWindowCallback(@ProcedureName() [, #Window [, Mode]])
Add the nextCode: Select all
Case #WM_SYSCOMMAND Select wParam Case #SC_RESTORE PostMessage_(WindowID(?), #WM_LBUTTONDOWN, 0, 0) PostMessage_(WindowID(?), #WM_LBUTTONUP, 0, 0) EndSelect


Code: Select all
Procedure MinimizeWin0()
GetWindowRect_(TOPwh,rw)
wpx = rw\right -100
wpy = rw\top+15
SetCursorPos_(wpx,wpy) ;mouse nicely positioned over the _ minimize button in the titlebar.
mouse_event_(#MOUSEEVENTF_LEFTDOWN,0,0,0,0)
mouse_event_(#MOUSEEVENTF_LEFTUP,0,0,0,0)
EndProcedure
