Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-19-2007, 07:29 PM
Member
 
Join Date: May 2003
Posts: 35
Default Network LAN connection detection(get a DLL that can get/set the default printer)

I'm sure there is a Windows XP DLL to use for that but I don't have a clue which one and which function to register and how to register it with SWFKit Pro 2.2

I would also like to be able to detect if the default printer is a networked printer and if it is accessible. The Printer object doesn't have such method. I can checked if the default printer string includes a double backslah at the beginning of the string but I don't think it is the best way to ensure it is a networked printer.

Thankx.
Reply With Quote
  #2 (permalink)  
Old 04-22-2007, 05:15 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Network LAN connection detection

You can check if it is a network printer by checking a double backslash, because in a local printer name, a backslash is not allowed.

To see if the printer is accessible, you can use the OpenPrinter function. The following code shows how to do this

Code:
dllimport "winspool.drv" stdcall Boolean OpenPrinterA(String, int*, pointer);
dllimport "winspool.drv" stdcall Boolean ClosePrinter(int);

var printer = new Object;
printer.value = 0;
// This sample opens the first printer, however, you must
// open the default printer
if (OpenPrinterA(Printer.printers[0], printer, 0))
{
trace("Printer opened successfully with handle:" + printer.value);
ClosePrinter(printer.value);
} 
else
{
trace("cannot access the printer");
}
Reply With Quote
  #3 (permalink)  
Old 04-23-2007, 06:35 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:Network LAN connection detection

FFish script does not include any method to retrieve and set the default printer. However, we've built a dll (DP.dll) to do that. The DP.dll contains two methods, DPGetDefaultPrinter and DPSetDefaultPrinter. The attached sample shows how to call this dll from with ffish script and actionscript, and the C source code of the DP.dll is also included. To try the sample, please extract the files in the attached zip file into a new folder, and then open the dpsample.skp file with swfkit pro.
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 04:15 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.