Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is it possible to obtain a hWnd handle to VFP textbox?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00605274
Message ID:
00605401
Vues:
14
>Neil,
>
>Re: What am I trying to achieve by gaining access to a textbox's wHnd?
>
>I have an overly technical customer who is very VB literate. He passed on the following VB related AutoComplete tip (adds IE like auto-complete to any textbox) and asked me to include support for this feature in the VFP applications we're building for him. Since the individual in question signs off on my invoices, its not enough for me to suggest that we could build an AutoComplete using native VFP controls - he wants me to attempt the 'real' thing first vs. resorting to 're-inventing the wheel' (his words) in VFP.
>
>Your thoughts appreciated.
>
>Thanks,
>Malcolm
>
>
>Here's sample VB notes ...
>
>IE5 introduced the AutoComplete feature, and its available for both standard VB text boxes and combo boxes using style 0 or 1. Use of this API is limited to systems with IE5 or greater. Although the MSDN states that CoInitialize must be called before using this API, and CoUninitialize called when the edit control has been destroyed, VB takes care of handling this task naturally.
>
>
>' Concept, code and documentation by Randy Birch, VBNet, 11/26/99
>
>' Flags to control the operation of SHAutoComplete. The first four are
>' used to override the Internet Explorer registry settings. The user can
>' change these settings manually by launching the Internet Options property
>' sheet from the Tools menu and clicking the Advanced tab. The last five
>' can be used to specify which files or URLs will be available for auto
>' append or autosuggest operations.
>
>' Ignore registry default and force feature on
>Private Const SHACF_AUTOSUGGEST_FORCE_ON  As Long = &H10000000
>
>' Ignore registry default and force feature off.
>Private Const SHACF_AUTOSUGGEST_FORCE_OFF  As Long = &H20000000
>
>' Ignore registry default and force feature on. (Also know as AutoComplete)
>Private Const SHACF_AUTOAPPEND_FORCE_ON  As Long = &H40000000
>
>' Ignore registry default and force feature off. (Also know as AutoComplete)
>Private Const SHACF_AUTOAPPEND_FORCE_OFF  As Long = &H80000000
>
>' Currently (SHACF_FILESYSTEM | SHACF_URLALL)
>Private Const SHACF_DEFAULT  As Long = &H0
>
>' Includes the File System as well as the rest of the shell
>' (Desktop\My Computer\Control Panel\)
>Private Const SHACF_FILESYSTEM  As Long = &H1
>
>' URLs in the User's History
>Private Const SHACF_URLHISTORY  As Long = &H2
>
>' URLs in the User's Recently Used list
>Private Const SHACF_URLMRU  As Long = &H4
>
>Private Const SHACF_URLALL  As Long = (SHACF_URLHISTORY Or SHACF_URLMRU)
>
>Private Declare Function SHAutoComplete _
>   Lib "Shlwapi.dll" _
>  (ByVal hwndEdit As Long, _
>   ByVal dwFlags As Long) As Long
>
>Private Sub Command1_Click()
>
>   'Turn on auto-complete
>   Call SHAutoComplete(Text1.hWnd, SHACF_DEFAULT)
>
>   'update the captions and set focus to the textbox
>   Command1.Caption = "SHAutoComplete is On"
>   Command1.Enabled = False
>   Text1.SetFocus
>   Text1.SelStart = Len(Text1.Text)
>
>End Sub
>
Malcom,

I've played with this function (SHAutoComplete) in VFP. Even if you could get the hWnd of a text, I doubt that you'd have much success with it. My own results in VFP using an ActiveX control were less than acceptable. I believe it has to do with the way VFP processes Windows Messages. You'd be better off with the third-party tool that Neil recommended.
George

Ubi caritas et amor, deus ibi est
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform