• Help: how to draw on a monitor that is not part of Desktop?

    From vanhoabku97@gmail.com@21:1/5 to All on Sat Sep 29 00:26:21 2018
    Vào 15:30:27 UTC+7 Thứ Sáu, ngày 03 tháng 9 năm 2004, Rhett Gong [MSFT] đã viết:
    Hi Marc,
    From your description, I feel unsure what type of monitor you are trying to draw on. Could you try following code, post what it outputs in this thread and point out which monitor you are going to draw please? //-------------------------------------------------------------------------- ----
    int _tmain(int argc, _TCHAR* argv[])
    {
    BOOL bRet = FALSE;
    DWORD dwNum =0;
    vector< DISPLAY_DEVICE> dispVec;

    do {
    DISPLAY_DEVICE disp;
    disp.cb = sizeof( DISPLAY_DEVICE );
    bRet = EnumDisplayDevices(NULL,dwNum,&disp,0);
    if( bRet)
    dispVec.push_back(disp);
    dwNum++;
    } while(bRet);

    vector<DISPLAY_DEVICE>::iterator it = dispVec.begin();
    vector<DISPLAY_DEVICE>::iterator it_end = dispVec.end();

    cout<<endl<<"* * * * * * Enumerate Monitor Devices * * * * * *"<<endl;
    for ( ; it != it_end ; it++ )
    {

    cout<<"********************************************************************* ****"<<endl;
    cout<<"DeviceName:\t" <<(*it).DeviceName << endl;
    cout<< "DeviceString:\t"<<(*it).DeviceString << endl;
    cout<<"StateFlag:\t"<<hex<<(*it).StateFlags<<endl;
    cout<<"DeviceID:\t" <<(*it).DeviceID<<endl;
    // code to obtain the monitor name
    DISPLAY_DEVICE monInfo;
    monInfo.cb = sizeof( DISPLAY_DEVICE );
    if (EnumDisplayDevices(dispVec[0].DeviceName,0,&monInfo,0))
    {
    cout<< "Monitor name is :"<< monInfo.DeviceString <<endl;
    }

    cout<<"********************************************************************* ****"<<endl;
    }

    //.......Cleanup ...
    } //-------------------------------------------------------------------------- -------

    Best regards,
    Rhett Gong [MSFT]
    Microsoft Online Partner Support

    This posting is provided "AS IS" with no warranties, and confers no rights. Please reply to newsgroups only. Thanks.

    Hi Rhett, I copy your code and built on visual studio 2017, but it had many errors ( identifier "vector" is undefined,identifier "dispVec" is undefined, expected a ;,...). what header I have to include?
    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)