I would like to fit exactly a DialogBox I created with .rc file in a Window. I know exactly the DialogBox dimension, since I created it, but the problem is its dimensions are expressed in Dialog Base Units and not in pixels, as Windows are.
So I tried to use the GetDialogBaseUnits API function to retrieve the dialog box base units used by Windows to create dialog boxes; then I used standard conversion formulas to translate from DBU to pixels and finally I used the values obtained to create my main Window... but its dimensions are still a little bigger (from 20 to 50 pixels) than DialogBox.
Where am I going wrong ???
Thanks, Saiwa
Just Modify the code below to size your window
to the other windows size.
.Data
rect RECT<>
.Code
;EAX has the hamdle to a window you want to size your other window to after you got a rect on that window.
invoke GetClientRect,eax,addr rect
invoke MoveWindow,hWin,rect.left,rect.top,
rect.right,rect.bottom,TRUE
I know it might not be what you want but
it can be made to do what you want. I am not sure if
you are trying to make your Dialog window the same size as one
that is already showing or you just want to make one that is the size as another program you know about. this code above
will size it to a window that is showing.
This message was edited by Zcoder, on 4/15/2001 11:56:23 AM
Thank for the reply, but my problem is that the DialogBox is fixed in dimensions (since in reality is the DialogBox which hold the application functionality, I mean EditWindows, Buttons & so on), and is the main Window that has to be sized in order to host the DialogBox exactly.
So, the main Window is the first one created than the DialogBox is displayed in response to a WM_INITDIALOG message.
If You wonder why not to create only the DialogBox, the answer is I want to see if I can use Keyboard shortcuts even if using a DialogBox.
(Sorry for my terrible English...)
Bye, Saiwa