解决方案 »
- cdc 的lineto问题
- 使用Jmp的办法HOOK API的时候必须要用WriteProcessMemory吗
- VC中用什么办法可以实现能够加载gif,bmp,ico,png,jpg图像,并且将它的句柄放到HBITMAP中返回
- 如何用SDK实现状态栏,就是一般窗口底部的那行
- 窗口绘图问题
- 用win sdk函数怎么样才能把bitmap贴到指定位置,tks
- 关于消息顺序:1.先post的消息一定先到达消息队列吗?2.先到达的消息一定会先被处理吗?
- VC中有用表格方式输入数据的方法吗
- 请教一下win32 sdk中的一个字符串操作函数
- 本人初学用VC数据库编成,觉得非常困难,你们都用什么方法编程?
- 求教如何用socket实现跨局域网如何通信???
- --------自己写的一个MFC ActiveX控件,用Dialog程序插入控件,VS会关闭------
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
INT iCmdShow)
{
WNDCLASS wndclass;
HWND hwnd;
MSG msg;
TCHAR szAppName[] = TEXT("SystemTool"); wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName; if (!RegisterClass(&wndclass))
{
MessageBox(NULL, TEXT("Register window class failed!"), szAppName, MB_ICONERROR);
return 0;
} hwnd = CreateWindowEx ( WS_EX_CLIENTEDGE, // extended window style
szAppName, // pointer to registered class name
TEXT("System Manager"), // pointer to window name
WS_OVERLAPPEDWINDOW | WS_VSCROLL, // window style
CW_USEDEFAULT, // horizontal position of window
CW_USEDEFAULT, // vertical position of window
CW_USEDEFAULT, // window width
CW_USEDEFAULT, // window height
NULL, // handle to parent or owner window
NULL, // handle to menu, or child-window identifier
hInstance, // handle to application instance
NULL ); // pointer to window-creation data
ShowWindow(hwnd, iCmdShow);
UpdateWindow(hwnd); while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
} return msg.wParam;
}
LRESULT CALLBACK WndProc(
HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
HDC hdc;
PAINTSTRUCT ps; int i;
POINT apt[1000]; switch(message)
{ case WM_CREATE:
return 0; case WM_PAINT:
hdc = BeginPaint(hwnd, &ps); for ( i = 0; i < 1000; i++ );
{
apt[i].x = 1;
apt[i].y = 1;
}
//Polyline(hdc, apt, 1000); EndPaint(hwnd, &ps);
return 0; case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
{
apt[i].x = 1;
apt[i].y = 1;
}问题在这里
int i; for ( i = 0; i < 1000; i++ )
{
apt[i].x = (LONG) 1;
apt[i].y = (LONG) 1;
}
数组不超界,但apt[i].y = (LONG) 1;后,x,y似乎没变+[0] {x=1237068 y=1376256} tagPOINT
+[1] {x=2090243428 y=1376256} tagPOINT
囧,你看你的for后面还有一个;不出问题才真叫奇怪~