Click here to Skip to main content
15,886,137 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionCString multiple assignment leak? Pin
TechAvtar4-Apr-10 19:12
TechAvtar4-Apr-10 19:12 
AnswerRe: CString multiple assignment leak? [modified] PinPopular
LunaticFringe4-Apr-10 19:30
LunaticFringe4-Apr-10 19:30 
AnswerRe: CString multiple assignment leak? Pin
Adam Roderick J4-Apr-10 20:15
Adam Roderick J4-Apr-10 20:15 
GeneralRe: CString multiple assignment leak? Pin
TechAvtar4-Apr-10 21:35
TechAvtar4-Apr-10 21:35 
GeneralRe: CString multiple assignment leak? PinPopular
Adam Roderick J4-Apr-10 21:40
Adam Roderick J4-Apr-10 21:40 
AnswerRe: CString multiple assignment leak? Pin
Joe Woodbury5-Apr-10 6:41
professionalJoe Woodbury5-Apr-10 6:41 
QuestionSecond Window in Win32 Pin
Fareed Rizkalla4-Apr-10 14:51
Fareed Rizkalla4-Apr-10 14:51 
AnswerRe: Second Window in Win32 Pin
enhzflep4-Apr-10 15:09
enhzflep4-Apr-10 15:09 
Hia.

Yeah, sure this is possible - in perhaps fewer lines of code than you may expect.
You'll want to declare a static HWND in the windowProcedure for the first window, or declare it as a global.
Then it's just a matter of creating the new window.

I keep a flag that tells me if the child window currently exists or not, then I act accordingly - either setting the window text, or creating the window.

if (!isChildOpen)
{
    GetWindowRect(hwndDlg, &myRect);
    imgChildHWND = CreateWindowEx(0, "picWnd", myWad.getLumpName(resNum), WS_SYSMENU|WS_CAPTION|WS_POPUP|WS_VISIBLE|WS_CHILD, myRect.right, myRect.top, 300, 300, hwndDlg, NULL, hInst, 0);
    isChildOpen = true;
}
else
    SetWindowText(imgChildHWND, myWad.getLumpName(resNum));


The child window sends a message to the controlling window whenever it is closed so I know if the window is open or not without resorting to findWindow,

i.e
case WM_CLOSE:
     PostMessage(GetParent(hwnd), IDC_CHILDCLOSING, 0, 0);

Where IDC_CHILDCLOSING is a message I've defined (#define IDC_CHILDCLOSING 1011)
GeneralRe: Second Window in Win32 Pin
Fareed Rizkalla4-Apr-10 20:53
Fareed Rizkalla4-Apr-10 20:53 
GeneralRe: Second Window in Win32 Pin
enhzflep5-Apr-10 1:59
enhzflep5-Apr-10 1:59 
GeneralRe: Second Window in Win32 Pin
Fareed Rizkalla5-Apr-10 3:51
Fareed Rizkalla5-Apr-10 3:51 
GeneralRe: Second Window in Win32 Pin
enhzflep5-Apr-10 8:36
enhzflep5-Apr-10 8:36 
QuestionRe: Second Window in Win32 Pin
Fareed Rizkalla5-Apr-10 15:41
Fareed Rizkalla5-Apr-10 15:41 
AnswerRe: Second Window in Win32 Pin
enhzflep6-Apr-10 2:12
enhzflep6-Apr-10 2:12 
GeneralRe: Second Window in Win32 Pin
Fareed Rizkalla6-Apr-10 5:13
Fareed Rizkalla6-Apr-10 5:13 
GeneralRe: Second Window in Win32 Pin
enhzflep6-Apr-10 17:42
enhzflep6-Apr-10 17:42 
GeneralRe: Second Window in Win32 Pin
Fareed Rizkalla5-Apr-10 16:28
Fareed Rizkalla5-Apr-10 16:28 
AnswerRe: Second Window in Win32 Pin
Garth J Lancaster4-Apr-10 15:11
professionalGarth J Lancaster4-Apr-10 15:11 
Questionsocket programming in c help Pin
kedah4-Apr-10 8:48
kedah4-Apr-10 8:48 
AnswerRe: socket programming in c help Pin
Richard Andrew x644-Apr-10 11:49
professionalRichard Andrew x644-Apr-10 11:49 
AnswerRe: socket programming in c help Pin
Garth J Lancaster4-Apr-10 12:29
professionalGarth J Lancaster4-Apr-10 12:29 
QuestionIs the handle from OpenProcess Unique Pin
ForNow4-Apr-10 7:37
ForNow4-Apr-10 7:37 
QuestionRecieving device events in a service Pin
Ap0ll0-134-Apr-10 3:42
Ap0ll0-134-Apr-10 3:42 
QuestionHow to get the net speed of your computer and how to get the current webpage's speed? Pin
Aric Wang4-Apr-10 0:42
Aric Wang4-Apr-10 0:42 
QuestionRe: How to get the net speed of your computer and how to get the current webpage's speed? Pin
enhzflep4-Apr-10 3:31
enhzflep4-Apr-10 3:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.