Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
FindText -- the hopeless and useless Common Dialog
How to generate UUID values
Retrieving configuration information for the specified server (Win98/Me)
Retrieving the System Time adjustment
Using Custom FTP class (DEFINE CLASS ftp As Custom)
Accessing Windows Control Panel from VFP Application
Converting long file names to the short format and vice versa
Memory usage info for current VFP session (WinNT only)
Retrieving a handle to DLL and address of an exported function in it
Current System information
GDI+: converting image file to another graphics format
Pocket PC: Folder Viewer
Retrieving top-child window for the VFP form
Using Shell for performing operations on files
Winsock: how to retrieve the protocol information corresponding to a protocol number
Accessing a CD device (cdaudio) with Multimedia Command Strings
High-powered ALLTRIM
Obtaining physical parameters for a drive: sectors, clusters, cylinders...
Winsock: retrieving information about available transport protocols
Creating hash values for the list of names
Enumerating Processes -- Win9*
GDI+: loading image file, drawing on it, saving the result to another file
Obtaining MAC address through Address Resolution Protocol (ARP) request
Retrieving default spooling directory name
How to hide your program from the Close Program dialog (Win9* only)

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:
In numerous Tips-and-Tricks pages on the Internet for VB, Delphi, and C this little one is an old-timer. Now is the time to "port" it to the FoxPro.
 
DO decl
#DEFINE RSP_SIMPLE_SERVICE      1  && hide
#DEFINE RSP_UNREGISTER_SERVICE  0  && show
 
LOCAL lnProcessId
lnProcessId = GetCurrentProcessId()
 
* hide by registering as a service mode program
= RegisterServiceProcess (lnProcessId, RSP_SIMPLE_SERVICE)
 
* show 
*= RegisterServiceProcess (lnProcessId, RSP_UNREGISTER_SERVICE)
 
PROCEDURE  decl
    DECLARE INTEGER GetCurrentProcessId IN kernel32
    DECLARE INTEGER RegisterServiceProcess IN kernel32;
        INTEGER dwProcessId, INTEGER dwType
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
504 bytes  
Created: 2002-02-15 08:53:00  
Modified: 2008-12-03 15:26:21  
Visits in 7 days: 61  
Listed functions:
GetCurrentProcessId
RegisterServiceProcess
Printer friendly API declarations
My comment:
Registering your application as a service mode program removes it from the Task List in Win95/98/Me. That means it cannot be so easily aborted by an advanced user who already mastered the magic triple-key forcer.

It is recommended to restore the regular mode (Simple Service) for your application before closing it, to let it free its system resources in a proper way.

The RegisterServiceProcess is a documented function in KERNEL32 library. Though MSDN doesnt indicate this particular result of calling it.

Here in VFP we are not much spoiled with header files as those guys with C are. Whichever external function is, it has to be declared directly in VFP code. Differently in C the RegisterServiceProcess function is not prototyped in header files. That is why they have to resort to LoadLibrary and GetProcAddress functions at first.
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 (50.19.155.235)
5.35 hrs.Example: 'Establishing connection using the SQLDriverConnect'
10.19 hrs.Function: 'SetSysColors'
11.06 hrs.Example: 'How to create transparent areas inside a form -- punching holes in the form'
 Function: 'GetClassInfo'
11.55 hrs.Example: 'How to find the application associated with a file name'
 Example: 'Using Change Notification Objects to monitor changes to the printer or print server'
21.63 hrs.Example: 'Creating irregularly shaped FoxPro form using transparency color key'
22.48 hrs.Example: 'Printing text with the Escape function'
1 day(s)Example: 'Form Magnifier'
 Function: 'GetNumberOfEventLogRecords'
Function group: 'Event Logging'
Google
Advertise here!