最简单的方法是用vc6新建一个Win32 Application空工程,然后添加一个cpp文件,输入
![26ad3577b5019ad8e7201a982354cdd5.png](https://i-blog.csdnimg.cn/blog_migrate/635a3511b86058072b9293cf99301438.jpeg)
(注意添加对话框资源,并且在对话框上添加一个文本框)
#include#include "resource.h"// DialogProc, 枚举窗口对话框过程.int CALLBACK DialogProc( HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam){switch(uMsg){case WM_INITDIALOG:{SendDlgItemMessage(hdlg,IDC_EDIT1,EM_REPLACESEL,0,(long)"文本......");}break;case WM_DESTROY: break;case WM_COMMAND:switch(LOWORD(wParam)){case IDCANCEL:case IDOK:{// DestroyWindow(hdlg);EndDialog(hdlg,0);} break;default: break; // switch(LOWORD(wParam))} break; // case WM_COMMAND:} // switch(uMsg)return false;}int WINAPI WinMain(HINSTANCE hInst, HINSTANCE,LPSTR,int){// HWND hDialog=CreateDialog(hInst,(LPCTSTR)IDD_DIALOG1,0L,DialogProc);return DialogBox(hInst,(LPCTSTR)IDD