-
Oct 21st, 2006, 09:42 AM
#11
Re: Visual Basic API FAQs
Originally Posted by VBDie
The problem with this code is that it will change the size of the form to 0,0,0,0. This is what I have added:
I'm afraid you're wrong - the original code works fine. The problem you are having is due to the final parameter, the wFlags value.
In your example you have it set to &H50 - this value indicates that the 5th and 7th bits are turned on (&H10 and &H40 respectively). If you look at the constants for SetWindowPos you'll see that you have the following set:
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
in the original code example two further bits are set, the first and second (&H1 and &H2):
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
as the name of these constants suggests they prevent the window being affected by the X, Y, cx and cy parameters.
change the last parameter to &H53 and you'll find that it'll all works fine.
the moral of the story is to not use magic numbers.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|