Hey there guys,

I have created a nice dialogbox with some DIB effects on them. Now I want to create a smaller dialog underneath that so I can place some buttons on there.
My problem is though that the new Dialog, including the buttons is created fine when I add it to my projet. But that new one needs to stay under my main (DIB) dialogbox. Now the newly made one stays at the same spot and the Main dialogbox can be moved. What I want to do is set the postion of the new one so that it always stays under the main one even if I move the main Dialog.

This is what I did sofar:

My MAIN DIALOG:

cmp ,WM_INITDIALOG
invoke CreateDialogParam, hInstance, 300, hWnd, ButtonDlgProc, NULL
          mov hDlg,eax
          invoke ShowWindow, hDlg,SW_SHOWNORMAL
          invoke SetWindowPos,hDlg,HWND_TOP,0,0, ScreenWidth,28, SWP_NOMOVE

In my ButtonDLGproc I have this for loading my Bitmaps on the buttons.

Wm_1:     
                       
          cmp ,WM_INITDIALOG
          jnz Wm_2

          invoke GetModuleHandle, NULL                                           
          mov hInstance,eax                                                           
          invoke LoadBitmap, hInstance, 105                                           
                  invoke SendDlgItemMessage, hWnd, 102, BM_SETIMAGE, IMAGE_BITMAP, eax

          invoke GetModuleHandle, NULL                                           
          mov hInstance,eax     
          invoke LoadBitmap, hInstance, 106                                           
                  invoke SendDlgItemMessage, hWnd, 103, BM_SETIMAGE, IMAGE_BITMAP, eax

          invoke GetModuleHandle, NULL                                           
          mov hInstance,eax
          invoke LoadBitmap, hInstance, 107                                           
                  invoke SendDlgItemMessage, hWnd, 104, BM_SETIMAGE, IMAGE_BITMAP, eax

          invoke GetModuleHandle, NULL                                           
          mov hInstance,eax
          invoke LoadBitmap, hInstance, 108                                           
                  invoke SendDlgItemMessage, hWnd, 109, BM_SETIMAGE, IMAGE_BITMAP, eax

This results in that my project can be made perfectly. But as I tryed to explain above it does not stay under my main dialog. Any tips for me guys?
Posted on 2006-10-16 07:50:56 by Veggy
You need to alter the ownership chain which, if I recall correctly, is changed with SetParent. You will probably also need to reset the owner of the main window before destroying the dialog.
Posted on 2006-10-16 11:05:31 by tenkey
Hey there tenkey you have an example on that?

Here is a picture I made of my situation, as I have the code as explained above.


As you guys can see my buttons (dialog) is made in the middle and I need it to stick underneath the black screen and I am trying to let it stay at that spot. So if I move the main DIalog, the black screen, my buttons need to be moving also.
Posted on 2006-10-16 11:20:18 by Veggy
Anyone who can help? I need my second Dialogbox to stick under the Main dialogbox, any tips on API's I should be using?
Posted on 2006-10-17 08:22:20 by Veggy
Here is a link to SetParent.

Do something like

invoke GetParent,hMainDlg ; get owner window
invoke SetParent,hDlg,eax ; make the new dialog the same level as "main" dialog
invoke SetParent,hMainDlg,hDlg ; put "main" dialog on top of new dialog

You may need to redraw the windows in order to immediately see changes.

WARNING: I believe the "parent notify" chain is also altered by this.
Posted on 2006-10-18 17:45:08 by tenkey