Solved

Windows Service obtaining display device context using GetDC(NULL)

Posted on 2007-11-27
3
967 Views
Last Modified: 2013-12-03
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
0
Comment
Question by:bdunz19
  • 2
3 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 20361595
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.
0
 
LVL 4

Author Comment

by:bdunz19
ID: 20361818
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
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 20361903
Yes, an invisible, yet valid DC.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
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 explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

21 Experts available now in Live!

Get 1:1 Help Now