Using Win32 functions in Visual FoxPro Image Gallery
Code examples:
Using the RestartDialog function -- restarting Windows
Writing to INI file
How to display the Print property sheet
How to make the caption of a VFP application flashing in the Windows task bar
How to retrieve number of objects in the Recycle Bin
Using named pipes for interprocess communication
Adding printer to the list of supported printers for the specified server
Retrieving Printer Device Context using PrintDlg function
Setting the date and time that a file was created
Converting an HTTP time/date string to a SYSTEMTIME structure
Getting a bit more than the _CLIPTEXT offers
How to create a desktop shortcut (shell link)
How to generate GUID values
Obtaining provider name for a specific type of network
Retrieving file information for the VFP executable running
Retrieving graphic capabilities of default printer
Yet another modal dialog: now HTML-based
GDI+: printing vertical text on VFP reports via generated images (VFP8)
How to find which fonts Windows uses for drawing captions, menus and message boxes
How to run FoxPro application under different user name (impersonating user)
Obtaining some properties for the Windows desktop using the GetWindowPlacement function
Retrieving the name and type of all available RAS-capable devices
Using custom Simple MapiSendMail class
Using vendor-neutral SQL constructs
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: 96  
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 (23.22.76.170)
1.17 hrs.Function: 'GdipDeleteMatrix'
9.03 hrs.Example: 'How to make a VFP form fading out when released (GDI+ version)'
 Function: 'GetCursorPos'
12.15 hrs.Example: 'Displaying all TCP connections for the local system'
 Function: 'htons'
17.72 hrs.Function: 'CopyIcon'
 Example: 'Using FoxTray ActiveX control: System Tray Icon and menu attached to VFP form'
18.21 hrs.Example: 'Locking the workstation'
20.9 hrs.Example: 'Saving available locale records into a cursor'
1 day(s)Function: 'GdipGetPropertyCount'
Function group: 'GDI+ Image'
Google
Advertise here!