Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Retrieving the state of your Internet connection
String representation for disk or memory capacity
Clipping mouse cursor area
Listing INF files in a specified directory
Retrieving graphic capabilities of default printer
Using GetSysColor
Using the Semaphore object to allow only one instance of VFP application running
WAV file recorder
Changing pitch and speed of a wave file
Enhanced GetFont dialog
One more way to retrieve environment strings
Pocket PC: creating backup for the System Registry
Pocket PC: enumerating mounted database volumes and databases in the Object Store
Removing FTP directory
Retrieving the command line for the VFP session
Retrieving the priority class for the current process
Time in milliseconds represented as string (e.g. 1 hour 24 min 36 sec)
Using GetBinaryType (WinNT only) to determine the type of an executable file
Enumerating the subkeys of a user-specific key
Finding parameters for the region specified
The SQLGetProp() creates a bridge between Visual FoxPro and the ODBC API
Another way to go online (it is not about choosing an ISP)
Current System information
How to drag a Form not using its Titlebar or Caption
Dynamic strings implemented through VFP Custom class

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
 
LOCAL obj
obj = CreateObject ("DynaString")
 
obj.setValue ("Test String")
? obj.getAddr(), "|", obj.getAllocSize(), "|", obj.getValue()
 
obj.setValue (Repli("*", 50))
? obj.getAddr(), "|", obj.getAllocSize(), "|", obj.getValue()
 
obj.setValue (Repli(Chr(0), 16384))
? obj.getAddr(), "|", obj.getAllocSize()
 
RELEASE obj
 
DEFINE CLASS DynaString As Custom
    PROTECTED hMem, strValue
 
PROCEDURE  Init (lcString)
    THIS.hMem = 0
    THIS.strValue = ""
    THIS.setValue (lcString)
 
PROCEDURE  Destroy
    THIS.ReleaseString
 
FUNCTION   getAddr
RETURN  THIS.hMem
 
FUNCTION   getValue
RETURN  THIS.strValue
 
FUNCTION  getAllocSize
    DECLARE INTEGER GlobalSize IN kernel32 INTEGER hMem
RETURN Iif(THIS.hMem=0, 0, GlobalSize(THIS.hMem))
 
PROCEDURE  setValue (lcString)
    IF TYPE("lcString")<>"C"
        RETURN
    ENDIF
#DEFINE GMEM_FIXED   0 
    DECLARE INTEGER GlobalAlloc IN kernel32;
        INTEGER wFlags, INTEGER dwBytes
 
    THIS.ReleaseString
    THIS.strValue = lcString
    THIS.hMem = GlobalAlloc (GMEM_FIXED, Len(THIS.strValue))
ENDPROC
 
PROCEDURE  ReleaseString
    IF THIS.hMem <> 0
        DECLARE INTEGER GlobalFree IN kernel32 INTEGER hMem
        = GlobalFree (THIS.hMem)
        THIS.hMem = 0
        THIS.strValue = ""
    ENDIF
ENDDEFINE
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1241 bytes  
Created: 2001-09-19 12:00:00  
Modified: 2001-09-28 16:45:46  
Visits in 7 days: 48  
Listed functions:
GlobalAlloc
GlobalFree
GlobalSize
Printer friendly API declarations
My comment:
Instances of this class are similar to long strings. There is one more parameter -- a pointer to the string -- which is useful in some interactions with Win32 structures.

To have this code compatible with VFP3, I do not use read-only properties.
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 (54.226.108.247)
4 sec.Example: 'Retrieving the IP-to-physical address mapping table'
Google
Advertise here!