It assumes a child control (a button in my instance) exists and has the ID of IDC_BUTTON1 (#define IDC_BUTTON1 1000)
/* This function is called by the Windows function DispatchMessage() */
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
int wWidth, wHeight;
int bWidth, bHeight;
switch (message) /* handle the messages */
PostQuitMessage (0); /* send a WM_QUIT to the message queue */break;
// get size of the parent window's client area
wWidth = LOWORD(lParam);
wHeight = HIWORD(lParam);
// get RECT of the button (in parent's client coords)
btnHwnd = GetDlgItem(hwnd, IDC_BUTTON1);
// determine it's dimensions
bWidth = btnRect.right - btnRect.left;
bHeight = btnRect.bottom - btnRect.top;
// move it so that it retains its width and height, and is centered on the parent window.
SetWindowPos(btnHwnd, HWND_TOP, (wWidth-bWidth)/2, (wHeight-bHeight)/2, bWidth, bHeight, SWP_SHOWWINDOW);
default: /* for messages that we don't deal with */return DefWindowProc (hwnd, message, wParam, lParam);
Ok, this is pretty specific question. What i am trying to do is to implement vista glass effect in my gtk+ windows app. But, i just can't gtk+ code can be easily mixed with win32 APIs, so for example here is the code which draws a black rectangle on the specified area (the area where app border extends to client window):
This works fine, but only in case of pure win32 api based app, while in gtk+ for some reason it doesn't.
As code can be mixed i have tried it this way:
HWND hwnd = (HWND)gdk_win32_drawable_get_handle (window->window);
HDC hdc = GetDC(hwnd);
if(!hdc)MessageBox(0,"err getting hdc","err",0); // hdc is not null...
the rest of the code is the same actually. Result is negative.
Another way of getting HDC was:
hdc = gdk_win32_hdc_get (window->window, window->style->black_gc, mask);
But i simply got no idea how to use this function, because as 2nd parameter - there are tons of options and i dont know gtk that good.
So maybe you can help me or maybe you know some resource where i can get help on win32 gtk programming.
I know there are standard methods for doing this in wx(?), Qt, win32, mfc, .Net, etc, but gtk+ is the only options in this case.
Thanks in advance