472,983 Members | 2,211 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,983 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 7177
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.