Hi, I have a project which uses the following resource file to create a dialog as the main window. TESTDLG DIALOGEX 0, 0, 180, 110 STYLE WS_POPUP | WS_VISIBLE | WS_DLGFRAME FONT 8, "MS Sans Serif" BEGIN CONTROL "",107,"Button",BS_OWNERDRAW | WS_TABSTOP,133,49,31,12,78 CONTROL "",108,"Button",BS_OWNERDRAW | WS_TABSTOP,133,81,31,11,78 CONTROL "",109,"Button",BS_OWNERDRAW | WS_TABSTOP,15,14,85,78 CONTROL 134,104,"Static",SS_BITMAP,0,0,88,51, WS_EX_TRANSPARENT END The dialog works find, the last static control acts as the background bitmap and the three button sit invisible on top of it. I know how to read when the buttons are clicked but I'm trying to draw to either one of the buttons or the static control, I only know how to draw directly to the dialog but as it completly covered that won't work here. Basically I think I need to get the DC for a control but I don't know how to get the handle. I tired FindWindow, it didn't work; either I used it wrong or its not supposed to be used for this at all.
Posted on 2001-02-27 19:11:00 by Zadkiel
This is working for me. .if wmsg==WM_INITDIALOG ; has the box been initialised? push 107 ; control ID push dlghwnd ; Handle of owner call GetDlgItem ; get handle of control mov handle.eax forge This message was edited by forge, on 2/27/2001 7:55:33 PM
Posted on 2001-02-27 19:41:00 by forge
Zadkiel, In straight API coded windows (CreateWindowEx) what you are after is no big deal to do as the parent window can be covered by the static control that has the SS_BITMAP style set. You then just place the controls on the parent window like normal. With a dialog its a bit problematic because a dialog resizes depending on the users choice of system settings for the font size. The problem with what you are trying to do is that a STATIC control does not accept input in the normal sense so you may have the choice of modifying the bitmap or coding a custom control to do what you need. Try using the normal API to get the handle of a dialog control

    invoke GetDlgItem,hDlg,118
    mov hCtrl, eax
and see if this does the job for you. Regards, hutch@pbq.com.au
Posted on 2001-02-27 19:44:00 by hutch--
Thanks for all the help
Posted on 2001-02-28 07:08:00 by Zadkiel