Rearrange main dialog and add screen name
This commit is contained in:
		
							parent
							
								
									e5c06b65eb
								
							
						
					
					
						commit
						33b5740184
					
				
										
											Binary file not shown.
										
									
								
							| @ -10,6 +10,8 @@ | ||||
| #define IDC_BUTTONCONNECT               1005 | ||||
| #define IDC_EDITADDRESS                 1006 | ||||
| #define IDC_ICONMAIN                    1007 | ||||
| #define IDC_EDITSCREENNAME              1008 | ||||
| #define IDC_STATICDESC                  1009 | ||||
| #define ID_FILE_EXIT                    40001 | ||||
| #define ID_HELP_ABOUT                   40002 | ||||
| 
 | ||||
| @ -19,7 +21,7 @@ | ||||
| #ifndef APSTUDIO_READONLY_SYMBOLS | ||||
| #define _APS_NEXT_RESOURCE_VALUE        107 | ||||
| #define _APS_NEXT_COMMAND_VALUE         40003 | ||||
| #define _APS_NEXT_CONTROL_VALUE         1008 | ||||
| #define _APS_NEXT_CONTROL_VALUE         1010 | ||||
| #define _APS_NEXT_SYMED_VALUE           101 | ||||
| #endif | ||||
| #endif | ||||
|  | ||||
| @ -21,10 +21,10 @@ namespace wc { | ||||
| 	} | ||||
| 
 | ||||
| 	void Application::run() { | ||||
| 		DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOGMAIN), nullptr, (DLGPROC)dlgProc, reinterpret_cast<LPARAM>(this)); | ||||
| 		DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOGMAIN), nullptr, (DLGPROC)mainDlgProc, reinterpret_cast<LPARAM>(this)); | ||||
| 	} | ||||
| 
 | ||||
| 	BOOL CALLBACK Application::dlgProc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam) { | ||||
| 	BOOL CALLBACK Application::mainDlgProc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam) { | ||||
| 		static Application* app = nullptr; | ||||
| 
 | ||||
| 		switch (msg) { | ||||
| @ -47,7 +47,10 @@ namespace wc { | ||||
| 				HFONT font = CreateFontIndirect(&lFont); | ||||
| 				SendMessage(GetDlgItem(dlg, IDC_STATICTITLE), WM_SETFONT, reinterpret_cast<LPARAM>(font), NULL); | ||||
| 
 | ||||
| 				SetDlgItemText(dlg, IDC_STATICDESC, L"A simple Windows chat app"); | ||||
| 
 | ||||
| 				SendDlgItemMessage(dlg, IDC_EDITADDRESS, EM_SETCUEBANNER, TRUE, reinterpret_cast<LPARAM>(L"Address")); | ||||
| 				SendDlgItemMessage(dlg, IDC_EDITSCREENNAME, EM_SETCUEBANNER, TRUE, reinterpret_cast<LPARAM>(L"User")); | ||||
| 				return TRUE; | ||||
| 			} | ||||
| 
 | ||||
| @ -55,9 +58,12 @@ namespace wc { | ||||
| 				switch (LOWORD(wParam)) { | ||||
| 					case IDC_BUTTONCONNECT: { | ||||
| 						std::wstring address; | ||||
| 						address.resize(GetWindowTextLength(GetDlgItem(dlg, IDC_EDITADDRESS)) + 1); | ||||
| 						GetDlgItemText(dlg, IDC_EDITADDRESS, address.data(), static_cast<int>(address.size())); | ||||
| 						MessageBox(dlg, std::format(L"Address: {}", address).c_str(), L"Alert", MB_OK); | ||||
| 						address.resize(GetWindowTextLength(GetDlgItem(dlg, IDC_EDITADDRESS))); | ||||
| 						GetDlgItemText(dlg, IDC_EDITADDRESS, address.data(), static_cast<int>(address.size() + 1)); | ||||
| 						std::wstring screenname; | ||||
| 						screenname.resize(GetWindowTextLength(GetDlgItem(dlg, IDC_EDITSCREENNAME))); | ||||
| 						GetDlgItemText(dlg, IDC_EDITSCREENNAME, screenname.data(), static_cast<int>(screenname.size() + 1)); | ||||
| 						MessageBox(dlg, std::format(L"Address: {}\nScreen Name: {}", address, screenname).c_str(), L"Alert", MB_OK); | ||||
| 						return TRUE; | ||||
| 					} | ||||
| 
 | ||||
|  | ||||
| @ -13,7 +13,7 @@ namespace wc { | ||||
| 		~Application(); | ||||
| 	private: | ||||
| 
 | ||||
| 		static BOOL CALLBACK dlgProc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam); | ||||
| 		static BOOL CALLBACK mainDlgProc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam); | ||||
| 
 | ||||
| 		const std::wstring m_appName; | ||||
| 		const std::wstring m_appVersion; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user