Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 669
  • Last Modified:

How To SendMessageString To A ComboBox in VB 6.0

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
KingSencat
Asked:
KingSencat
  • 4
  • 3
1 Solution
 
c0ldfyr3Commented:
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
 
KingSencatAuthor Commented:
So there is no way to add a new text/item to the combobox?
0
 
c0ldfyr3Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
KingSencatAuthor Commented:
sorry i you didnt notice but i am not using c++, just vb
0
 
c0ldfyr3Commented:
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
 
KingSencatAuthor Commented:
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
 
c0ldfyr3Commented:
0

Featured Post

Independent Software Vendors: 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!

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now