Solved

desktop image capturing??

Posted on 1998-09-18
8
282 Views
Last Modified: 2013-12-03
I am doing a final year project to remotely access and control the desktop of a separate computer to the
one I am working on ( something like PcAnywhere ).

What would be the best way of capturing the current image on the desktop of the remote computer into some kind of bit map??

Also if you know where I can find information on the functions contained in the DirectDraw part of
DirecttX 5.0, I would be very grateful??
0
Comment
Question by:ross_nolan
8 Comments
 
LVL 6

Expert Comment

by:thresher_shark
ID: 1414553
What language are you programming in?  If you are using MFC, look into CBitmap and BitBlt.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1414554
You could do this with DirectDraw (if you need infos, download directX SDK from www.microsoft.com). But I think that could be managed with "normal" functions like BitBlt, too.
BTW, PcAnywhere only transfers the first bitmap as a bitmap. After that it transfers something like GDI commands, I guess. Probably you know that, just wanted to mention that. Have you solved this problem already? That seems to be the more difficult one...

Regards, Madshi.
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1414555
I don't know what programming environment are you using but here is how.//
this code is for Delphi...
var
   DC : hDC;
   H : HWND;
begin
  H := GetDesktopWindow;
  DC := GetDC(H);
  BitBlt(Image1.Canvas.Handle, 0, 0, Width, height, DC, 0, 0, SRCCOPY);
  ReleaseDC(H, DC);
end;

Let me examplain the parameters...

H is decalred as a Handle
DC is declared as a Device Context

H := GetDesktopWindow;//This gets the handle of the Desktop..API call

DC := GetDC(H);//This gets the Device Context of the Desktop...API call

BitBlt(Image1.Canvas.Handle, 0, 0, Width, height, DC, 0, 0, SRCCOPY);
//BitBlt is an API call so you can see the API help file for that..
//On the place of the Image1.Canvas.Handle put the Handle to the Bitmap Canvas' Handle

ReleaseDC(H, DC);//This releases the Device Context...

Regards,
Viktor Ivanov
0
 

Author Comment

by:ross_nolan
ID: 1414556
I am just starting the research into this project and I considering doing the application in Visual C++ or maybe VB,  but my preference is VC.

Any additional information that you can give as guidence would be appriciated very much in relation to these programming environments.

cheers

0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 10

Expert Comment

by:viktornet
ID: 1414557
Yes you can use all of that in your VC app since these all are an API calls...

It would be something like this in VC

{
        HDC DC;
        HWND H; //I don't know how to declare handles in VC..maybe HWND is not the right type
       H := GetDesktopWindow(); //API call
       DC := GetDC(H);//API call
       BitBlt(Image1->Canvas->Handle, 0, 0, Width, Height, DC, 0, 0, SRCCOPY); //API call
       ReleaseDC(H, DC); //API call
}

Where it says Image1->Canvas->Handle you need to give the Handle to the Bitmap's or whatever it is,  Handle......

//Viktor Ivanov
0
 

Author Comment

by:ross_nolan
ID: 1414558
could you please specify what dll's used would I be using??

thanks

ross
0
 
LVL 10

Accepted Solution

by:
viktornet earned 120 total points
ID: 1414559
Here are all the APIs that I've used and their declarations in C as well as the DLLs that they come form......
//---------------------------------------------------------
HWND GetDesktopWindow(VOID); ---> user32.dll
//---------------------------------------------------------
HDC GetDC(HWND hWnd); --->  user32.dll
//---------------------------------------------------------
int ReleaseDC(

    HWND hWnd,      // handle of window
    HDC hDC       // handle of device context  
   ); ---> user32.dll
//---------------------------------------------------------
BOOL BitBlt(

    HDC hdcDest,      // handle to destination device context
    int nXDest,      // x-coordinate of destination rectangle's upper-left corner
    int nYDest,      // y-coordinate of destination rectangle's upper-left corner
    int nWidth,      // width of destination rectangle
    int nHeight,      // height of destination rectangle
    HDC hdcSrc,      // handle to source device context
    int nXSrc,      // x-coordinate of source rectangle's upper-left corner  
    int nYSrc,      // y-coordinate of source rectangle's upper-left corner
    DWORD dwRop       // raster operation code
   ); ---> gdi32.dll
//---------------------------------------------------------

Regards,
Viktor Ivanov
0
 

Author Comment

by:ross_nolan
ID: 1414560
most appriciated

cheers
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now