CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2002
    Posts
    45

    Question CreateDialog Problem

    Hi Everybody,
    I m creating a chat application. Now if both the end users who are chatting with each other have there chat window open they get the chat message. So now i need to check that when the chat window isn't open i need to open a dialog & display the message in it. I do come to know whether the chat window is open or not but if i call createdialog & later showwindow the dialog box shows up but the everything is disabled. Can anybody help me in this regard?

    The following is the code snippet that i have written: -

    HWND hWndDialog;
    hWndDialog = GetHwndOpen(); //My Function which determines whether the Window is open or not if open then gives the Handle else returns NULL
    if(hWndDialog == NULL){
    hWndDialog = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DLGCHAT), NULL,(DLGPROC) dlgChat); // IDD_DLGCHAT is my dialog box name & dlgChat is the function
    ShowWindow(hWndDialog,SW_SHOW);
    }

    LRESULT CALLBACK DlgChat(HWND hDlg, UINT message, WPARAM wParam, LPARAM LParam)
    {
    switch (message)
    {
    case WM_INITDIALOG:
    {
    ::MessageBox(NULL,"in INIT","CC",0);
    return TRUE ;
    }
    }
    return FALSE;
    }

    I have also the Visible property of the IDD_DLGCHAT to true. Moreover the Disabled property of the IDD_DLGCHAT is False.

    I also get the MessageBox written in WM_INITDIALOG.

    Please help me in this regard.

    Thanking You,
    Sonali.....

    Have a gud day!!!!!

  2. #2
    Join Date
    Aug 2002
    Location
    United States
    Posts
    729
    i dont fully understand what you're asking.
    if you want to see if the dialog is already open you can simply use
    hwndChat = FindWindow("#32770", "Your Title here");
    if(hwndChat == NULL)
    CreateDialog(etc etc);

    is this what you mean? you say everything is disabled? EnableWindow() will help you there but i'm still not sure that's what you're asking.

  3. #3
    Join Date
    Dec 2002
    Posts
    45
    Hi Thanks for reply,

    Your Ques :-
    1.) if you want to see if the dialog is already open you can simply use
    hwndChat = FindWindow("#32770", "Your Title here");

    Ans ) Actually I come to know thru my function whether the window is open or not (cos it has some manipulations also to be done). However thanx for this funciton FindWindow().

    2.) EnableWindow() will help you there but i'm still not sure that's what you're asking.
    Ans) I m calling hte enablewindow but still the dialog is disabled dont know why may b i m sounding absurd but this is it

    So i was thinkin whether there is a problem in how i create the dialog using CreateDialog or so?

    Thanking you,
    Sonali.....

    Have a gud day !!!!!

  4. #4
    Join Date
    Aug 2002
    Location
    United States
    Posts
    729
    CreateDialog will always create a functional dialog unless there is some outside factor going on. when you say it's disabled do you mean the dialog itself or child controls on it?

    if(EnableWindow(hwnd, FALSE))
    EnableWindow(hwnd, TRUE);


    is a quick method i use to toggle the status of a window. i guess i still dont understand the problem. perhaps you can post some code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured