Solved

How To SendMessageString To A ComboBox in VB 6.0

Posted on 2008-10-18
7
643 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
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!

 

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

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!

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 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…

730 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