473,404 Members | 2,114 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,404 software developers and data experts.

Get the list from from iexplorer combo box

need to be able to get the list from a combobox using PInvoke. This code
works fine for a windows form application however I need to read the
combobox that is on an HTML page (inside iexplorer, the class name for the
box is "Internet Explorer_TridentCmboBx" ). When I read the combobox from
IE it will accurately get the count, but the text of each item returns non
printable ascii characters.

What am I doing wrong?

//C#
//------------------------------ CODE ---------------------
public const UInt32 CB_GETCOUNT = 0x0146;
public const UInt32 CB_GETCURSEL = 0x0147;
public const UInt32 CB_GETLBTEXT = 0x0148;
public const UInt32 CB_GETLBTEXTLEN = 0x0149;
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern IntPtr SendMessage(HandleRef hWnd, uint Msg, IntPtr wParam,
IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
static extern IntPtr SendMessage(HandleRef hWnd, uint Msg, IntPtr wParam,
StringBuilder lParam);
public static List<ListItemValsGetListItems(IntPtr controlPointer, object
sender)
{
int count = 0;
List<ListItemValsretVal = new List<ListItemVals>();
ListItemVals item = new ListItemVals();
IntPtr zero = new IntPtr(0);
//Get the count of items in the list
IntPtr ptr = SendMessage(GetHandleRef(controlPointer, sender), CB_GETCOUNT,
zero, zero);
count = ptr.ToInt32();
for (int i = 0; i < count; i++)
{
item = GetValueFromCombo(controlPointer, sender, i);
retVal.Add(item);
}
return retVal;
}
public static ListItemVals GetValueFromCombo(IntPtr pointer, object sender,
int index)
{
//List<ListItemValsretVal = new List<ListItemVals>();
int len = 0;
StringBuilder sb = new StringBuilder();
ListItemVals item = new ListItemVals();
IntPtr wParam = new IntPtr(index);
IntPtr zero = new IntPtr(0);
//Get the count of items in the list
IntPtr ptr = SendMessage(GetHandleRef(pointer, sender), CB_GETLBTEXTLEN ,
wParam, zero);
len = ptr.ToInt32();
sb.Capacity = len;
IntPtr txtPtr = SendMessage(GetHandleRef(pointer, sender), CB_GETLBTEXT,
wParam, sb);
//Get the list item
item.textValue = sb.ToString();
item.itemValue = wParam.ToInt32();

//return the value
return item;

Thanks,

Jul 3 '06 #1
0 1959

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

Similar topics

3
by: Charles | last post by:
I am trying to add the ability for a user to change the order in which the elements are listed in a dropdown list box. Before I added the ListID field the dropdown list box order was controlled...
1
by: Chicken Kebab Abdullah | last post by:
I am making a database of my movie collection and I have a form which Shows a DVD Code in a combo, and a list of the divx movies on the dvd on the right in a list box. The combo boxes bound...
1
by: Dec | last post by:
Ok to simplify things I'll just give an example. This is pretty much what I want to do (minus the postcode): http://www.perrys.co.uk/usedcar?ID=F5J9BNNBMVK00DF I have relatively little...
2
by: kmnotes04 | last post by:
Is it possible to link one drop-down box to another? For example, if a name is chosen from a drop-down list, can another drop-down list then automatically display the person's office as a result of...
0
by: ME | last post by:
I need to be able to get the list from a combobox using PInvoke. This code works fine for a windows form application however I need to read the combobox that is on an HTML page (inside iexplorer,...
6
by: AA Arens | last post by:
Hi, I have a database with 2 main forms. Contacts and companies. I share the base with two others via LAN. On the companies form I have buttons to navigate throught the records (>400). We are...
4
Rabbit
by: Rabbit | last post by:
Cascading Combo/List Boxes This tutorial is to guide you in the creation of Cascading combo/list boxes. That is when you have multiple combo/list boxes where the selection of an option in one...
2
by: mithaelin | last post by:
ok, I can't get out of this riddle and Google seems can't help me. The problem is that this code doesn't work in iexplorer while it's perfect in other browser (didn't check in safari): <html>...
30
ADezii
by: ADezii | last post by:
This week’s Tip of the Week will clearly demonstrate how you can dynamically set the Drop Down List Width of a Combo Box to the length of the longest item in its Row Source. The inspiration for this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.