Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is it possible to obtain a hWnd handle to VFP textbox?
Message
From
16/01/2002 04:56:34
 
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00605274
Message ID:
00605280
Views:
13
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
>No VFP controls are owner-drawn, you can use an replacement ActiveX but there would be an overhead in doing this.
>
>What exactly are you trying to achieve?
Malcolm Greene
Brooks-Durham
mgreene@bdurham.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform