我想实现一个项目,
在Dialog中设置两个单选按钮(单屏, 双屏),
当调用新的窗口是   单选->就在当前屏幕显示
双屏->就在另外一个显示器上显示

解决方案 »

  1.   

    EnumDisplayDevices EnumDisplayMonitors
    详看MSDN
    In order to query all display devices in the system, call this function in a loop, starting with iDevNum set to 0, and incrementing iDevNum until the function fails.
    Code Examples
    To paint in response to a WM_PAINT message, using the capabilities of each monitor, you can use code like the following in a window procedure: 
    case WM_PAINT:
        hdc = BeginPaint(hwnd, &ps);
        EnumDisplayMonitors(hdc, NULL, MyPaintEnumProc, 0);
        EndPaint(hwnd, &ps); 
    To paint the upper half of a window using the capabilities of each monitor, you can use code like the following:
    GetClientRect(hwnd, &rc);
    rc.bottom = (rc.bottom - rc.top) / 2;
    hdc = GetDC(hwnd);
    EnumDisplayMonitors(hdc, &rc, MyPaintEnumProc, 0);
    ReleaseDC(hwnd, hdc);
     
    To paint the entire screen optimally for each display monitor, you can use code like the following:
    hdc = GetDC(NULL);
    EnumDisplayMonitors(hdc, NULL, MyPaintScreenEnumProc, 0);
    ReleaseDC(NULL, hdc);
     
    To get information about all the display monitors, you can use code like the following:
    EnumDisplayMonitors(NULL, NULL, MyInfoEnumProc, 0);