Link to home
Start Free TrialLog in
Avatar of bdunz19
bdunz19

asked on

Windows Service obtaining display device context using GetDC(NULL)

Hi Experts,

I am writing a windows service running on Windows Server 2003. The service performs some printing operations by obtaining a printer DC and a display DC. I'm wondering if there should be any issue for the service (running as SYSTEM user) to call GetDC(NULL) or if there is any reason to be concerend about this call? Will it return NULL or have any problems associated with the display HDC returned?

Thanks for your time,
Brandon
Avatar of jkr
jkr
Flag of Germany image

If you don't actually have to display any visible results on the screen, you should be fine LocalSystem runs on a different desktop than the logged-in user, so you'd have to circumvent that issue.
Avatar of bdunz19
bdunz19

ASKER

Right nothing is being displayed on the screen. The purpose of the Display DC is to obtain logical pixels X-Y or font sizes from the current display, ect.

So based on your response I should conclude that the service will recieve a valid DC which functions that perform actions on that DC (like described above) will all complete successfully?

Thanks jkr,
Brandon
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial