Consider There is an edit control and a staic control in the dialog.. Using the SetwindowPos I moved the staic control over the edit control( only half overlapped). But now if I clicked in the edit control, it will paint over staic control..
depending on the type of the control you want to make "popup" there can be different approaches, but you can try to make a popup window (a real window) and moving the control to that window using SetParent/SetOwner.
The control is custom calendar derived from CMonthCalCtrl. It is created as a dlg item and a member variable is assigned. So it is basically a child. Now I want to give it popup style with out changing the parent, because the parent needs the messages from it.
Please note that if we create the same control dynamically with popup style it is working fine.
WS_CHILD is not compatible with WS_POPUP, so your control is a child window or a popup window, can't be an hybrid. If you change WS_CHILD to WS_POPUP then you must change the parent window to NULL. See SetParent on MSDN remarks section:
For compatibility reasons, SetParent does not modify the WS_CHILD or WS_POPUP window styles of the window whose parent is being changed. Therefore, if hWndNewParent is NULL, you should also clear the WS_CHILD bit and set the WS_POPUP style after calling SetParent. Conversely, if hWndNewParent is not NULL and the window was previously a child of the desktop, you should clear the WS_POPUP style and set the WS_CHILD style before calling SetParent.
If the control have a parent differen than the Desktop your control MUST be WS_CHILD, otherwise it MUST be WS_POPUP.
I use ModifyStyle( WS_CHILD, WS_POPUP ); to change the style.
If you change WS_CHILD to WS_POPUP then you must change the parent window to NULL.
If I create the control dynamically as popup its parent can be dialog wnd. And it is working fine as I desired. The dialog wnd is passed as the parent to create the control. And using a spy I can identify that the parent is the dialog itself.
I just want to make the control created as child, to be the same as I created dynamically. Hope you can understand what I am trying to do.
I have long value i am want to show in the dlg i used below code but its giveing error can any one help me with this..
error C2664: 'SetWindowTextA' : cannot convert parameter 1 from 'long' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast