Hi!
With certain Windows, HWND of the window and HWND of the frame+caption are different in Windows system, and thus sys( 1270 ) would not return correct value.
You can check if form was resized though. This would not help when user just clicks on the resizing area, but 1-2 pixels outside of the form, though it will be a rare case, and solutionbelow would help in case form is resized.
1. Remember original width and height of the form in some variables or properties.
2. Whe you check if formshould be closed, check also if form is resized. If yes - just do not close.
3. Update stored values of original form width and height in the Resized event of the form.
HTH.
>>Hi!
>>
>>Nice solution, indeed! You do not need though to compare HWND property - VFP compares objects very well. So, you can just use "loUnderPointer = thisform" to check if it is the same form :-)
>
>Thanks, Vlad. Your additional tip is an eye-opener! However, while my original code seemed to work fine on one machine yesterday, it fails today on another machine! I claimed that hWnd gives a reference to the whole form including the borders. But that's not replicated here today. So, when I resize, then the form will release if I enlarge the form. Do you (and others) have that same result?
>
>
>PUBLIC oform1
>oform1=NEWOBJECT("form1")
>oform1.Show
>RETURN
>
>DEFINE CLASS form1 AS form
> DoCreate = .T.
> AutoCenter = .T.
> Caption = "Form1"
> Name = "Form1"
> lMouseOnForm = .F.
>
> ADD OBJECT timer1 AS timer WITH ;
> Interval = 10, ;
> Name = "Timer1"
>
> PROCEDURE timer1.Timer
> local loUnderPointer
> with thisform
> do case
> case mdown()
> *
> if not .lMouseOnForm
> *
> if mrow() < 0 or mcol() < 0
> *
> loUnderPointer = sys( 1270 )
> *
> .lMouseOnForm = type( 'loUnderPointer' ) = 'O' and loUnderPointer.hWnd = .hWnd
> *
> if not .lMouseOnForm
> .release
> endif
> endif
> endif
>
> case .lMouseOnForm
> *
> .lMouseOnForm = .f.
> endcase
> endwith
> ENDPROC
>
>ENDDEFINE
>
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.