Moving layered windows concurrently in win32 - c++

i am trying to implement a custom tab control in my win32 window, for that i have used a layered window which is child of the main app window (for the main tab control) and independent windows for individual tab items.
My problem: Whenever i move the main app window, the control window moves along with it (because its the child window) where as the individual tab item windows remain on their position. Can anyone guide me how to to get the tab items windows move along with the main app window concurrently? I can not set the item windows as child of the app, so please base your suggestions on that.

You should redesign your tab to be a child window. Otherwise your attempts to make it work is nothing but a desperate try to fix the thing made bad in first place.
Still if you feel like sticking the original plan, you need to hook/subclass the main app window and handle its movement and sizing messages (WM_MOVING and friends) so that your handler could update your popup/tab window position respectively.

Related

MFC floating CDialog control clipping issue

I am making an SDI MDF application that uses a frameview to provid the user with a set of controls (buttons, editboxes and such). The view also owns a set of CDialogs used to desplay aditional controls that can be can be shown or hidden via a tabcontrol and other means. Untill recently the dialogs have been staticly placed at creation to be in their proper location on the screen but I wanted to add a dialog that the user could move around but is still a child of the view. When I created a dialog with a caption and sysmenu that the user can move around the issue I am running into is that when the window is placed over another control owned by the view, (lets say a button) when the paint method is called on the button, it draws over the dialog. The dialog is still on top and the dialogs controls can still be interacted with but the button is drawn over them untill the dialog is repainted. I have tryed to change the clipchild and clipsiblings settings of the dialog and have been able to get the dialogs to properly clip eachother but can not seem to get the child dialog to properly clip the parent view controls. Does anyone have any ideas on what setting might fix this clipping issue.

How To Change Panel/view in the Windows Client Area in MFC

I want to design a student registration and exam recording app using C++ MFC with a kind of child window containing buttons edits and other common controls which is displayed on the app client area, and can be removed and replaced with another one by clicking a button. Thats the problem i face now( The GUI ). I came from JAVA background where this can be done by creating a JPanel as a container for the buttons, combo boxes and text fields controls. the panel is displayed on the client area and can be removed and replaced with another panel containing a new set of controls. I tried learning CView but it keeps talking about documents and views that displays untitled document as in word processing. Any pointer will be appreciated. Thanks.
After having searched and read a lot about my problem, i decided to go into win32 API where everything is possible depending on your awareness.The solution is as simple as creating a main window and creating any number of child windows who uses the main window as parent and all has a hiden window attribute. Then you can create controls on each child window. To switch between the child windows I did this: ShowWindow(childWindow1, SW_HIDE); ShowWindow(childWindow2, SW_SHOW);. thats it, only that the repaint process after restore does not repaint the child window's controls and its child window.

Insert an UI into another MFC Dialog

I have one MFC application (exe) that contains two panes in its main UI. This application loads another DLL that also contains one dialog. How can I programatically place a Dialog defined into the DLL, and put it into (within) the pane of the MFC application? The question is not how to programatically retrieve the dialog from the DLL but how to put this dialog 'on the top' (within, inside) of one UI pane that belongs to the application?
My goal is to customize the UI of the application with dialog(s) retrieved from a dll and give the user the feeling that these dialogs all belong to one application UI. Thanks for any hint.
I have some applications with this feature, often with a tab control to alternate between windows.
First I set a frame in the container window, invisible to the user. The frame is just a placeholder to where the dialog window will be.
Then I make an instance of the dialog window as a global variable in the container class, I create the dialog window as a modeless window (using Create(), not DoModal()), move the window to the same RECT of the frame control, and call ShowWindow() to show the window.
Am I understanding you correctly that you don't want the dialogs to appear as dialogs, but rather as content of another window, or as a pane?
In other words, you want to get rid of the dialog's title bar and embed the dialog's content into another window, is that right?
That is possible. You would need to create the dialog without the title bar (change the window style) and make sure that you create the dialog's window as a childwindow of the window where you want the content to go. I can explain this further but I first would like to know if I'm understanding you correctly.

Is there a way to have a process created by CreateProcess open within another window?

I want to be able to open a GUI application using CreateProcess in a main process and have the GUI display in a window I create from within the main process. Does anyone know how to achive this? Thanks!
If you are in control of both applications then yes.
This is how screen savers display in the screen saver control panel - the control panel passed the dialogs window on the command line, and the .scr file - which is just a simple exe - creates its window as a child using the given hwnd as its parent.
Capturing a previously written top level window and forcing it to exist within your own frame is however not well supported.
Again, it is something you can easilly try: I wrote a test app that created a empty frame window, did a FindWindow for copies of Notepad, and reparented the notepad window to be a child of my frame.
So it does work: in this simple scenario at least, but there is no guarantee: more complex applications that modify their own frame styles might very well break, additionally having a child window and parent window on different threads introduces the possibility of deadlocks.
No you can't do this.
Something that might work... You could start the process though, and then using the window handle apply a series of changes to the window to take off the frame. Then you could move it to the position of some other placement control in your window and when you have move/resize events you also resize this child window.

Creating a custom context menu Window (WinAPI)

I'm wondering how to create windows like these alt text http://img824.imageshack.us/img824/997/this.jpg
I'm refering to the one that says Marquee selection tool... these ones. I'm also not referring to the skin. I know how to do my own drawing and what not, this is not the issue. It's because windows usually need a parent which means it should not be possible for these windows to overlap into the tools. The only windows that can do this are context menus and menus. How can I create this style of window? Thanks
I think you are confusing the concept of owner windows and parent windows. Only dialog controls have parent windows, and these are automatically clipped by the parent's client area. Other windows have owner windows. This is a weaker relationship. There's nothing stopping a window from overlapping its owner.
Also, I wouldn't assume that just because the toolbar launches the context menu that the toolbar window has a relationship with the menu window. It might or might not, depending on how things are coded behind the scenes.
In any case, just try it out. Use the TrackPopupMenu() to create a popup. You can have it overlap the owner window without difficulty. Any window without the WS_CHILD style will exhibit the same behaviour.