Board index » delphi » Help with screen capture utility

Help with screen capture utility

All,

I am looking for a small, stand-alone Windows command-line executable
that will simply capture the current desktop to a designated file. The
executable would be invoked as follows: screencap <filename> where
<filename> is the path to a .BMP file to be created or overwritten.
The purpose of this utility would simply to capture the current
desktop for help desk use when a user problem arises. I found sample
code at the following location:
http://www.delphifaq.com/fq/q2030.shtml

However, I am not a Delphi programmer. Would one of you experts be
willing to compile the code to a .exe and mail it to me?

Sincerely,

pd...@yahoo.com

 

Re:Help with screen capture utility


I've made it, and uploaded it to my webserver at
http://www.248th.com/viper/nick/screenie.exe (So everyone can download it
:)).

Cheers,
Nicholas Sherlock

Quote
"Peter Walter" <pwal...@itlsys.com> wrote in message

news:c48ae190.0209261747.710ef80b@posting.google.com...
Quote
> All,

> I am looking for a small, stand-alone Windows command-line executable
> that will simply capture the current desktop to a designated file. The
> executable would be invoked as follows: screencap <filename> where
> <filename> is the path to a .BMP file to be created or overwritten.
> The purpose of this utility would simply to capture the current
> desktop for help desk use when a user problem arises. I found sample
> code at the following location:
> http://www.delphifaq.com/fq/q2030.shtml

> However, I am not a Delphi programmer. Would one of you experts be
> willing to compile the code to a .exe and mail it to me?

> Sincerely,

> pd...@yahoo.com

Re:Help with screen capture utility


Quote
"Nicholas Sherlock" <n_sherl...@hotmail.com> wrote in message

news:an0v68$mt4$1@lust.ihug.co.nz...

Quote
> I've made it, and uploaded it to my webserver at
> http://www.248th.com/viper/nick/screenie.exe (So everyone can download it
> :)).

This works well.  Is it possible to save the file in JPG format, since those
files are about 10% the size of BMP files, and thus much easier to send via
email?

Re:Help with screen capture utility


Quote
"Bob Richardson" <b...@pleasenospam.whidbey.com> wrote in message

news:up8s873ui0akdf@corp.supernews.com...

Quote

> "Nicholas Sherlock" <n_sherl...@hotmail.com> wrote in message
> news:an0v68$mt4$1@lust.ihug.co.nz...
> > I've made it, and uploaded it to my webserver at
> > http://www.248th.com/viper/nick/screenie.exe (So everyone can download
it
> > :)).

> This works well.  Is it possible to save the file in JPG format, since
those
> files are about 10% the size of BMP files, and thus much easier to send
via
> email?

Woops!  A BMP file of my desktop is 3,981kb while the JPG is only
120kb....only 3% of the size.  I see this as a good way for beta testers and
others to send problem reports via email.

Re:Help with screen capture utility


Quote
"Bob Richardson" <b...@pleasenospam.whidbey.com> wrote in message

news:up8uqpcub2c083@corp.supernews.com...

Quote

> "Bob Richardson" <b...@pleasenospam.whidbey.com> wrote in message
> news:up8s873ui0akdf@corp.supernews.com...

> > "Nicholas Sherlock" <n_sherl...@hotmail.com> wrote in message
> > news:an0v68$mt4$1@lust.ihug.co.nz...
> > > I've made it, and uploaded it to my webserver at
> > > http://www.248th.com/viper/nick/screenie.exe (So everyone can download
> it
> > > :)).

> > This works well.  Is it possible to save the file in JPG format, since
> those
> > files are about 10% the size of BMP files, and thus much easier to send
> via
> > email?

> Woops!  A BMP file of my desktop is 3,981kb while the JPG is only
> 120kb....only 3% of the size.  I see this as a good way for beta testers
and
> others to send problem reports via email.

Ok, I've updated the program. You can download the latest copy from
http://www.248th.com/viper/nick/screenie.exe . In the new version, it can
save both bitmaps and jpegs.

If you wish to save a bitmap:
screenie c:\windows\desktop\thebitmap.bmp

If you wish to save a Jpeg, then the second paramater must be the
compression amount (1 is highest compression, 100 is lowest compression):
screenie c:\windows\desktop\thejpeg.jpg 80

Cheers,
Nicholas Sherlock

Re:Help with screen capture utility


Could you post the source code for this app too ?

Re:Help with screen capture utility


Here it is (This goes in the "Project source", you don't need any forms):

program screenie;

uses
  Forms,classes,windows,graphics,dialogs,jpeg,extctrls,sysutils;

var
 theJpeg: TJpegImage;
 image1:timage;

{$R *.RES}

procedure ScreenToCanvas(Cnvs: TCanvas);
var
   screenCanvas: TCanvas;
   DC: hDC;
begin
   DC := GetDC (0);
   screenCanvas := TCanvas.Create;
   try
      screenCanvas.Handle := DC;
      Cnvs.CopyRect (Rect (0, 0, Screen.Width, Screen.Height),screenCanvas
,Rect (0, 0, Screen.Width, Screen.Height));
   finally
    screenCanvas.Free;
    ReleaseDC (0, DC);
    end;
end;

begin
  Application.Initialize;
  Application.Run;
  image1:=timage.create(nil);
  if paramcount<1 then begin
  showmessage('You must enter the filename that the screenshot should be
saved to as the paramater. If you want to save as .JPG then the second
parameter should be the compression value.');
  exit;
  end;
image1.Picture.bitmap.width:=screen.width;
image1.Picture.bitmap.height:=screen.height;
screentocanvas(image1.canvas);
if (paramcount>1){JPEG} then begin
try
theJpeg := TJpegImage.Create;
theJpeg.Assign(image1.picture.bitmap);
theJpeg.CompressionQuality:=strtoint(paramstr(2));
theJpeg.SaveToFile(paramstr(1));
finally
if assigned(thejpeg) then thejpeg.free;
end;
end else
 image1.picture.savetofile(paramstr(1));
image1.free;
end.

Cheers,
Nicholas Sherlock

Quote
"Nemesis" <ecly...@spam.pandora.be> wrote in message

news:Jkql9.136745$8o4.20202@afrodite.telenet-ops.be...
Quote
> Could you post the source code for this app too ?

Re:Help with screen capture utility


Quote
Nicholas Sherlock wrote in message ...
>Here it is (This goes in the "Project source", you don't need any forms):

[...]

Quote
>  Application.Initialize;
>  Application.Run;

Why bother?

Groetjes,
Maarten Wiltink

Re:Help with screen capture utility


Quote
> [...]
> >  Application.Initialize;
> >  Application.Run;

> Why bother?

Indeed! I'll remember not to include that in the next "version" :)

Cheers,
Nicholas Sherlock

Other Threads