| | |
Get Dialog hWnd
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2009
Posts: 26
Reputation:
Solved Threads: 0
Hi.
I have a problem I cant find a solution to, since I am unable to describe the problem in a searchable way.
I make a hWnd for each contact the user has:
messengerBox is defined like this.
I want the user to be able to hide the dialog - and also get the number of the struct character[] it is in, but I dont know how to get the hWnd, since it is dynamically stored in a variable.
Hope you understand!
Cheers.
I have a problem I cant find a solution to, since I am unable to describe the problem in a searchable way.
I make a hWnd for each contact the user has:
C++ Syntax (Toggle Plain Text)
contact[atoi(rowC[0])].hWnd = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG4), hWnd, messengerBox);
messengerBox is defined like this.
C++ Syntax (Toggle Plain Text)
BOOL CALLBACK messengerBox(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch(message) { case WM_COMMAND: switch(LOWORD(wParam)) { case WM_DESTROY: //ShowWindow(???,SW_HIDE); break; } break; default: return FALSE; } return TRUE; }
I want the user to be able to hide the dialog - and also get the number of the struct character[] it is in, but I dont know how to get the hWnd, since it is dynamically stored in a variable.
Hope you understand!

Cheers.
•
•
Join Date: Mar 2008
Posts: 1,485
Reputation:
Solved Threads: 123
0
#2 Oct 30th, 2009
•
•
•
•
Hope you understand!
C++ Syntax (Toggle Plain Text)
ShowWindow(hWnd, SW_HIDE);

Posting / Attaching the whole code would help.
I need pageviews! most fun profile ever :)
•
•
Join Date: Oct 2009
Posts: 26
Reputation:
Solved Threads: 0
0
#3 Oct 30th, 2009
I would know the hWnd for my logon dialog, or my update dialog - but there is a contact dialog for each contact of the user.
So we have a dialog hWnd in contact[0].hWnd, contact[1].hWnd, etc.
But all these hWnds are linked to the messengerBox (BOOL CALLBACK messengerBox(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)). How do i make hWnd-individual actions in the messengerBox code?
C++ Syntax (Toggle Plain Text)
while(row = get_users_contacts()){ contact[atoi(rowC[0])].hWnd = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG4), hWnd, messengerBox);}
So we have a dialog hWnd in contact[0].hWnd, contact[1].hWnd, etc.
But all these hWnds are linked to the messengerBox (BOOL CALLBACK messengerBox(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)). How do i make hWnd-individual actions in the messengerBox code?
•
•
Join Date: Mar 2008
Posts: 1,485
Reputation:
Solved Threads: 123
0
#4 Oct 30th, 2009
So let me get this right, you basically have an array of hWnd's which all link to the same event handler, but you want to do different things with each of them in the messengerBox dialog when it's opened.
Even if I understood correctly, it depends what kind of changes will be in each new messengerBox dialog, will it have a totally new layout? or different data in the text fields?
More code, screenshots, anything to describe it better would be helpful.
Even if I understood correctly, it depends what kind of changes will be in each new messengerBox dialog, will it have a totally new layout? or different data in the text fields?
More code, screenshots, anything to describe it better would be helpful.
I need pageviews! most fun profile ever :)
•
•
Join Date: Oct 2009
Posts: 26
Reputation:
Solved Threads: 0
0
#5 Oct 31st, 2009
•
•
•
•
So let me get this right, you basically have an array of hWnd's which all link to the same event handler, but you want to do different things with each of them in the messengerBox dialog when it's opened.
Even if I understood correctly, it depends what kind of changes will be in each new messengerBox dialog, will it have a totally new layout? or different data in the text fields?
More code, screenshots, anything to describe it better would be helpful.
I have a thread that frequently checks for new messages, and then it sends the message to the textfield in the hWnd as so:
C++ Syntax (Toggle Plain Text)
SendMessage(GetDlgItem(contact[atoi(row[2])].hWnd,IDC_EDIT1), WM_SETTEXT, 0, (LPARAM) convertCharTCHAR(row[3]));
This works fine.
Now I want to be able to, from the dialog, send messages, but I cant figure out how to sepparate the dialogs and get the contact[i].hWnd (to hide window) and the contact[i].id to send a message back.
Cheers for helping
•
•
Join Date: Mar 2008
Posts: 1,485
Reputation:
Solved Threads: 123
0
#6 Oct 31st, 2009
•
•
•
•
Now I want to be able to, from the dialog, send messages, but I cant figure out how to sepparate the dialogs and get the contact[i].hWnd (to hide window) and the contact[i].id to send a message back.
I need pageviews! most fun profile ever :)
•
•
Join Date: Oct 2009
Posts: 26
Reputation:
Solved Threads: 0
0
#7 Oct 31st, 2009
•
•
•
•
So let me get this right, you basically have an array of hWnd's which all link to the same event handler, but you want to do different things with each of them in the messengerBox dialog when it's opened.
Even if I understood correctly, it depends what kind of changes will be in each new messengerBox dialog, will it have a totally new layout? or different data in the text fields?
More code, screenshots, anything to describe it better would be helpful.
•
•
•
•
Obviously the use of arrays here has made this very confusing, maybe it's possibly to do without, I don't know. But all I can suggest is to try using global variables and message notifications too, at this stage in making the program you have the biggest understanding of the problem and your intentions, so it's easiest for you to solve (unless perhaps I take a look at the entire project).
I'd be very glad if you could help me, and I could send over my project if thats what it takes. Its a bit too long to be posted here.
•
•
Join Date: Mar 2008
Posts: 1,485
Reputation:
Solved Threads: 123
0
#8 Oct 31st, 2009
•
•
•
•
Well I have used many hours, and unlike normally, I'm completely clueless.
I'd be very glad if you could help me, and I could send over my project if thats what it takes. Its a bit too long to be posted here.
I need pageviews! most fun profile ever :)
•
•
Join Date: Mar 2008
Posts: 1,485
Reputation:
Solved Threads: 123
0
#10 Oct 31st, 2009
I need pageviews! most fun profile ever :)
![]() |
Other Threads in the C++ Forum
- Previous Thread: Whats wrong with this function?
- Next Thread: problems with vectors
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer display dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator getline givemetehcodez graph iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct template templates text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






