Thread: Problem with desktop snapshot taking

  1. #1
    Registered User cfrost's Avatar
    Join Date
    Apr 2004
    Posts
    119

    Question Problem with desktop snapshot taking

    Well i created a program to capture window desktop MainWnd class encapsulates 2 member vars

    1-dw
    boolean flag indicating that the window created by app is for drawing
    2-pw
    indicating app that current window is parent window

    Now in my Paint function i have done this

    void MainWnd::OnPaint(){
    //going to draw bmp only when it is dw and not pw
    if(dw && !pw){
    CDC dskTop;
    CBitmap img;

    CWnd *DTW=GetDesktopWindow(); //obtained desktop window
    dskTop.CreateCompatibleDC(DTW->GetDC()); //made compatible dc
    img.CreateCompatibleBitmap(DTW->GetDC(),WinSize.cx,WinSize.cy); //made comp bmp
    dskTop.SelectObject(&img); //selected bmp

    dskTop.BitBlt(0,0,WinSize.cx,WinSize.cy,DTW->GetDC(),0,0,SRCCOPY); //blitted

    CPaintDC dc(this); //time to draw
    dc.CreateCompatibleDC(&dskTop); /*same thing happens even i don`t include this line*/

    dc.BitBlt(0,0,WinSize.cx,WinSize.cy,&dskTop,0,0,SR CCOPY); //blitted on paintdc
    }
    }

    but the screen appeares white

    Also i want a some help to save CBitmap to a file

  2. #2
    Registered User cfrost's Avatar
    Join Date
    Apr 2004
    Posts
    119
    Well i found problem any how i need a complete tutorial to minimize window to system tray ASAP

  3. #3
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    >>Well i found problem any how i need a complete tutorial to minimize window to system tray ASAP

    Well I did a quick search and it seems this has been covered many times before. Here's something at MSDN that might be helpful:
    http://msdn.microsoft.com/library/de...notifyicon.asp

    Never done this myself and I didn't find any tutorials, sorry
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  4. #4
    Registered User cfrost's Avatar
    Join Date
    Apr 2004
    Posts
    119
    how can i save a CBitmap to bmp

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. desktop problem...
    By limitmaster in forum Tech Board
    Replies: 2
    Last Post: 08-01-2006, 09:47 AM
  2. GTK+ Gnome desktop system tray app problem
    By BobS0327 in forum Linux Programming
    Replies: 2
    Last Post: 04-01-2006, 09:54 PM
  3. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM
  4. Showing Desktop SW_DEFAULT
    By Yuri in forum Windows Programming
    Replies: 6
    Last Post: 11-20-2005, 01:28 PM
  5. Replies: 5
    Last Post: 11-07-2005, 11:34 PM