Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 864
  • Last Modified:

Screenshot from a XP / 2000 service program

Hi,

I need to take a screenshot FROM A XP/2000 SERVICE.  When I take the screenshot from a normal program it works fine (using any of the differents codes available in internet), but using that code from a service program is not working (I only get a white screen).

Not sure if it helps, but:

I'm using getdc(0) to get the desktop handle; looking code written in C, I notice that a working code use getdc(null), but I cannot use that in delphi because it generates an  "could not convert variant of type (Null) into type (int64)" error.

As far as I can imagine, my problem is that I get the handle to the current user desktop, not the "real" desktop, so the function called from a regular application works well, but from a service program (system user) it fails...

Remember, take a normal screenshot from a normal application is not the problem, but using the same code in a xp/2000 service application.

Thanks in advance...
ps. sorry for my bad english
0
jcanonmercado
Asked:
jcanonmercado
  • 2
1 Solution
 
TNameCommented:
Works for me with GetDc(0)...
(ServiceType stWin32, Interactive is true)
0
 
TNameCommented:
You could also try something like this:

aCanvas := TCanvas.Create;
aCanvas.Handle := GetWindowDC(GetDesktopWindow);
0
 
jcanonmercadoAuthor Commented:
OK, maybe I wasn't clear enough...

I'm trying to make a remote control program, and it works... except on logon screen...

When in windows logon screen, my service application comunicates well, I have responses of all request I made, but I can't get a screenshot at this moment...if the service is allowed to interact with desktop I can get screenshots when the user log in... but not in logon screen...

I know this is possible because some remote control programs can do that (when in service mode...)

Any ideas?

tkanks...
0
 
Computer101Commented:
PAQed with points refunded (250)

Computer101
EE Admin
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now