Solved

Getting hWnd of a Forms 2.0 Textbox

Posted on 2004-08-08
11
436 Views
Last Modified: 2013-12-25
I need to get the hWnd of a Forms 2.0 textbox.

The hWnd needs to work with the GetScrollPos API and similar functions.

I've tried the Setfocus/Getfocus method, but the hWnd I get doesn't work with the API.

The textbox is located in a picturebox on the form.

Any suggestions?
0
Comment
Question by:davidnsc1
  • 5
  • 4
  • 2
11 Comments
 
LVL 22

Expert Comment

by:DarkoLord
Comment Utility
You can't get a Form 2.0 object's hwnd easily...

I think this is because of that:  The use of these Microsoft Forms components in your own compiled applications, such as those written with Microsoft Visual C++ and Microsoft Visual Basic, is not recommended or supported. These controls were designed and tested to work exclusively within Microsoft Office and its Visual Basic for Applications environment.

http://support.microsoft.com/default.aspx?kbid=224305

Darko
0
 
LVL 2

Author Comment

by:davidnsc1
Comment Utility
Is there a non-easy way of getting the hWnd?
0
 
LVL 22

Accepted Solution

by:
DarkoLord earned 65 total points
Comment Utility
Hmm I tried to enumerate all child windows, but then I looked it with the Spy++ and "forms 2.0 textbox" doesn't even appear as a window...

Darko
0
 
LVL 2

Author Comment

by:davidnsc1
Comment Utility
Does this mean it doesn't have a hWnd?
0
 
LVL 22

Expert Comment

by:DarkoLord
Comment Utility
It looks so... although I'm not 100% sure...

Darko
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 2

Author Comment

by:davidnsc1
Comment Utility
Hmm...thanks for the help.  Do you know of any better unicode-aware plain-text textboxes?
0
 
LVL 22

Expert Comment

by:DarkoLord
Comment Utility
Here is an example of how to "extend" a label to display unicode: http://www.vbforums.com/attachment.php?s=&postid=1380475
I think you can do the same with a textbox...

Darko
0
 
LVL 2

Author Comment

by:davidnsc1
Comment Utility
Unfortunatly, that kind of "extending" is just changing character sets--I need full unicode functionality, as there are generally multiple character sets being displayed at the same time.
0
 
LVL 22

Assisted Solution

by:danaseaman
danaseaman earned 60 total points
Comment Utility
unicode-aware plain-text textboxes:
Depends on desired platform. If you need it to work on Win98 as well as NT/2000/XP you should look at RichEdit. Excellent freeware control available at http://www.mvps.org/emorcillo/vb6/controls/ctl_riched.msi I've been using it for over a year and it works great. For more info about Unicode controls see http://www.cyberactivex.com/UnicodeTutorialVb.htm
0
 
LVL 22

Expert Comment

by:danaseaman
Comment Utility
By the way I think Forms 2.0 TextBox is a windowless control thus the reason why you can't get a hWnd.
0
 
LVL 2

Author Comment

by:davidnsc1
Comment Utility
Thanks.  I ended up going with the RichEdit control.  Points to both of you for your timely help!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now