Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Winsock: connecting to a news server (NNTP, port 119)
Encapsulating access to the Windows Services in a class
Enumerating print jobs and retrieving information for default printer (JOB_INFO_1 structures)
Reading the state of mouse buttons within DO WHILE loop
Enumerating devices installed on the local machine
Accessing Adobe Reader 7.0 main menu from VFP application
Adding an ODBC data source with the SQLConfigDataSource; use automatic or interactive mode
Adding user-defined items to the Control Menu of VFP form (requires VFP9)
Dragging files from Explorer window and dropping them on FoxPro control (requires VFP9)
Setting the mouse capture to the specified window
Creating a mailslot
How to detect if additional monitor is connected and active
Enumerating ports that are available for printing on a specified server
Using FoxTray ActiveX control: System Tray Icon and menu attached to VFP form
Converting image file to .ICO file
Displaying icons in the system tray (VFP9)
Start an executable from VFP application by using the CreateProcess
Winsock: retrieving directory listing from an FTP server using passive data connection (FTP, port 21)
Displaying the main Dial-Up Networking dialog box
Switching between keyboard layouts
Displaying the associated icons and descriptions for files and folders
Printing text on the main VFP window
Printing text with the Escape function
Placing On-screen Alert on top of all windows
Using Change Notification Objects to monitor changes to the printer or print server

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
More code examples    Listed functions    Add comment     W32 Constants      Translate this page Printer friendly version of this code sample
Before you begin:
Set cPrinter variable to the name of a local or network printer. For at least 60 seconds the program will be recording any changes in printer jobs for the printer: jobs added, deleted, suspended etc.

Note that once started, the program gets into a waiting state (appears to stop responding) for at least one minute. This is caused by the WaitForSingleObject call. Every change in a print job resets this one-minute interval. So in case of intensive print traffic the program may stay frozen indefinitely long.

This is a log similar to what this program creates:



As you can see, the log stores a wide set of parameters. It includes the name of the printer, the name of the machine that created the job, the number of pages to be printed and already printed, the size of the job in bytes and more.
 
  Members area. Log in to view this example.
 
  User name:
  Password:
 
 
  Forgot your password?
 
  Sign up for
the Membership
 
 


User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
9004 bytes  
Created: 2005-04-06 19:47:15  
Modified: 2009-02-03 15:26:42  
Visits in 7 days: 154  
Listed functions:
ClosePrinter
FindClosePrinterChangeNotification
FindFirstPrinterChangeNotification
FindNextPrinterChangeNotification
FreePrinterNotifyInfo
GetLastError
GlobalAlloc
GlobalFree
GlobalSize
OpenPrinter
WaitForSingleObject
Printer friendly API declarations
My comment:
The Visual FoxPro is a single-thread environment. That means, once you have started to monitor printer jobs, the application is virtually frozen until a change happens or the time-out interval elapses.

On any change, the FindNextPrinterChangeNotification returns a set of PRINTER_NOTIFY_INFO_DATA structures for each and every print job, not just for the job that triggered the change. For example, on adding a job, you have information for this job and all other jobs returned. But on deleting a job you do not have its information returned.
Word Index links for this example:
Translate this page:
  Spanish    Portuguese    German    French    Italian  
FreeTranslation.com offers instant, free translations of text or web pages.
User Contributed Notes:
There are no notes on this subject.


Copyright © 2001-2013 News2News, Inc. Before reproducing or distributing any data from this site please ask for an approval from its owner. Unless otherwise specified, this page is for your personal and non-commercial use. The information on this page is presented AS IS, meaning that you may use it at your own risk. Microsoft Visual FoxPro and Windows are trade marks of Microsoft Corp. All other trademarks are the property of their respective owners. 

Privacy policy
Credits: PHP (4.4.9), an HTML-embedded scripting language, MySQL (5.1.55-log), the Open Source standard SQL database, AceHTML Freeware Version 4, freeware HTML Editor of choice.   Hosted by Korax Online Inc.
Last Topics Visited (107.20.129.212)
17.6 min.Example: 'How to delete all print jobs for a printer'
17.65 min.Example: 'How to change the name and the size of the font in the MessageBox dialog'
2.22 hrs.Example: 'Attaching menu to a top-level form'
 Function: 'SetWindowRgn'
Function group: 'Painting and Drawing'
7.27 hrs.Example: 'Using named pipes for interprocess communication'
 Function: 'keybd_event'
13.62 hrs.Example: 'Pocket PC: creating new database in the Object Store and copying Contacts Database records into it'
 Example: 'Removing FTP directory'
17.68 hrs.Example: 'How to delete all print jobs for a printer'
21.74 hrs.Example: 'Retrieveing information about the active window (even if it is not owned by the calling process)'
Google
Advertise here!