Solved

How To SendMessageString To A ComboBox in VB 6.0

Posted on 2008-10-18
7
630 Views
Last Modified: 2012-05-05
I can succesfull use the sendmessagestring, WM_SETTEXT to a command button or to a textbox  but i can't get it work to a combobox, What i am doing wrong? Please look at my attached code
Dim nHwnd As Long

Dim statica As Long

Dim nEditHwnd2 As Long

nHwnd = FindWindow(vbNullString, "Profile: s")

statica = FindWindowEx(nHwnd, 0&, vbNullString, "Pre")

nedithwnd2 = FindWindowEx(statica, 0&, "ComboBox", vbNullString)

SendMessageSTRING EditHwnd2, WM_SETTEXT, 0&, ByVal "test1"

Open in new window

0
Comment
Question by:KingSencat
  • 4
  • 3
7 Comments
 
LVL 10

Expert Comment

by:c0ldfyr3
ID: 22751690
The reason it's not working isn't your code, just stop for a second and think what you are trying to do. A textbox and a command button both have a property which you could call 'Text', so you are setting that property with the WM_SETTEXT message. A combo box doesn't have a text property as such, it has a list of items which you select.

Try these links...

C++ code for setting and adding combo items: http://en.wikibooks.org/wiki/Windows_Programming/User_Interface_Controls
0
 

Author Comment

by:KingSencat
ID: 22753952
So there is no way to add a new text/item to the combobox?
0
 
LVL 10

Expert Comment

by:c0ldfyr3
ID: 22755777
KingSencat, did you even open the link I sent you? It has API to add new items to a combo but WM_SETTEXT is not the way.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:KingSencat
ID: 22773172
sorry i you didnt notice but i am not using c++, just vb
0
 
LVL 10

Expert Comment

by:c0ldfyr3
ID: 22775731
KingSencat, I know you are using VB, I'm trying to get you to use your intuition. If you bothered to READ the page you'd know exactly how to approach this.

API is the same for all languages.
0
 

Author Comment

by:KingSencat
ID: 22784150
I have read the page and i have no idea how i can accomplish it using vb 6.0 , can you do it for me pls?
0
 
LVL 10

Accepted Solution

by:
c0ldfyr3 earned 500 total points
ID: 22790332
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

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…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

747 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