本帖最后由 nine8 于 2011-02-28 00:43:51 编辑

解决方案 »

  1.   

    但是把这块注释掉就没问题啦,而且只有这块用到这个apt
      

  2.   

    这个是完整的代码:#include <windows.h>
    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);
    }
      

  3.   

    俺机器上装vc6和2008,vc6就正常,2008跟你说的一样。
      

  4.   

                for ( i = 0; i < 1000; i++ );
                {
                    apt[i].x = 1;
                    apt[i].y = 1;
                }问题在这里
      

  5.   

    有点不清楚,看见for循环后面那个  ;     了吧。
      

  6.   

    我用2005:  POINT apt[1000];
     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
      

  7.   

    for ( i = 0; i < 1000; i++ );
    囧,你看你的for后面还有一个;不出问题才真叫奇怪~