Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Getting hWnd of a Forms 2.0 Textbox

Posted on 2004-08-08
11
Medium Priority
?
467 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
11 Comments
 
LVL 22

Expert Comment

by:DarkoLord
ID: 11746645
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
ID: 11746822
Is there a non-easy way of getting the hWnd?
0
 
LVL 22

Accepted Solution

by:
DarkoLord earned 195 total points
ID: 11746874
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

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

Expert Comment

by:DarkoLord
ID: 11747092
It looks so... although I'm not 100% sure...

Darko
0
 
LVL 2

Author Comment

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

Expert Comment

by:DarkoLord
ID: 11747148
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
ID: 11747181
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 180 total points
ID: 11749840
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
ID: 11749884
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
ID: 11754890
Thanks.  I ended up going with the RichEdit control.  Points to both of you for your timely help!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

721 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