Add support for changing the InputBox's title to the description text provided by the game(or the emulator itself). If none is provided(empty string), fall back to a default string.

This commit is contained in:
The Dax
2013-08-05 23:17:26 -04:00
parent 22bceea46c
commit 1da0454508
3 changed files with 29 additions and 8 deletions
+12
View File
@@ -4,12 +4,14 @@
static TCHAR textBoxContents[256];
static TCHAR out[256];
static TCHAR windowTitle[256];
static INT_PTR CALLBACK InputBoxFunc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_INITDIALOG:
SetWindowText(GetDlgItem(hDlg,IDC_INPUTBOX),textBoxContents);
SetWindowText(hDlg, windowTitle);
return TRUE;
case WM_COMMAND:
switch (wParam)
@@ -51,11 +53,21 @@ bool InputBox_GetString(HINSTANCE hInst, HWND hParent, TCHAR *title, TCHAR *defa
bool InputBox_GetString(HINSTANCE hInst, HWND hParent, TCHAR *title, TCHAR *defaultvalue, TCHAR *outvalue, u32 outlength)
{
const char *defaultTitle = "Input value";
if (defaultvalue && strlen(defaultvalue)<255)
strcpy(textBoxContents,defaultvalue);
else
strcpy(textBoxContents,"");
if(title && strlen(title) <= 0)
strcpy(windowTitle, defaultTitle);
else if(title && strlen(title) < 255)
strcpy(windowTitle, title);
else
strcpy(windowTitle, defaultTitle);
if (IDOK==DialogBox(hInst,(LPCSTR)IDD_INPUTBOX,hParent,InputBoxFunc))
{
strncpy(outvalue, out, outlength);