Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to download this reference`s archive through WinInet functions using InternetOpenUrl
How to get Special Folders paths
How to retrieve number of objects in the Recycle Bin
Obtaining I/O counts for the current process
Obtaining some properties for the Windows desktop using the GetWindowPlacement function
Retrieving country-specific dialing information from the Windows Telephony list of countries
Retrieving Printer Device Context using PrintDlg function
Retrieving window and menu help context identifiers
Simple printer queue monitor: deletes, pauses, resumes print jobs for local printer
URL: converting unsafe characters and spaces into escape sequences
Using Font and Text functions
Accessing Windows Control Panel from VFP Application
Current keyboard type
Drawing icons associated with the VFP main window
How to perform Base64 encoding/decoding using Cryptography API Functions
Monitoring changes in a directory
Retrieving current settings for an ODBC connection
Retrieving the User Datagram Protocol (UDP) listener table
Storing registration key in the resources of an executable file
Copying files as a transacted operation (Vista)
Get the power status of your laptop computer
Reading parameters of streams in AVI file
Retrieving configuration information for the specified server (Win98/Me)
Saving available locale records into a cursor
How to display a dialog box with which the user can add a data source (DSN)

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:
This is a dialog allowing you to create a new data source:


And later if you decide to modify existing data sources:

 
DO decl
 
IF Not CreateDSN("NewDSN")
* 16 = cancelled by the user
* 18 = Could not create a DSN in the registry
* ...
    = MessageB(GetErr(), 64, " Creating New Data Source")
ENDIF
 
* if you decide to manage data sources
= SQLManageDataSources(GetActiveWindow())
 
* end of main
 
FUNCTION CreateDSN(cDSN)
RETURN (SQLCreateDataSource(GetActiveWindow(), cDSN) <> 0)
 
FUNCTION GetErr
* returns error info for the ODBC installer functions
#DEFINE SQL_SUCCESS  0
#DEFINE SQL_SUCCESS_WITH_INFO 1
 
    LOCAL nIndex, cMsg, nBufsize, nErrCode,;
        cResult, nResult
 
    cResult = ""
    FOR nIndex = 1 TO 8
        nBufsize = 512
        cMsg = Repli(Chr(0), nBufsize)
        nErrCode = 0
 
        nResult = SQLInstallerError(nIndex, @nErrCode,;
            @cMsg, nBufsize, @nBufsize)
 
        IF INLIST(nResult, SQL_SUCCESS, SQL_SUCCESS_WITH_INFO)
            cMsg = SUBSTR(cMsg, 1, AT(Chr(0), cMsg)-1)
 
            cResult = cResult + Iif(nIndex=1, "", Chr(13)+Chr(13)) +;
                "Error code: " + LTRIM(STR(nErrCode)) + Chr(13) +;
                cMsg + ".     "
        ELSE
            EXIT
        ENDIF
    ENDFOR
RETURN cResult
 
PROCEDURE decl
    DECLARE INTEGER GetActiveWindow IN user32
    DECLARE INTEGER SQLManageDataSources IN odbccp32 INTEGER hwnd
 
    DECLARE INTEGER SQLCreateDataSource IN odbccp32;
        INTEGER hwnd, STRING lpszDS
 
    DECLARE INTEGER SQLInstallerError IN odbccp32;
        INTEGER iError, INTEGER @pfErrorCode, STRING @lpszErrorMsg,;
        INTEGER cbErrorMsgMax, INTEGER @pcbErrorMsg
 
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1438 bytes  
Created: 2003-01-31 16:25:07  
Modified: 2009-01-03 15:26:33  
Visits in 7 days: 55  
Listed functions:
GetActiveWindow
SQLCreateDataSource
SQLInstallerError
SQLManageDataSources
Printer friendly API declarations
My comment:
ODBC Data Source Administrator
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.16.132.180)
3 sec.Example: 'Initiating Inet connection using a modem'
3.25 hrs.Example: 'Starting a dialog box for connecting to network resources and passing input parameters'
 Function: 'GetFocus'
Function group: 'Keyboard Input'
3.96 hrs.Function: 'IsWellKnownSid'
 Example: 'Comparing dimensions of the VFP main window with _SCREEN properties'
5.28 hrs.Function: 'ExpandEnvironmentStrings'
Function group: 'System Information'
6.25 hrs.Example: 'Setting the date and time that a file was created'
 Example: 'Retrieving the names of all sections in an initialization file'
8.34 hrs.Function: 'RasPhonebookDlg'
 Function: 'SetEvent'
Function group: 'Synchronization'
Google
Advertise here!