Joined: 01 Jul 2005
|Posted: Oct 10th, 2007, 9:15am Post subject: Re: minimizing to icon
|Does the following demo help? You would use the OnSize function in place of the NL demo's button click event handler.
Notice that the window still minimizes. So, before you re-show the window, you'll need to restore it. There are other messages you could trap to prevent minimization, but I think it would be easier to do it this way.
| Open "wmliberty" For DLL As #wmlib
Open "Trapping Minimize Demo" For Window As #demo
#demo "TrapClose demo.Close"
Callback lpfnCB, OnSize( ULong, ULong, ULong, ULong ), Long
r = SetWMHandler(HWnd(#demo), _WM_SIZE, lpfnCB, 0)
Function OnSize( hWnd, uMsg, wParam, lParam )
OnSize = 1
If wParam = _SIZE_MINIMIZED Then
Sub demo.Close wnd$
CallDLL #kernel32, "Sleep", _
100 As Long, r As Void
Function SetWMHandler( hWnd, uMsg, lpfnCB, lSuccess )
CallDLL #wmlib, "SetWMHandler", _
hWnd As ULong, uMsg As ULong, _
lpfnCB As ULong, lSuccess As Long, _
SetWMHandler As Long