Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Creating a device context for the specified printer
Get the power status of your laptop computer
How to get Special Folders paths
Loading a string resource from an executable file
Playing WAV sounds simultaneously
Retrieveing information about the active window (even if it is not owned by the calling process)
Comparing file times
How to display advanced Task Dialog (Vista)
How to find which fonts Windows uses for drawing captions, menus and message boxes
Removing FTP directory
Retrieving graphic capabilities of default printer
Smart Card Database Query Functions
Storing the environment strings in cursor
Testing Transparent Menu Class with top-level form (requires VFP9)
Using the GradientFill function
Validating the heap of the calling process
Drawing icons associated with the VFP main window
GDI+: how to make VFP controls visually shake and shudder
Obtaining OS memory performance information
Printing text on the main VFP window
Using FtpCommand
Configuring DEVMODE structure for a printer
Enumerating files opened on the network
How to generate GUID values
Retrieving information about MS-DOS device names using QueryDosDevice (WinNT 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:
According to the MSDN the QueryDosDevice function works under Windows 98/Me. But to what I saw, it does not.

 
#DEFINE MAX_PATH 260
DO declare
 
CREATE CURSOR csDosDevices (drvletter C(2), drvtype I,;
    targetpath C(250))
 
LOCAL cDrives, nBufsize, cDrvLetter, ch, cTargetPath
cDrives = REPLICATE(CHR(0), 250)
nBufsize = GetLogicalDriveStrings(LEN(cDrives), @cDrives)
cDrives = PADR(cDrives, nBufsize)
 
cDrvLetter=""
FOR nBufsize=1 TO LEN(cDrives)
    ch = SUBSTR(cDrives, nBufsize,1)
    IF ch = Chr(0)
        cDrvLetter=PADR(cDrvLetter,2)
        cTargetPath = REPLICATE(CHR(0), MAX_PATH)
 
        = QueryDosDevice(cDrvLetter, @cTargetPath,;
            LEN(cTargetPath))
 
        cTargetPath = STRTRAN(cTargetPath, CHR(0), "")
 
        INSERT INTO csDosDevices VALUES (;
            cDrvLetter, GetDriveType(cDrvLetter),;
            cTargetPath)
 
        cDrvLetter = ""
    ELSE
        cDrvLetter = cDrvLetter + m.ch
    ENDIF
NEXT
 
GO TOP
BROWSE NORMAL NOWAIT
 
PROCEDURE declare
    DECLARE INTEGER GetDriveType IN kernel32 STRING nDrive
 
    DECLARE INTEGER GetLogicalDriveStrings IN kernel32;
        INTEGER nBufferLength, STRING @lpBuffer
 
    DECLARE INTEGER QueryDosDevice IN kernel32;
        STRING lpDeviceName, STRING @lpTargetPath, INTEGER ucchMax
 
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1097 bytes  
Created: 2002-01-03 19:10:17  
Modified: 2005-12-16 13:03:58  
Visits in 7 days: 69  
Listed functions:
GetDriveType
GetLogicalDriveStrings
QueryDosDevice
Printer friendly API declarations
My comment:
The QueryDosDevice returns names like \Device\HarddiskVolume1.
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.17.109.248)
55.15 min.Example: 'How to change display settings: screen resolution, screen refresh rate'
Language: 'C#'
6.24 hrs.Function: 'ReadFile'
Function group: 'File Management'
7.68 hrs.Function: 'GlobalSize'
Function group: 'Memory Management'
 Example: 'Accessing examples contained in this reference through Web Services'
9.83 hrs.Example: 'Saving HKEY_LOCAL_MACHINE\\Software\\ODBC Registry Entries to an XML file'
 Example: 'Enhanced GetFont dialog'
10.19 hrs.Function: 'CeFindFirstFile'
11.09 hrs.Function: 'SetDlgItemInt'
 Example: 'Reading metrics for the currently selected font'
 Example: 'Obtaining heap handles and enumerating memory blocks for the current VFP session (WinNT only)'
Google
Advertise here!