Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to change display settings: screen resolution, screen refresh rate
Adding and deleting Scheduled Tasks using NetScheduleJob API functions
Custom GDI+ class
Converting Unicode data from the Clipboard to a character string using a given code page
Capturing keyboard activity of another application with the Raw Input API (VFP9)
Enumerating data formats currently available on the clipboard
Winsock: sending email messages (SMTP, port 25)
Custom FTP Class for Visual FoxPro application
Detecting changes in connections to removable drives (VFP9)
How to download a file from the FTP server using FtpGetFile
Splash Screen for the VFP application
Mapping and disconnecting network drives
Custom HttpRequest class (WinINet)
How to activate Windows Calculator
Custom HttpRequest class (WinHTTP)
Enumerating raw input devices attached to the system (keyboard, mouse, human interface device)
How to convert a bitmap file to monochrome format (1 bpp)
Establishing connection using the SQLDriverConnect
GDI+: copying to the Clipboard (a) image of active FoxPro window/form, (b) image file
Using Font and Text functions
Displaying bitmap using the AlphaBlend function
Using EnumPrinters function to enumerate locally installed printers
Using WM_COPYDATA for interprocess communication (VFP9)
Extensible Storage Engine class library
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: 101  
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 (23.22.252.150)
4 sec.Function: 'GdipCreatePen1'
5.77 hrs.Example: 'Storing screen shot of a form to bitmap file'
 Function: 'VirtualFreeEx'
8.89 hrs.Example: 'Validating URLs using moniker functions'
 Function: 'WinExec'
 Example: 'GDI+: Storing DLL icon resources in image files'
9.01 hrs.Example: 'Retrieving information about the specified icon'
 Function: 'ReleaseMutex'
Function group: 'Synchronization'
11.19 hrs.Example: 'Writing to INI file'
21.23 hrs.Example: 'How to make a VFP form fading out when released (GDI version)'
Google
Advertise here!