Start chat dialog

This commit is contained in:
Grayson Riffe 2023-09-29 13:36:08 -05:00
parent 15655a6aec
commit c2b3518bdd
4 changed files with 30 additions and 2 deletions

Binary file not shown.

View File

@ -6,6 +6,7 @@
#define IDR_MENUMAIN 104 #define IDR_MENUMAIN 104
#define IDI_ICONMAIN 106 #define IDI_ICONMAIN 106
#define IDD_DIALOGCONNECTING 107 #define IDD_DIALOGCONNECTING 107
#define IDD_DIALOGCHAT 109
#define IDC_STATICTITLE 1001 #define IDC_STATICTITLE 1001
#define IDC_BUTTONEXIT 1003 #define IDC_BUTTONEXIT 1003
#define IDC_BUTTONCONNECT 1005 #define IDC_BUTTONCONNECT 1005
@ -15,6 +16,10 @@
#define IDC_STATICDESC 1009 #define IDC_STATICDESC 1009
#define IDC_STATICADDRESS 1010 #define IDC_STATICADDRESS 1010
#define IDC_PROGRESS 1011 #define IDC_PROGRESS 1011
#define IDC_EDITCHATDISPLAY 1012
#define IDC_EDITCHATINPUT 1013
#define IDC_BUTTONSEND 1014
#define IDC_BUTTONDISCONNECT 1015
#define ID_FILE_EXIT 40001 #define ID_FILE_EXIT 40001
#define ID_HELP_ABOUT 40002 #define ID_HELP_ABOUT 40002
@ -22,9 +27,9 @@
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 109 #define _APS_NEXT_RESOURCE_VALUE 111
#define _APS_NEXT_COMMAND_VALUE 40003 #define _APS_NEXT_COMMAND_VALUE 40003
#define _APS_NEXT_CONTROL_VALUE 1012 #define _APS_NEXT_CONTROL_VALUE 1016
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif

View File

@ -29,6 +29,10 @@ namespace wc {
ConnDlgInput* input = new ConnDlgInput{ this, xPos, yPos }; ConnDlgInput* input = new ConnDlgInput{ this, xPos, yPos };
DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOGCONNECTING), nullptr, reinterpret_cast<DLGPROC>(connDlgProc), reinterpret_cast<LPARAM>(input)); DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOGCONNECTING), nullptr, reinterpret_cast<DLGPROC>(connDlgProc), reinterpret_cast<LPARAM>(input));
//If we're connected, open the chat window
if (m_connected)
DialogBoxParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOGCHAT), nullptr, reinterpret_cast<DLGPROC>(chatDlgProc), reinterpret_cast<LPARAM>(this));
netThread.join(); netThread.join();
} }
@ -127,6 +131,24 @@ namespace wc {
return FALSE; return FALSE;
} }
BOOL CALLBACK Chat::chatDlgProc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam) {
static Chat* chat = nullptr;
switch (msg) {
case WM_INITDIALOG:
chat = reinterpret_cast<Chat*>(lParam);
SetWindowText(dlg, std::format(L"remote screenname at {} - WinChat", chat->m_address).c_str());
SendMessage(dlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICONMAIN))));
return TRUE;
case WM_CLOSE:
EndDialog(dlg, 0);
return TRUE;
}
return FALSE;
}
Chat::~Chat() { Chat::~Chat() {

View File

@ -15,6 +15,7 @@ namespace wc {
void runNetThread(); void runNetThread();
std::wstring getErrorString(); std::wstring getErrorString();
static BOOL CALLBACK connDlgProc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam); static BOOL CALLBACK connDlgProc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam);
static BOOL CALLBACK chatDlgProc(HWND dlg, UINT msg, WPARAM wParam, LPARAM lParam);
const std::wstring m_address; const std::wstring m_address;
const std::wstring m_screenname; const std::wstring m_screenname;