• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 674
  • 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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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