473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Getting\Setting EditItem from Combobox Using SendMessage

Hey,

I have a handle to a combobox in a different process, I want to:
1. Get the item with the X index
2. Be able to set the selected item to Y (index)

I know how to do it for Listview controls, and I'm sure its possible
for Combobox's as well,
Any ideas?

Thanks!

--sternr
Aug 21 '08 #1
1 7244
Well, thanks for all your relpies(!!#$#@%!)

Anyway, I got is sloved so I figured why not post for everyone...
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError =
false)]
public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, int
wParam, string lParam);

[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError =
false,EntryPoint="SendMessage")]
public static extern IntPtr SendRefMessage(IntPtr hWnd, uint Msg, int
wParam, StringBuilder lParam);

uint CB_GETLBTEXT = 0x0148;
uint CB_SETCURSEL = 0x014E;

public string GetComboItem(int index)
{
StringBuilder ssb = new StringBuilder(256, 256);
SendRefMessage(this.Handle, CB_GETLBTEXT, index, ssb);
return ssb.ToString();
}

public void SetComboItem(int index)
{
SendMessage(this.Handle, CB_SETCURSEL, index,"0");
}

Cheers!

--sternr
Aug 25 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dave Rich | last post by:
Hi I am trying to access the listview items from a SysListView32 control in C#. I am using LVM.FINDITEM and LVFINDINFO through SendMessage to try to get the text from each column in the item (it...
3
by: JSK | last post by:
Hi, As any one worked in VB.NET and made use of Sendmessage API? The Issue I am running into is how to pass pointers of Data Structures (UDT) to the SendMessage. I starting looking at "IntPrt"...
1
by: J A via .NET 247 | last post by:
(Type your message here) I have to load about 2300 items into a ComboBox in VB.NET. I've found VB6 code that increases the speed for adding, but i can't seem to make it work in .NET. Does...
3
by: Rob | last post by:
Hi all, I am having trouble converting the code below (found on http://vbnet.mvps.org/index.html?code/core/sendmessage.htm) into a format that will work using vb .NET. Can anyone have a look...
18
by: Lars Netzel | last post by:
Hello! Thanx to this newgroup I have finally, with the help of you guys, gotten this to work halfway.. but the final action is still not working, clicking the "Button2" thru SendMessage(). ...
22
by: SQACSharp | last post by:
I'm trying to get the control name of an editbox in another window. The following code set the value "MyPassword" in the password EditBox but it fail to return the control name of the EditBox. ...
1
by: tommyk | last post by:
Hi I am using the following code to search for a given string in either a listbox or a combo box, but the function always returns the index as "-1". The function fires from the change event of a...
5
by: michelqa | last post by:
Hi, I need to call a lot of different native SendMessage to retreive informations from non managed application. Some win32 messages use struct pointer for lparam....how to create and...
3
by: Crazy Cat | last post by:
Hi all, I am developing an asp.net 2.0 application in Visual Studio 2005. On my page I have a simple datalist that is bound programmatically to a collection of simple objects. On this page I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.