我用的VC++6.0 用win32 api 创建文本输入区要怎么做?

 我来答
chengaohe0120
2009-11-27 · TA获得超过982个赞
知道小有建树答主
回答量:1034
采纳率:50%
帮助的人:958万
展开全部
#include <windows.h>
#include "Shlwapi.h"
#pragma comment(linker,"/subsystem:windows");
#define EditID 1
#define ButtonID 2
LRESULT CALLBACK WinSunProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPreInstance,PTSTR szCmdLine,int iCmdShow)
{
WNDCLASS wndcls;
wndcls.cbClsExtra=0;
wndcls.cbWndExtra=0;
wndcls.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
wndcls.hCursor=LoadCursor(NULL,IDC_ARROW);
wndcls.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wndcls.hInstance=hInstance;
wndcls.lpfnWndProc=WinSunProc;
wndcls.lpszClassName="windows";
wndcls.lpszMenuName=NULL;
wndcls.style=CS_HREDRAW | CS_VREDRAW;
RegisterClass(&wndcls);
HWND hwnd;
hwnd=CreateWindow("windows","Make By chengaohe0120",WS_OVERLAPPEDWINDOW,
0,0,300,150,NULL,NULL,hInstance,NULL);
ShowWindow(hwnd,SW_SHOWNORMAL);
UpdateWindow(hwnd);
MSG msg;
while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}
LRESULT CALLBACK WinSunProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
HWND hEdit;
HWND hButton;
CHAR wStr[1024]="0";
switch(uMsg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_CREATE:

hEdit=CreateWindowEx(NULL,"Edit",NULL,WS_CHILD|WS_VISIBLE|WS_BORDER,10,30,120,25,hwnd,HMENU(EditID),NULL,NULL);
hButton=CreateWindowEx(NULL,"button","确定",WS_CHILD|WS_VISIBLE|WS_BORDER,120,30,60,25,hwnd,HMENU(ButtonID),(HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE), NULL);
case WM_COMMAND:
if ((lParam!=0)&&((wParam&0xffff)==ButtonID))
{
GetDlgItemText(hwnd,EditID,wStr,1024);
if (StrCmp(wStr,"123456"))
{
MessageBox(NULL,"密码错误!",NULL,MB_OK);
}
else
{
MessageBox(NULL,"密码正确","恭喜",MB_OK);
}

}
default:
return DefWindowProc(hwnd,uMsg,wParam,lParam);
}
return 0;
}

分分,分
函凌霜Nr
2009-11-26 · TA获得超过110个赞
知道答主
回答量:121
采纳率:0%
帮助的人:126万
展开全部
createwindow
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式