Thread overview
[phobos] Resizing child windows using phobos
Aug 22, 2013
Alex Dahlin
[phobos] Fwd: Resizing child windows using phobos
Aug 22, 2013
Alex Dahlin
Aug 22, 2013
Adam D. Ruppe
August 22, 2013
So i have been trying to send WM_SIZE messages to my child windows in my application window proc. I am sending theese messages when the application window is resized. But it will not work. They keep the same child window size as they have from when they were initialized.

Is there any other methods that i can use that are already included in the phobos libraries?

Thanks for any help.
_______________________________________________
phobos mailing list
phobos@puremagic.com
http://lists.puremagic.com/mailman/listinfo/phobos

August 22, 2013

So i have been trying to send WM_SIZE messages to my child windows in my
application window proc. I am sending theese messages when the
application window is resized. But it will not work. They keep the same
child window size as they have from when they were initialized.

Is there any other methods that i can use that are already included in
the phobos libraries?

Thanks for any help.



_______________________________________________
phobos mailing list
phobos@puremagic.com
http://lists.puremagic.com/mailman/listinfo/phobos

August 22, 2013
On Thu, Aug 22, 2013 at 06:19:18AM -0500, Alex Dahlin wrote:
> Is there any other methods that i can use that are already included in the phobos libraries?

The Windows headers in phobos and druntime are very minimal and don't
include the necessary functions (either SetWindowPos or MoveWindow will
do it, the WM_SIZE message is sent to notify the window that it has already
been resized, not to actually change it.)

http://msdn.microsoft.com/en-us/library/windows/desktop/ms633545(v=vs.85).aspx

To call a Windows function that isn't included in the phobos headers, you just have to copy the prototype. For example:


import core.sys.windows.windows; // include the basics druntime provides, aka std.c.windows.windows

// you can get the prototype from MSDN. It is almost the same, just take out the "WINAPI" and "_In_"
// and use extern(Windows) before it
extern(Windows) BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int x, int y, int w, int h, UINT flags);


// call the function:

SetWindowPos(hwnd, null, 0, 0, newWidth, newHeight, /* SWP_NOZORDER */ 0x0004 | 0x002 /* SWP_NOMOVE */);



You can also copy/paste the constants out of MSDN and make enums for them instead of just writing the number like I did here.



OR you can grab the more complete windows headers for D. I think this is the more up-to-date repo:

http://dsource.org/projects/bindings/browser/trunk/win32


Then you can import win32.windows; and use it straight away. It would be really nice if these headers came with the D distribution, but alas they don't yet.

_______________________________________________
phobos mailing list
phobos@puremagic.com
http://lists.puremagic.com/mailman/listinfo/phobos