Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2009
    Location
    -31.9554,115.85859
    Posts
    282

    Star Detect any installed printers

    I have been using another thread solution to detect a printer, which works great ... except if there is no printer installed!

    The Other Post

    ...............

    How would I handle the error if no printer is installed?

    Getting quite frustrated, can I even suppress the error?

    Any help please... All i need to do is detect whether or not a printer is installed, but I get "a nil value" if no printer is found.

  2. #2
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    Code:
    result = Registry.GetKeyNames(HKEY_LOCAL_MACHINE, "\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers");
    
    if result then
       Dialog.Message("Notice", result[1], MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
    end
    Dermot

    I am so out of here

  3. #3
    Join Date
    Mar 2009
    Location
    -31.9554,115.85859
    Posts
    282
    Yes that's the code I'm already using. But it shows an application error IF there is NO printer at that location in the registry, which I CANNOT seem to remove.

    But thank you for your reply

  4. #4
    Join Date
    Aug 2004
    Location
    Somewhere in Texas, USA
    Posts
    417
    The code that Dermot posted would NOT return an error.

    If you are receiving an error it is somewhere else in your code.

  5. #5
    Join Date
    Oct 2005
    Posts
    572

    how can i know if the printer is a default or not??? and...

    how can i know if the printer is a default or not??? and if the printer is in offline???

  6. #6
    Join Date
    Mar 2009
    Location
    -31.9554,115.85859
    Posts
    282
    Quote Originally Posted by mwreyf1 View Post
    The code that Dermot posted would NOT return an error.

    If you are receiving an error it is somewhere else in your code.
    Had to go back through my code and compare it to Dermots. I removed the [1] and got it to work perfectly.

    For everyone else i can confirm that this code works on XP for sure.

    Code:
    PrinterExists = Registry.GetKeyNames(HKEY_LOCAL_MACHINE, "\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Print\\Printers");
    
    if PrinterExists then
    	Button.SetVisible("btnNext3", true);
    else;
    	Button.SetVisible("btnNext3", false);
    end

Similar Threads

  1. Detect installed printer?
    By newengland in forum Setup Factory 7.0
    Replies: 6
    Last Post: 06-17-2010, 07:08 AM
  2. Acrobat.det does not detect that Acrobat is not installed
    By mlupo in forum AutoPlay Media Studio 5.0
    Replies: 2
    Last Post: 07-22-2005, 06:51 AM
  3. Detect if a application is installed
    By digitalsr2 in forum AutoPlay Media Studio 5.0
    Replies: 1
    Last Post: 05-20-2005, 07:55 AM
  4. Determining what Version of Internet Explorer is Installed
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 10-03-2003, 10:59 AM
  5. Detect Other Installed Softwares
    By Bubbancs in forum Setup Factory 6.0
    Replies: 1
    Last Post: 01-10-2002, 10:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts