Skip to content

Commit f86d275

Browse files
authored
Merge pull request bruderstein#177 from chcg/issue_176
Issue 176
2 parents 222f497 + 78bedb5 commit f86d275

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

PythonScript/res/PythonScript.rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1
115115
BEGIN
116116
DEFPUSHBUTTON "OK",IDOK,205,84,50,14
117117
PUSHBUTTON "Cancel",IDCANCEL,256,84,50,14
118-
LTEXT "Static",IDC_PROMPT,7,7,299,19
118+
LTEXT "Static",IDC_PROMPT,7,7,299,19,SS_NOPREFIX
119119
EDITTEXT IDC_USERTEXT,7,29,299,46,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL
120120
END
121121

PythonScript/src/PromptDialog.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "PromptDialog.h"
44
#include "resource.h"
55
#include "Notepad_Plus_msgs.h"
6+
#include "WcharMbcsConverter.h"
67

78
PromptDialog::PromptDialog(HINSTANCE hInst, HWND hNotepad)
89
: m_hInst(hInst),
@@ -62,9 +63,9 @@ INT_PTR CALLBACK PromptDialog::runDlgProc(HWND hWnd, UINT message, WPARAM wParam
6263
{
6364
SendMessage(m_hNotepad, NPPM_MODELESSDIALOG, MODELESSDIALOGADD, reinterpret_cast<LPARAM>(hWnd));
6465
m_hSelf = hWnd;
65-
::SetWindowTextA(::GetDlgItem(m_hSelf, IDC_PROMPT), m_prompt.c_str());
66-
::SetWindowTextA(m_hSelf, m_title.c_str());
67-
::SetWindowTextA(::GetDlgItem(m_hSelf, IDC_USERTEXT), m_initial.c_str());
66+
::SetWindowText(::GetDlgItem(m_hSelf, IDC_PROMPT), WcharMbcsConverter::char2tchar(m_prompt.c_str()).get());
67+
::SetWindowText(m_hSelf, WcharMbcsConverter::char2tchar(m_title.c_str()).get());
68+
::SetWindowText(::GetDlgItem(m_hSelf, IDC_USERTEXT), WcharMbcsConverter::char2tchar(m_initial.c_str()).get());
6869
::SendMessage(::GetDlgItem(m_hSelf, IDC_USERTEXT), EM_SETSEL, 0, -1);
6970
SetFocus(::GetDlgItem(m_hSelf, IDC_USERTEXT));
7071

@@ -90,9 +91,9 @@ INT_PTR CALLBACK PromptDialog::runDlgProc(HWND hWnd, UINT message, WPARAM wParam
9091
{
9192
case IDOK:
9293
{
93-
char buffer[1000];
94-
::GetWindowTextA(::GetDlgItem(m_hSelf, IDC_USERTEXT), buffer, 1000);
95-
m_value = buffer;
94+
TCHAR buffer[1000];
95+
::GetWindowText(::GetDlgItem(m_hSelf, IDC_USERTEXT), buffer, 1000);
96+
m_value = WcharMbcsConverter::tchar2char(buffer).get();
9697
m_result = RESULT_OK;
9798
}
9899
//lint -fallthrough

0 commit comments

Comments
 (0)