Problem using SetWindowPos on modal form (VB5) 
Author Message
 Problem using SetWindowPos on modal form (VB5)

I'm trying to use SetWindowPos to display a form topmost in my VB5
application. The code generally works OK, but sometimes (when the current
form is modal, I think), the call to SetWindowPos causes the form which it's
trying to display to 'flicker' continuously until I get an 'out of stack
space' message. The API call looks like this :

i% = SetWindowPos(MyForm.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW +
SWP_NOMOVE + SWP_NOSIZE)

(For what it's worth, this code works OK in VB3 !)
Has anyone previously encountered this problem ?

Thanks in advance,

Phil Jennings
---------------------------------------------------------------------------
Phil Jennings
www.philjennings.com



Sat, 13 Oct 2001 03:00:00 GMT  
 Problem using SetWindowPos on modal form (VB5)
Without seeing all your code I have to assume your doing something in an
event that keeps invoking it's self.  The best advice I can give is to check
for code in your Form_Activate, Form_Load, Form_Paint or Form_Resize events
that may be invoking it self.


Sat, 13 Oct 2001 03:00:00 GMT  
 Problem using SetWindowPos on modal form (VB5)
I had the same thought about an event that keeps invoking itself, but I
haven't found a candidate yet. Why would it be OK in VB3 and OK on top of
non-modal forms in VB5 ?

Also, I put tracing code in the Form_Activate, Form_Load, Form_Paint and
Form_Resize events, and this never gets called (Load, Paint and Resize
events didn't have any code in them other than the tracing code). When I
step through the code with the de{*filter*}, when I hit F8 on the SetWindowPos
call, it never reaches another statement, either in that Sub or any other,
so my thinking is that the problem is occurring at a lower level than my VB
code.

Any further thoughts ?

Thanks,

Phil Jennings
---------------------------------------------------------------------------
Phil Jennings
www.philjennings.com



Quote:
> Without seeing all your code I have to assume your doing something in an
> event that keeps invoking it's self.  The best advice I can give is to
check
> for code in your Form_Activate, Form_Load, Form_Paint or Form_Resize
events
> that may be invoking it self.



Sun, 14 Oct 2001 03:00:00 GMT  
 Problem using SetWindowPos on modal form (VB5)
Run-time error 401 will give you the answer: "Can't show non-modal form when
modal form is displayed".

SetWindowPos does not show the form modally.

--
Eduardo Morcillo
Free ActiveX Controls: http://www.*-*-*.com/

Quote:
> I had the same thought about an event that keeps invoking itself, but I
> haven't found a candidate yet. Why would it be OK in VB3 and OK on top of
> non-modal forms in VB5 ?

> Also, I put tracing code in the Form_Activate, Form_Load, Form_Paint and
> Form_Resize events, and this never gets called (Load, Paint and Resize
> events didn't have any code in them other than the tracing code). When I
> step through the code with the de{*filter*}, when I hit F8 on the SetWindowPos
> call, it never reaches another statement, either in that Sub or any other,
> so my thinking is that the problem is occurring at a lower level than my
VB
> code.

> Any further thoughts ?

> Thanks,

> Phil Jennings
> --------------------------------------------------------------------------
-
> Phil Jennings
> www.philjennings.com



> > Without seeing all your code I have to assume your doing something in an
> > event that keeps invoking it's self.  The best advice I can give is to
> check
> > for code in your Form_Activate, Form_Load, Form_Paint or Form_Resize
> events
> > that may be invoking it self.



Mon, 15 Oct 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Problem using SetWindowPos on modal form (VB5)

2. Problem with draw order after calling modal a modal from from a modal form

3. Modal Form with Modal form using Control?

4. SetWindowPos-Call not possible from modal-form (VB4)???????

5. SetWindowPos-call not possible on a modal-form

6. Modal form & SetWindowPos bug

7. MODAL FORM & NON MODAL FORM

8. Unloading modal owner form also unloads modal form?

9. MODAL FORM & NON MODAL FORM

10. Modal Form can't open another Modal Form

11. MODAL FORM & NON MODAL FORM

12. non-modal form when a modal form is displayed

 

 
Powered by phpBB® Forum Software