Click to See Complete Forum and Search --> : CreateDialog Problem


sss0379
February 6th, 2003, 04:42 AM
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!!!!!

filthy_mcnasty
February 6th, 2003, 01:00 PM
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.

sss0379
February 6th, 2003, 11:26 PM
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 !!!!!

filthy_mcnasty
February 7th, 2003, 12:09 AM
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.