|
Message Closed
modified 2-Apr-21 5:20am.
|
|
|
|
|
You could browse IE's url history or write a browser helper object that could send the url to your Windows Forms app. See these articles for ideas:/ravi
|
|
|
|
|
textbox1.Text = webBrowser1.Url;
I know nothing , I know nothing ...
|
|
|
|
|
Hi,
you could read the content of the address bar of some browsers. In C# that would take some P/Invoke code to call FindWindow and GetWindowText; as the window belongs to another process, you would also need to allocate and access memory in that other process. You can find some of the basic techniques in my TrayIconBuster article (LP_Process class).
Doing it this way would have several limitations:
1. the solution is slightly different for each specific web browser, as the logical location of the address bar will vary.
2. the address bar does not always represent the current page; e.g. when frames are involved, the bar will show the URL of the frames page, not the contained page(s).
The alternative is to create your own browser and have the required functionality built-in. A good starting point would be the WebBrowser Control. Of course, people could still use another browser, but so they can in the former approach (you can't prevent them from downloading and installing FireFox, Safari, Chrome, etc).
|
|
|
|
|
Isn't this sort of info somewhere in the browser log, history or something, maybe you can use that instead of scraping the browser window.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Message Closed
modified 2-Apr-21 5:16am.
|
|
|
|
|
I've the same problem.
I was searching a long time and the best solution I was found is DllImport(user32.dll)
You should use some methods like FindWindow, FindWindowEx and SendMessage.
You must first find main class of IE window, e.g. use WinSpy++.
Then you go from class to class, from parent to child (IEFrame -> WorkerW -> ReBarWindow32 -> Address Band Root -> edit) First use FindWindow, next FindWindowEx.
In class named "edit" there is a url.
Use SendMessage, WM_GETTEXT and e.g. StringBuilder class to get the url.
But it only works with IE
How do this in Opera or Chrome? Any idea?
|
|
|
|
|
is there a possibility to work with a crystal report without using dataset???
because in my project I'm working with dictionaries
thank you
|
|
|
|
|
tek 2009 wrote: without using dataset
That's the only way I've done it.
|
|
|
|
|
I keep getting the below error message when I try and run my code.
Error 3 Cannot implicitly convert type 'object' to 'bool'. An explicit conversion exists (are you missing a cast?)
When I try run the below code:
private void Pause_Click(object sender, RoutedEventArgs e)
{
if (btnPause.Content = "Pause") <<<<
|
|
|
|
|
==
|
|
|
|
|
Instead of coding:
if (btnPause.Content == "Pause")
try writing it this way round
if ("Pause" == btnPause.Content)
then when you inadvertently miss one of the = signs the compiler will give you a much more useful message.
It's time for a new signature.
|
|
|
|
|
Richard MacCutchan wrote: the compiler will give you a much more useful message.
I don't know about that, you'd get "The left-hand side of an assignment must be a variable, property or indexer", which is true of course but it tells you to fix the wrong thing, it's saying that you should change the LHS into a variable. It's also saying that it's an assignment, but that just adds to the confusion because "there is no assignment, so the error makes no sense". OTOH, the "Cannot implicitly convert [type] to bool" is entirely clear, and since it's pointing to an expression in an if it tells you "you stuck something into an if that is not a bool " which is exactly what the problem is.
Or maybe I'm just used to that kind of error..
edit: I did not vote "bad answer" by the way, so don't get mad at me please
modified on Saturday, August 7, 2010 10:34 AM
|
|
|
|
|
it really should say
if() expects a boolean and "btnPause.Content" isn't a boolean nor convertible to one
and it could add
there is an assignment in your expression; did you intend to test for equality? if so use ==
Why can't error messages be very specific, after all the parser is specific when it checks things.
harold aptroot wrote: I did not vote "bad answer"
Neither did I, although I didn't like it much; the user should not change his habits just because the compiler lacks proper error reporting. The suggestion may be OK for C/C++, but doesn't help much for C# code.
|
|
|
|
|
suitably chastised ...
It's time for a new signature.
|
|
|
|
|
|
I thought it was a good idea, though I could never do that myself.
|
|
|
|
|
Here's a radical idea: why not throw out the '==' and '===' confusion and make the compiler use the single '=' as either an assignment or a comparative operator depending on the context, like VB does?
Oh yeah, because we don't want C# to be like VB with all the stigma associated with such simpleton languages. Sorry, I forgot.
|
|
|
|
|
I don't care much what symbol(s) get used for operators, I started out in Fortran which used .EQ. for equality testing.
However if assignment and equality test operators coincide, some semantics get lost, as in a=b==c versus a=b=c ; there is only so much context analysis can do.
|
|
|
|
|
You joke, but there's a lot of truth to that. you need the braces { and the weird 'for' syntax, the ++/-- operators and == for equality. it means it's a real programming language. Microsoft could have solved all of the technical problems without C#, by simply releasing .NET with only VB as the language, and it would simply have been the new version of VB, and the rest of us would be dealing with CString and MFC message maps. But now we get to implement IDispoable!
ken@kasajian.com / www.kasajian.com
|
|
|
|
|
Nope.
Firstly, there is no === in C#.
Secondly the 'inconvenience' of == is outweighed by its benefit. For example:
while((line = reader.ReadLine()) != null)
This would be more difficult to read (albeit probably less confusing) without the explicit identity equality operator:
line = reader.ReadLine();
while(line != null)
{
line = reader.ReadLine();
}
The second block has absolutely no intent locality (keeping the same ideas in the same place in code).
He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chineese Proverb]
Jonathan C Dickinson (C# Software Engineer)
|
|
|
|
|
Jonathan C Dickinson wrote: This would be more difficult to read (albeit probably less confusing) without the explicit identity equality operator:
Except your example uses the inequality operator.
It's time for a new signature.
|
|
|
|
|
I was talking hypothetically, i.e. if '=' was the identity equality operator; expressions like the one I used wouldn't work.
while((line == reader.ReadLine()) != null) { }
He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chineese Proverb]
Jonathan C Dickinson (C# Software Engineer)
|
|
|
|
|
Jonathan C Dickinson wrote: if '=' was the identity equality operator; expressions like the one I used wouldn't work.
I don't see that that follows, since the compiler would still recognise != as the not equals operator.
It's time for a new signature.
|
|
|
|
|
Hurm... The example doesn't need a == operator because it is demonstrating what is possible when a = and a == are distinct. With == around; = becomes more versatile. Because = is more versatile the example I gave is possible.
If there was only = (and no == ) the example I gave simply wouldn't work (you would get an warning saying that a boolean is never null). I think the mathematical term for this kind of 'proof' is proof by contradiction.
The compiler would recognize != as the not equals operator, BUT it would recognize the = as identity equality and not assignment. Thus the AST would look (where the VB-route is taken) something like this:
WHILESTMT(BOOLEXPR(BOOLEXPR("line", Operator.IdentityEquality, "reader.ReadLine"), Operator.IdentityInequality, NULL))
As opposed to (and why my example works):
WHILESTMT(BOOLEXPR(BOOLEXPR("line", Operator.Assign, "reader.ReadLine"), Operator.IdentityInequality, NULL))
More simply, the following expression results in a boolean type (and boolean value) in VB:
a = b
In C# is results in the type of 'a' (and the value contained by 'a'). Which is why these statements are possible:
int0 = int1 = int2 = int3 = int4 = 0; // Set all to 0.
He who asks a question is a fool for five minutes. He who does not ask a question remains a fool forever. [Chineese Proverb]
Jonathan C Dickinson (C# Software Engineer)
|
|
|
|