QuakeGod
2021-11-30 0ed43835e6bf40ba4d31fb6b8dc0d8400162b90a
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#include "StdAfx.h"
#include "InputDialog.hpp"
 
 
CInputDialog::CInputDialog(void)
{
    IsPassword=0;
 
    hbl=new BYTE[1024];
 
    int n,m;
    dltt=(LPDLGTEMPLATE)hbl;
    dltt->style=WS_POPUP|WS_BORDER|WS_SYSMENU|DS_MODALFRAME|
        WS_CAPTION|DS_SETFONT;
    dltt->dwExtendedStyle=0;
    dltt->cdit=1;
    dltt->x=10;
    dltt->y=10;
    dltt->cx=100;
    dltt->cy=100;
    /* ¶Ô»°¿ò±ß³¤Êý×é */;
    LPWORD lpw=(LPWORD)(dltt+1);
    *lpw++=0x0000;    //ûÓв˵¥
    *lpw++=0x0000;        //ʹÓÃϵͳĬÈÏÀà
    n = MultiByteToWideChar(CP_ACP,0,"¶Ô»°¿ò±êÌâÃû³Æ",-1,(LPWSTR)lpw,50);
    lpw+=n;
    *lpw++=9;            //×ÖÌå´óС
    m = MultiByteToWideChar(CP_ACP,0,"ËÎÌå",-1,(LPWSTR)lpw,50);
    lpw++;
    lpw+=m;
 
    /* °´Å¥¿Ø¼þ */
    lpw=(LPWORD)((((ULONG)lpw+3)>>2)<<2);
    dlit=(LPDLGITEMTEMPLATE)lpw;
    dlit->dwExtendedStyle=0;
    dlit->x=10;
    dlit->y=70;
    dlit->cx=80;
    dlit->cy=20;
    dlit->id=IDOK;        //OK°´Å¥±êʶ
    dlit->style=WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON;//°´Å¥¿Ø¼þ´°¿Ú·ç¸ñ
    lpw=(LPWORD)(dlit+1);    //Òƶ¯Ö¸Õ룬ʹÆäÖ¸ÏòDLGITEMTEMPPLATE½á¹¹µÄÏÂÒ»¸öÄÚ´æµ¥Ôª
    /* ¿Ø¼þ±ä³¤Êý×é */
    *lpw++ = 0xffff;
    *lpw++ = 0x0080;
    n=MultiByteToWideChar(CP_ACP,0,"È·¶¨",-1,(LPWSTR)lpw,10);
//    HINSTANCE hinst = theApp.m_hInstance;
    /* ´´½¨¶Ô»°¿ò´°¿Ú */
//    CDialog dialog1;
    InitModalIndirect((LPDLGTEMPLATE)hbl);
    //    LRESULT ret = DialogBoxIndirect(hinst,(LPDLGTEMPLATE)hbl,NULL,(DLGPROC)DlgProc);
//    dialog1.DoModal();
    /* ÊÍ·Å×ÊÔ´ */
 
    //    return ret;
}
 
 
CInputDialog::~CInputDialog(void)
{
    delete [] hbl;
    hbl = NULL;
}
 
 
BOOL CInputDialog::OnInitDialog()
{
    CDialog::OnInitDialog();
 
    // TODO:  ÔÚ´ËÌí¼Ó¶îÍâµÄ³õʼ»¯
    RECT rect1;
    rect1.left=10;
    rect1.top=10;
    rect1.right=200;
    rect1.bottom=26;
    m_static_hint.Create(HintStr,WS_VISIBLE,rect1,this);
//    m_static_hint.ShowWindow(SW_SHOW);
 
    rect1.left=10;
    rect1.top=40;
    rect1.right=200;
    rect1.bottom=64;
    DWORD style=WS_VISIBLE;
    if (IsPassword) {style|=ES_PASSWORD;}
    m_edit_input.Create(style,rect1,this,999);
 
    return TRUE;  // return TRUE unless you set the focus to a control
    // Òì³£: OCX ÊôÐÔÒ³Ó¦·µ»Ø FALSE
}
 
 
void CInputDialog::OnOK()
{
    // TODO: ÔÚ´ËÌí¼ÓרÓôúÂëºÍ/»òµ÷ÓûùÀà
    m_edit_input.GetWindowText(InputStr);
 
    CDialog::OnOK();
}