Solved

How To SendMessageString To A ComboBox in VB 6.0

Posted on 2008-10-18
7
644 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
[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
  • 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
Industry Leaders: 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!

 

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

734 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