This is the line that's causing the crash:
SetWindowPos(hDlg, HWND_TOP, 0, 0, (int) Rect.right, (int) Rect.bottom,
SWP_NOMOVE);
As an aside, shouldn't this function just fail and set an error code of
invalid parameter if that's the problem?
Thanks for any help...
Steve Quintana
Software Engineer
ICG Research Incorporated
Yes you are right. But it doesn't happen in your case. Since
you use DrWatson you know that you get a call stack long as
a mile, which can be very helpful in situations like this. You
could try adding an SEH block around your call to SetWindowsPos,
or create your own SEH handler, to see if you can catch any exception
generated by the call, and then grab the last available error code.
Btw, the NT Internals guys made a program that called the API
functions in a random manner with random values just to see how
good the API handled faulty values. I have not tried their
program my self but I trust their word when they say that
it crashes after some time.
> Thanks for any help...
Good luck
> Steve Quintana
> Software Engineer
> ICG Research Incorporated
Andreas
The only possibility I can think of is that your handle is not valid (hDlg).
Gary Burgess
Software Developer
Burgess Business Systems Pty Ltd
Steve Quintana wrote in message <34EC5A...@aracnet.net>...
>My call to SetWindowPos() is crashing (brings up Dr. Watson under NT
>4.0). Does anyone know what parameters could cause SetWindowPos() to
>just crash the process it is called from???
>
>This is the line that's causing the crash:
>
>SetWindowPos(hDlg, HWND_TOP, 0, 0, (int) Rect.right, (int) Rect.bottom,
>SWP_NOMOVE);
>
>
>As an aside, shouldn't this function just fail and set an error code of
>invalid parameter if that's the problem?
>
>
>Thanks for any help...
I had heard that for 4.0 MS moved some API functions lower into the OS
(others could provide a more technical explanation), for speed purposes
(sacrificing robustness).
Den
--
Dennis M. Swanson <>< C/Win32 API programmer UNIX hobbyist
Charity is not defined as giving other people's money to the poor.
Thanks for the response, Gary. I just realized that hDlg refers to a
control in a dialog box, not the dialog box itself. I was incorrectly
using SetWindowPos where I should have been using a simple MoveWindow
call to reposition the control.
MoveWindow, by the way, works fine.
> > This is the line that's causing the crash:
> >
> > SetWindowPos(hDlg, HWND_TOP, 0, 0, (int) Rect.right, (int)
> > Rect.bottom,
> > SWP_NOMOVE);
> >
> > As an aside, shouldn't this function just fail and set an error code
> > of
> > invalid parameter if that's the problem?
>
> Yes you are right. But it doesn't happen in your case. Since
> you use DrWatson you know that you get a call stack long as
> a mile, which can be very helpful in situations like this. You
> could try adding an SEH block around your call to SetWindowsPos,
> or create your own SEH handler, to see if you can catch any exception
> generated by the call, and then grab the last available error code.
>
Thanks for the response, Andreas. I just realized that hDlg refers to a
control in a dialog box, not the dialog box itself. I was incorrectly
using SetWindowPos where I should have been using a simple MoveWindow
call to reposition the control (likely, the HWND_TOP, parameter caused
the problem). MoveWindow, by the way, works fine. It's interesting to
note that something so simple could crash an application under an OS as
"robust" as NT is supposed to be.