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
In my application i connected server and client through sockets.In this,I have one seperate Config file that shows the IP address of different clients.i.e.,for server 1 should connected to CLient 1 IP addr,Servr2 must connected with Client 2 addr.Lile this i provide each client's IP address.So that the server must checked with that file to which client it must be connected.
My problem is, if the client is in my local machine i.e, in the server machine itself,it checks the Config File,In that i gave IPaddr of that server machine.But it does not work.
In my condition checking..I got IP address through GetPeerName().If the client is in another machine it returns IP as 192.168.3.33 like this.And if the Client is in sever itself it returns the LocalHost liek 127.0.0.1.
So,in condition checking it failed b'coz my COnfig File shows only format of IP addr.(192.168...)
Is there any way to get the Local machine IP addr instead of taking 127.0.0.1.
mOpListCurInstr is the address noted in Config File.