Hello, and good day to whomever reads this.
I am trying to learn the proper syntax, usage, and initialization of
"HWND *pHwnd[]={...};".I am trying to create a loop which creates 3 windows. Then it assigns
the returned HWND to an HWND variable pointed to by "HWND *pHwnd[]={..};". So I do not want
pHwnd to point to anything other than what it's been initialized with already, rather I want
to know how to assign the return from CreatWindowEx() to the variables pHwnd points to.
I am not looking for a work-around unless there is no other way. I am trying to learn the
about C++ semantics in Win32. Also I should mention that I am new to C++ and Win32.
The code below helps to depict what - approximately - I'm trying to do. Can you show what is wrong?
Code:LPCTSTR lpClassName[]= {"Static","Static","Static"}; LPCTSTR lpWindowName[]= {"Win1", "Win2", "Win3"}; int x[] ={0, 0, 0}; int y[] ={50,100,150}; int nWidth[] ={50,50, 50}; int nHeight[]={20,20, 20}; HMENU hMenu[3]; HWND hWin1, hWin2, hWin3; HWND *pHwnd[]={&hWin1, &hWin2, &hWin3}; switch (message) /* handle the messages */ { case WM_CREATE: for(int makeWin=0; makeWin < 3; makeWin++) { hMenu[makeWin]=(HMENU)makeWin; pHwnd[makeWin]=CreateWindowEx(0, lpClassName[makeWin], lpWindowName[makeWin], WS_CHILD|WS_VISIBLE, x[makeWin], y[makeWin], nWidth[makeWin], nHeight[makeWin], hwnd, hMenu[makeWin], NULL, NULL ); } break;
Thanks to anyone who reads this, and a big thanks to anyone who helps!



LinkBack URL
About LinkBacks





