我们是学习计算机的,我的一个实习是用API做一个Windows的窗口
我不会用API做Windows的窗口,请问什么做啊
WinMain 和WndProc 函数该怎么用啊??
我不会用API做Windows的窗口,请问什么做啊
WinMain 和WndProc 函数该怎么用啊??
解决方案 »
- 向services.exe注入远程线程失败,拒绝访问,求解决方法
- 关于TCP直连的问题,附源代码
- 大牛们好,windows编程RegisterClass()返回为0,感觉好诡异~~~~
- 关于dialogbar的使用
- 有变量double x,double y,int z,问怎样把x/y(x除以y)的结果转换成int类型再赋给变量z。
- 求使用Rawsocket发送UDP和TCP包的范例,谢谢。
- 关于局域网象棋游戏的编程,进则有分
- 输入的浮点数、双精度数与得到的结果不一致,为什么?
- 真诚发问:SDK编程中如何改变一个对话框中的ListBox控件的背景颜色?
- 在两个字段中的组合查询,什么方式查询最快?(SQL Server2000),定义索引的种类的区别呢?(30万条记录中),字段类型用Char、VarChar或Int哪一种更好?
- 《Windows程序设计》中视口和窗口的问题
- windows消息机制的基础问题
simpwin.c程序如下#include <windows.h>
#include <string.h>
#include "simpwin.h"HINSTANCE hInst;
HWND hWndMain;int APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{
MSG msg;
if(!InitApplication(hInstance))
return(FALSE); if(!InitInstance(hInstance,nCmdShow))
return(FALSE); while(GetMessage(&msg,NULL,0,0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
} return (msg.wParam);
}BOOL InitApplication(HINSTANCE hInstance)
{
WNDCLASS wcSimpwin;
wcSimpwin.style = 0;
wcSimpwin.lpfnWndProc = (WNDPROC)MainWndProc;
wcSimpwin.cbClsExtra = 0;
wcSimpwin.cbWndExtra = 0;
wcSimpwin.hInstance = hInstance;
wcSimpwin.hIcon = NULL;
wcSimpwin.hCursor = NULL;
wcSimpwin.hbrBackground = GetStockObject(WHITE_BRUSH);
wcSimpwin.lpszMenuName = NULL;
wcSimpwin.lpszClassName = "SimpwinWClass"; return (RegisterClass(&wcSimpwin));
}
BOOL InitInstance(HINSTANCE hInstance,int nCmdShow)
{
hInst = hInstance;
hWndMain = CreateWindow("SimpwinWClass","我的第一个窗口",WS_OVERLAPPEDWINDOW,0,0,400,400,NULL,NULL,hInstance,NULL);
if(!hWndMain)
{
return(FALSE);
} ShowWindow(hWndMain,nCmdShow);
UpdateWindow(hWndMain);
return(TRUE);
}LRESULT CALLBACK MainWndProc(HWND hWnd,UINT message,WPARAM wParam,LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps; switch(message)
{
case WM_PAINT:
hdc = BeginPaint(hWnd,&ps);
TextOut(hdc,20,10,hello,lstrlen(hello));
EndPaint(hWnd,&ps);
break; case WM_DESTROY:
PostQuitMessage(0);
break; default:
return(DefWindowProc(hWnd,message,wParam,lParam));
} return(0);
}
simpwin.h程序如下LRESULT CALLBACK MainWndProc(HWND,UINT,WPARAM,LPARAM);
BOOL InitApplication(HINSTANCE);
BOOL InitInstance(HINSTANCE,int);char *hello = "窗口外的世界很精彩,窗口内的天地也很奇妙";