CreateWindowA() Not Functioning Properly

Hello Again,

I have this code here:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
						int gwtcb1=0;
						int gwtcb2=0;
						char* nacctmsg=new char[8001];
						char* nacctmsg2=new char[8001];
						std::stringstream nacctmsg_pre1;
						std::string nacctmsg_pre2;
						int nIndex =::SendMessage(drpdwnbx,CB_GETCURSEL,0,0);
						SendMessage(drpdwnbx,CB_GETLBTEXT,(WPARAM)nIndex,(LPARAM)txtmem8);
						gwtcb2=GetWindowText(txtbx8, &txtmem9[0], 40);
						std::string nacctype=txtmem8;
						std::string ntnshrtnmenacct=txtmem9;
						if(ntnshrtnmenacct=="YourNationShortName")
						{
							::MessageBox(hwnd, "Process Failed: No Nation Short Name Specified.", "ERROR", MB_OK);
							CreateWindowA("STATIC", "ERROR: Unable to create account.", WS_VISIBLE | WS_CHILD, 20, 220, 250, 180, hwnd, NULL, NULL, NULL);
							return 0;
						}
						if(nacctype=="Savings")
						{
							nacctmsg_pre1 << "Creating new account:\n" << txtmem9 << "_" << txtmem8 << "." << "\n";
							nacctmsg_pre2=nacctmsg_pre1.str();
							StringCbCopyA((LPCSTR)nacctmsg, 8001, (LPCTSTR)nacctmsg_pre2.c_str());
							CreateWindowA("STATIC", (LPCSTR)nacctmsg, WS_VISIBLE | WS_CHILD, 20, 220, 250, 180, hwnd, NULL, NULL, NULL);
							banking_connect("acct_sav");
							std::stringstream bnk_pre1;
							bnk_pre1 << txtmem9 << "_" << txtmem8 << "\n" << "Balance: $0.00" << "\n";
							std::string bnk3_pre2=bnk_pre1.str();
							StringCbCopyA(bnk3, 8001, bnk3_pre2.c_str());
						    std::tuple<int, std::string> bnk_update_rslt =  bnk_update (2, bnk3, 8000);
						    int bnk_rtrn_1 = bnk_get_return_int(bnk_update_rslt);
						    std::string bnk_rtrn_2 = bnk_get_return_string(bnk_update_rslt);
						    std::stringstream nacctmsg2_pre1;
						    nacctmsg2_pre1 << "Account " << txtmem9 << " Successfully Created." << "\n";
						    std::string nacctmsg2_pre2=nacctmsg2_pre1.str();
						    StringCbCopyA((LPCSTR)nacctmsg2, 8001, (LPCTSTR)nacctmsg2_pre2.c_str());
						    Sleep(2000);
						    CreateWindowA("STATIC", (LPCSTR)nacctmsg2, WS_VISIBLE | WS_CHILD, 20, 220, 250, 180, hwnd, NULL, NULL, NULL);
						    banking_close();
						}


So it runs fine. except for line 23. Instead of creating the gray static window with the text, it creates a white window with no text. However, the createwindowa function after it works fine, and 2 more createwindowa functions before it work as well. (the functions i just mentioned display the exact same window of the exact same dimentions in the exact same place)

When there is no code after the function it works fine.

So is this like a system glitch or is there a really basic thing i missed?

I am using GCC 4.8.1 64 Bit Compiler with the Orwell Dev-C++ IDE on a Windows 8.1 system.

Thanks again,
~Hom
Last edited on
I've been experimenting and researching for hours and have come up with nothing. Any help is appreciated!
why do you create so many static windows? just use Static_SetText(..) instead.
Thanks!

The Static_SetText() sent me on the right path towards SetWindowText() which worked!

Thanks again,
~Hom
Topic archived. No new replies allowed.