Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1098843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:38:32+00:00 2026-05-17T00:38:32+00:00

Is there a way in Windows (which works in Windows CE) to check if

  • 0

Is there a way in Windows (which works in Windows CE) to check if a printer is attached and communicating to LPT1 in C++?


[Edit] More info:

We are currently working with a generic Windows CE printer driver – pcl.dll – by passing it into CreateDC, to get the DC for the printer.

We can’t call PrintDlg() to show the print dialog because it is “too complicated looking,” but we also can’t call it with PD_RETURNDEFAULT because we do not want to use the default printer. So, we are manually setting up a DEVMODE structure to pass in to CreateDC.

After we have the DC, we call GetDeviceCaps() to get the info for the printer (such as page-width, etc), then StartPage()/EndPage()/ExtTextOut() to print.

However, if there is no printer attached, the program freezes for about a minute before giving an “Abort/retry/fail?” dialog (I don’t know what point in this process it is freezing). Other software doesn’t freeze when you attempt to print, so there must be a way of preventing this…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:38:32+00:00Added an answer on May 17, 2026 at 12:38 am

    I would also recommend enumerating devices, but you could try the following functions to see if it hangs quickly and gracefully (I don’t currently have any way of testing this…):

    CreateFile("LPT1:", 0, 0, NULL, OPEN_EXISTING, ...);
    DeviceIOControl(HANDLE, IOCTL_PARALLEL_STATUS, ...);
    

    It is possible that this returns a failure better than trying to print with the DC.
    If it works, don’t forget to call CloseHandle() on the HANDLE returned from CreateFile before opening your DC for printing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to detect which windows XP theme is in use? I
Can I install Pinax on Windows Environment? Is there a easy way? Which environment
Is there a Windows API or any way to determine on which physical processor/core
I'm using C# Windows Forms. Is there an easy way to check if there
is there a way with windows command line to list all the files from
Is there a way (on windows using Delphi 2010) to get the number of
Is there a way in Windows/Linux or any other operating system to know at
Is there way to get file from windows xp command prompt? I tried to
Is there a way to get Windows audio mixer levels using WMI? For example,
Is there a way for a Windows Forms application to detect if any flags

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.