Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to displaybitmap on second monitor?

How to displaybitmap on second monitor?

Scheduled Pinned Locked Moved C / C++ / MFC
questiongraphicsarchitectureperformancetutorial
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Soumyadipta
    wrote on last edited by
    #1

    I have attached two monitors two my system. Now i want to display a bitmap image on my second monitor.I am able to display a solid fill blue rectangle and able to display a text on it. How can send a bitmap image? Is it possible to send the raw image data without using the BITMAP? Below is the code:int count = 0; void CMonitorTestDlg::OnBnClickedButtonFlashAll() { CMonitor monitor; CMonitors monitors; CString cstr[2]; for ( int i = 0; i < monitors.GetCount(); i++ ) { count = i+1; monitor = monitors.GetMonitor( i ); FlashMonitor( monitor); Sleep( 500 ); } } void CMonitorTestDlg::FlashMonitor( CMonitor& monitor, bool WorkSpace) { CRect rect; if ( WorkSpace ) //get the work area rect of the monitor this window is on monitor.GetWorkAreaRect( &rect ); else monitor.GetMonitorRect( &rect ); CMonitorDC dc( &monitor ); if(count ==1) { // create and select a solid blue brush CBrush brushBlue(RGB(0, 255, 0)); CBrush* pOldBrush = dc.SelectObject(&brushBlue); rect.DeflateRect(200,200); dc.Rectangle(&rect); COLORREF clr1 = RGB(0,0,0); dc.SetTextColor(clr1); dc.DrawText("Primary Monitor",17,&rect,1); // put back the old objects dc.SelectObject(pOldBrush); } else { // create and select a solid blue brush /*CBrush brushBlue(RGB(0, 0, 255)); CBrush* pOldBrush = dc.SelectObject(&brushBlue); rect.DeflateRect(200,200); dc.Rectangle(&rect); COLORREF clr1 = RGB(0,0,0); dc.SetTextColor(clr1); dc.DrawText("Secondary Monitor",17,&rect,1); // put back the old objects dc.SelectObject(pOldBrush);*/ /*How can i send a bitmap image or a image buffer to second monitor.I have tried to use Bltblt but create compatibleDc need a CDC object not the CMonitor dc.*/ } Sleep( 2000 ); ::InvalidateRect( NULL, &rect, TRUE ); }
    Code that i have tried to send a bitmap // load IDB_BITMAP1 from our resources CBitmap bmp; if (bmp.LoadBitmap(IDB_BITMAP1)) { // Get the size of the bitmap BITMAP bmpInfo; bmp.GetBitmap(&bmpInfo); // Create an in-memory DC compatible with the // display DC we're using to paint CDC dcMemory; //dcMemory.CreateCompatibleDC(dc); // Cant do this CMonitorDC * to CDC * // Select the bitmap into the in-memory DC CBitmap* pOldBitmap = dcMemory.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups