|
To anybody:
Hi. I'm trying to get all items of the Internet Explorer's ComboBox through a C# source code. So far I've got the handles to the child windows. But how to extract all items? Must I open the combobox to fetch all urls? There is no result on my efforts.
I used a SendMessage and got no error messages. Where is my fault?
Is anybody out there to help me a little?
|
|
|
|
|
Not a C# topic. Ask WIN32 gurus. IMHO, there is nothing particular about IE combo-boxes, except they are subclassed (seen with Spy++).
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
Thanks.
I'm a little late responding your mail.
Well, I beg your pardon but still I would say it is a C# topic.
Most of my informations I got from VB. And VB apps seems to be working.
By the way I got the right handle to the comboBox (I guess) and I am able to retrieve informations about total listBox entries and text length of each entry. But I do not succeed retrieving characters or strings.
The fact of handling a ComboBoxEx control does not mind because simple comboBoxes in other applications do not send back characters or strings too.
Here's a reflection on some of my code portions:
[DllImport("user32.exe")]
public static extern int SendMessage(int cbHandle, int Msg, int wParam, object lParam);
...
const int CB_GETLBTEXTLEN = 0x0149;
const int CB_GETLBTEXT = 0x0148;
const int CB_GETCOUNT = 0x0146;
...
private void listBox2_DoubleClicked(object sender, EventArgs e)
{
int lbAmount = SendMessage(cbHandle, CB_GETCOUNT, 0, 0);
char[] ch;
for(int i = 0; i<lbAmount, i++)
{
int txtLength = SendMessage(cbHandle, CB_GETLBTEXTLEN, i, 0);
ch = new char[txtLength+1];
SendMessage(cbHandle, CB_GETLBTEXT, i, ch);
string itemText = new String(ch);
listBox3.Items.Add(ch);
}
}
Can you locate any essential faults or do you think, it is still not a C# topic? Then I will believe you.
Thanks again
Tom LaBenche
|
|
|
|
|
Tom,
I have no PC at the mo under my fingers, but from what I see here are the errors :
- user32.exe --> does not exist, use user32.dll instead
- the SendMessage PInvoke signature uses an int for lParam, not an object
- retrieving combobox content is not like this AFAIK
The reason why it is not C# is clear : that's raw window messaging, hence WIN32. This is to underline clearer semantics.
|
|
|
|
|
Solved!
|
|
|
|
|
hi,
i have the well-known worker-thread doing some computations in the background. when there is an exception raised in this thread, it simply vanishes into hyperspace.
is there any standard-way of handling exception thrown by the worker-thread in the calling thread?
i could do numorous nasty hacks and workaround, but i don't know any "nice" way
thx for ideas.
:wq
|
|
|
|
|
Best idea I can think of is to wrap it all in a huge try block and raise an event with the details of the exception in it. Events are designed to be caught, exceptions aren't.
Paul
|
|
|
|
|
You can attach an event handler to the current AppDomain 's UnhandledException event. This won't filter exceptions from that particular thread but it at least you can handle that exception.
James
Sig code stolen from David Wulff
|
|
|
|
|
try using a singleton to handle the exception...
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
i started with vb.net and now i am doing c# i am totally confused...which is the better....in efficeincy matters...
can anyone tell me some valid points where c# scores over vb.net or vice versa...
thank you!
|
|
|
|
|
They are as efficient as each other. Which you should use is largely a matter of taste. There are a few differences in features. For example, you can do operator overloading in C# but not in VB. You can also write unsafe code in C# - code that runs outside the managed execution environment.
I'm sure others will be able to tell you more deatils. If not, try searching on "C# vs. VB.NET" on Google. I think there is a comparison table somewhere in the Visual Studio Help and in the online MSDN library.
Kevin
|
|
|
|
|
They are not as efficient as one another. C# is faster and more powerful than VB.NET: http://www.codeproject.com/dotnet/PrimeNumbersProjects.asp[^]
Norm Almond: I seen some GUI's in my life but WTF is this mess
Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough
Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children
Leppie:My sister is 25
-Norm on the MailMagic GUI
|
|
|
|
|
My answer was based on statements from Microsoft. Some time ago I also saw another statistical analysis which showed little or no difference between C# and VB .NET. I guess it depends on the nature of the programming task you want to perform. This article concentrates on a specific mathematical task. And even then the bigger the size of the problem the smaller the differences. For more general tasks, e.g., a typical ASP.NET web application, I suspect you will not see much difference.
As for C#'s being more powerful, what do you mean by that? If you mean it can do more things than VB .NET, such as call unsafe code, then I would agree. There are other differences but I don't regard them as being significant "power" differentiators.
Kevin
|
|
|
|
|
Kevin McFarlane wrote:
My answer was based on statements from Microsoft.
I know. I just get really tired of seeing the same old stuff. Believe me, I've used both languages and C# is definitely faster than VB.NET. Sometimes I've even noticed that my ASP.NET apps run a lot faster using C# than VB.NET.
Kevin McFarlane wrote:
As for C#'s being more powerful, what do you mean by that?
Unsafe code is one of them. Others are Operator Overloading, built in XML documentation, tighter integration with .NET, and of course...lack of the Beep() function.
But seriously, C# is just an all around cleaner language than VB.NET is. Especially when VB.NET still has the MsgBox() function and all the old compatibility namespace stuff.
Norm Almond: I seen some GUI's in my life but WTF is this mess
Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough
Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children
Leppie:My sister is 25
-Norm on the MailMagic GUI
|
|
|
|
|
The CLR gives the unique opportunity not to bother at all the language the classes are written in. You can for instance build a class library using a language such like VB.NET just because VB is a unique language for... for...well VB is a language... well VB is ....well never mind...you may use C# to build a class library, produce an assembly, and then in another non-C# project you reference that assembly.
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
vb.net = 6 chars
c# = 2 chars
therefore its 3 times quicker to write in c#
HTH
actually the point is that .net is written in c# not vb.net, which is a big clue
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Hello ..
For some reason the components that were originally in my toolbox are now gone. There are only a few showing without the ICONS for them and I can't remember all the components that were default ...
Is there anyway to bring back the default components ?
Thks in advance ..
jon
Jon ...
|
|
|
|
|
Right click on the toolbox and choose "Customize Toolbox", then click the Reset button on the dialog that comes up.
James
Sig code stolen from David Wulff
|
|
|
|
|
|
An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll
Additional information: Cannot add a top level control to a control.
I get this when I attempt to doc an outlook type toolbar form to my already existing form.
|
|
|
|
|
So you're trying to add one form to another? You can't do that unless the parent form is MDIParent = true; and the child form is MDIChild = true; and I don't think that's what you want to do. You could take the Outlook Toolbar type control and putting that into the parent form. That would work.
Norm Almond: I seen some GUI's in my life but WTF is this mess
Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough
Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children
Leppie:My sister is 25
-Norm on the MailMagic GUI
|
|
|
|
|
Yes that is what I am trying to do. All I see is an MDIContainer. Neither of of forms have the option for mdiParent and mdiChild.
|
|
|
|
|
I found the methods for the objects. Having trouble actually setting them correctly dispite the given examples I found online? Any idea what to set (syntax) and where to set it from this point?
Derek
|
|
|
|
|
Look at James' explanation, it's way better than mine would be. *David humbly cedes control of the thread to James, realizing of course, that the C# Guru has, once again, bestowed his knowledge upon us... *
Norm Almond: I seen some GUI's in my life but WTF is this mess
Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough
Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children
Leppie:My sister is 25
-Norm on the MailMagic GUI
|
|
|
|
|
David Stone wrote:
So you're trying to add one form to another? You can't do that unless the parent form
Yes you can
Two forms, Parent and Child:
Child.TopLevel = false;<br />
<br />
Parent.Controls.Add(Child);<br />
<br />
Child.Show();
James
Sig code stolen from David Wulff
|
|
|
|