Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
How to browse and connect to printers on a network (WinNT)
Initiating Inet connection using a modem
Retrieving configuration information for the specified workstation (Win2000/XP)
Retrieving country-specific dialing information from the Windows Telephony list of countries
Starting a dialog box for connecting to network resources and passing input parameters
Using an Event Object. Part A: running an application that creates an Event object
Comparing file times
Converting characters in a URL into corresponding escape sequences and backwards
How to display a dialog box with which the user can add a data source (DSN)
How to perform Base64 encoding/decoding using Cryptography API Functions
Setting the volume label
Using shared memory to exchange data between two FoxPro applications
Accessing LSA Policy object (Local Security Authority)
Connecting a local device to a network resource
Dial the Net Automatically
Locking the workstation
Retrieving current settings for an ODBC connection
Retrieving Printer Device Context using PrintDlg function
Retrieving window and menu help context identifiers
Using the high-resolution performance counter
Winsock: retrieving information from a host database for a given host name
Copying files as a transacted operation (Vista)
Creating a device context for the specified printer
How to retrieve list of system DSNs (Data Source Name) with parameters
FindText -- the hopeless and useless Common Dialog

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:
When testing this code, do not push Find Next button on the form. Since no callback procedure attached to this control the call is forwarded to zero address. And that would create a System Error message.
 
#DEFINE GMEM_FIXED        0
#DEFINE FR_DOWN           1
#DEFINE FR_MATCHCASE      4
#DEFINE FR_NOWHOLEWORD 4096
 
DO decl
 
*| typedef struct { 
*|   DWORD        lStructSize;        4
*|   HWND         hwndOwner;          4
*|   HINSTANCE    hInstance;          4
*|   DWORD        Flags;              4
*|   LPTSTR        lpstrFindWhat;     4 
*|   LPTSTR        lpstrReplaceWith;  4
*|   WORD         wFindWhatLen;       2
*|   WORD         wReplaceWithLen;    2
*|   LPARAM        lCustData;         4
*|   LPFRHOOKPROC lpfnHook;           4
*|   LPCTSTR       lpTemplateName;    4
*| } FINDREPLACE, *LPFINDREPLACE;  total: 40 bytes
 
    LOCAL lcFindReplace, lcFind, hFind, lnFindLen
    lcFind = "any string" + Chr(0)
    lnFindLen = Len(lcFind)
    hFind = GlobalAlloc(GMEM_FIXED, lnFindLen)
 
    DECLARE RtlMoveMemory IN kernel32 As String2Heap;
        INTEGER Destination, STRING @ Source,;
        INTEGER nLength
    = String2Heap (hFind, @lcFind, Len(lcFind))
 
    lcFindReplace =;
        num2dword(40) +;
        num2dword(GetActiveWindow()) +;
        num2dword(0) +;
        num2dword(FR_DOWN +;
            FR_MATCHCASE+FR_NOWHOLEWORD) +;
        num2dword(hFind) +;
        num2dword(0) +;
        num2dword(lnFindLen-1) +;
        num2dword(0) +;
        num2dword(0) +;
        num2dword(0) +;
        num2dword(0)
 
    LOCAL hwndFind
    hwndFind = FindText (@lcFindReplace)
 
    * releasing system resources
    = GlobalFree (hFind)
 
PROCEDURE  decl
    DECLARE INTEGER GetActiveWindow IN user32
    DECLARE INTEGER FindText IN comdlg32 STRING @ lpfr
 
    DECLARE INTEGER GlobalFree IN kernel32 INTEGER hMem
    DECLARE INTEGER GlobalAlloc IN kernel32;
        INTEGER wFlags,;
        INTEGER dwBytes
 
FUNCTION  num2dword (lnValue)
#DEFINE m0       256
#DEFINE m1     65536
#DEFINE m2  16777216
    LOCAL b0, b1, b2, b3
    b3 = Int(lnValue/m2)
    b2 = Int((lnValue - b3*m2)/m1)
    b1 = Int((lnValue - b3*m2 - b2*m1)/m0)
    b0 = Mod(lnValue, m0)
RETURN Chr(b0)+Chr(b1)+Chr(b2)+Chr(b3)
 
 

User rating: 0/10 (0 votes)
Rate this code sample:
  • ~
1920 bytes  
Created: 2001-09-20 12:00:00  
Modified: 2001-09-28 16:45:47  
Visits in 7 days: 79  
Listed functions:
FindText
GetActiveWindow
GlobalAlloc
GlobalFree
Printer friendly API declarations
My comment:
By now I do not know such a thing as a pointer to a FoxPro procedure. Had I this pointer, the using of FindText Common Dialog would be a piece of cake. Otherwise it is useless. Do you have any other idea about it?
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.166.175)
5 sec.Example: 'How to draw custom Window Caption on FoxPro form'
19.43 min.Function: 'SetComputerName'
Function group: 'System Information'
19.53 min.Example: 'Using WM_COPYDATA for interprocess communication (VFP9)'
Language: 'C#'
46.7 min.Function: 'RegOpenKeyEx'
Function group: 'Registry'
1.41 hrs.Example: 'Form Magnifier'
2.62 hrs.Example: 'The window and its ancestors'
 Function: 'listen'
Function group: 'Windows Sockets 2 (Winsock)'
2.94 hrs.Function: 'SendMessage'
 Example: 'Mapping and disconnecting network drives'
4.31 hrs.Example: 'How to obtain Content-Type value for a file type from the System Registry'
Google
Advertise here!