|
Thank you, this was helpfull!
Cheers!
|
|
|
|
|
Yes, the WebBrowser Control uses the settings you defined while using Internet Explorer. It also shares a lot of code with IE.
For your own web pages, you can set all style attributes within your pages themselves, using either HTML, XHTML or better yet CSS.
For exisiting pages, I don't know if and how you can programmatically alter the IE settings (and I would not like an app that modifies how IE works without me asking it to do so). Well, actually I don't use IE that much, there are even better browsers around
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Hi,
In the list view i've couple of temporary items and they are staying at the bottom of the list, when i do sorting i dont want to include those two rows how to do that?
Thanks
|
|
|
|
|
Only way I know is to remove them, sort the list and then add them again, unless you inherit from the list view and provide your own custom enumeration.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
BalajiRamasamy wrote: Adding items at bottom in List View
Hi there,
Try this, maybe you could like use it on a Button click event or something...:
int i = listView1.Items.Count;
listView1.Items.Add("NEW-ITEM", i++);
--------
First, we define an Integer (i) and assign it the value of the total amount of items in the listView1 control, then we add an item at the bottom of the list by incrementing the total item amount by 1.
Hope this helps
regards,
jase
|
|
|
|
|
I did exactly the same, but after sorting what ever i add it automatically gets sorted and placed at the top, it is not listening me
|
|
|
|
|
Something like this:
this.listView1.Clear();
this.listView1.Items.Add("Item 2");
this.listView1.Items.Add("Item 1");
this.listView1.Sorting = SortOrder.Ascending;
this.listView1.Sort();
this.listView1.Sorting = SortOrder.None;
this.listView1.Items.Add("Temp1");
this.listView1.Items.Add("Temp2");
|
|
|
|
|
I could not find the ip address of my internet server.
i used the code to find the server ip but it only fetch my local LAN ip address.
i want to know the IP that given by my ISP through C# Windows Application code.
or
And i use web browser control, how to find the IP address of the URL.
Because by using PHP i get the IP using RemoteObject with the browser URL.
how i got that same by using that control in C# Windows Application.
by Vasanth.A
|
|
|
|
|
Hi,
The solution requires the help from a web server. This[^] should help you out.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
thank you,
but i want to find through C# code
give me exameple
|
|
|
|
|
In order to get the out-side-world IP address, you have to talk to the outside world as it is shared between the various users on the LAN. Google for "whats my IP" and you will get lots of hits about it.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
You can get the ip address(es) from an host name with the following code:
System.Net.Dns.GetHostEntry(hostname).AddressList;
This method will retrieve all the ip addresses corresponding to a given host, documentation here.
For example, if hostname is "www.google.com" you will get:
{System.Net.IPAddress[6]}
[0]: {74.125.39.105}
[1]: {74.125.39.106}
[2]: {74.125.39.103}
[3]: {74.125.39.104}
[4]: {74.125.39.99}
[5]: {74.125.39.147}
|
|
|
|
|
Except that if you use it on yourself, you will get your LAN address.
|
|
|
|
|
Well, if he passes the external dns address of the server, I think he will get the external ip address, or am I wrong?
|
|
|
|
|
Only if he can get the external dns address in the first place, which might not even exist
Btw, I didn't 1-vote you, it didn't seem that bad - just "not exactly what he asked for", his question sortof half implies that it's all a local thing
|
|
|
|
|
No problem, I was not arguing with you, only clarifying what I had in mind while answering to the OP.
I was more concentrated on his second question (getting the IP address from the browser url) that might imply he knows the external address.
|
|
|
|
|
Hm yea, you got a point
Well he's not saying anything yet, but I guess we'll find out
|
|
|
|
|
Hi, normally I wouldn't recommend it, but please check my article - it gives you the information you need to get your public IP address with C# (and just C#) without cheats (not using external websites that may disappear at any moment)
The second thing, I don't know.
|
|
|
|
|
Hi all.
I've spent 3 days searching for this and trying different alternatives, but nothing works.
I have an app which works perfectly on Windows XP:
1) Monitorizes some windows.
2) When one of them reaches a certain state, my app brings it to the foreground.
3) Then, does something with it (moves the mouse, clicks something...).
4) Finally, my app brings to the foreground the window that was visible before step 2, so the user can resume his work where he was before.
My problem is that, when I execute this app on Windows Vista, the step 4) seems not to work. I've been reading a lot these days, and I've found that the "SetForegroundWindow()" method I was using works differently on Vista, so I started using "AttachThreadInput()" following an example that I found somewhere:
private void activateWindow(IntPtr hWnd)
{
if (IsIconic(hWnd))
ShowWindowAsync(hWnd, SW_RESTORE);
ShowWindowAsync(hWnd, SW_SHOW);
SetForegroundWindow(hWnd);
IntPtr foregroundWindow = GetForegroundWindow();
IntPtr Dummy = IntPtr.Zero;
uint foregroundThreadId = GetWindowThreadProcessId(foregroundWindow, Dummy);
uint thisThreadId = GetWindowThreadProcessId(hWnd, Dummy);
if (AttachThreadInput(thisThreadId, foregroundThreadId, true))
{
BringWindowToTop(hWnd);
SetForegroundWindow(hWnd);
AttachThreadInput(thisThreadId, foregroundThreadId, false);
}
if (GetForegroundWindow() != hWnd)
{
IntPtr Timeout = IntPtr.Zero;
SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT, 0, Timeout, 0);
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, Dummy, SPIF_SENDCHANGE);
BringWindowToTop(hWnd);
SetForegroundWindow(hWnd);
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, Timeout, SPIF_SENDCHANGE);
}
}
From my app, I do the following when a timer ticks and finds that one of the background windows must be activated:
IntPtr originalWHwnd = GetForegroundWindow();
activateWindow(hWnd);
activateWindow(originalWHwnd);
That code still works on Windows XP, but still doesn't work on Vista: step 4 will not bring to foreground the first window.
Please, could you enlighten me?
Thanks in advance.
|
|
|
|
|
So it works the first time you call it, but not the second time? hmmm... does not sound logical to me.
perhaps you have an issue elsewhere. maybe your GetForegroundWindow() is not returning the correct handle (just an example)
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
You're right, could be something like that. But why would it fail only in Vista? I will debug it carefully when I can...
|
|
|
|
|
The thing you have to remember is that the user should always be in control of the PC. In the good old days of windows 95, any app could bring itself to the front to alert the user. After a while this created all kinds of problems because you would be typing away and other apps would be grabbing focus all over the place and interrupting your typing, (often catching your key presses and causing unexpected behaviour)
The powers that be realised that this was wrong and decided to fix it. So they changed things so apps couldn't bring them selves to the front, and instead just flashed the toolbar.
this is great except there are some people that still want to slam their apps to the foreground, so these people started working out ways round the restrictions (like the one you have used). Microsoft take note of these hacks and fix the problem for the next version.
The short story is that you should never be forcefully taking focus from what the user is doing. That is why vista doesn't support it. Instead you should flash the toolbar and wait for the user to respond to your app.
Simon
|
|
|
|
|
Thanks, Simon. Yes, these days I've read some explanations like yours and I knew why Microsoft made these changes.
I don't want to bring my own app to the foreground, but windows that were already open (by the user himself) before my app run. It's just as if the user would have pressed Alt+Tab and then interacted with those windows, only that my app automates this.
And the fact is that, if I want the window to be active, I can, in a messy way. As a last resort, I could set foreground window, and then move the mouse down and click the taskbar to activate the flashing window or something. But I don't think that's the way things must be done, and Microsoft should allow programmers to easily bring windows to the front (because, if not, they will do it anyway but in the hard way).
|
|
|
|
|
Hi,
I did some automation to have two apps exchange some data. It used the whole range of Get/SetForeGroundWindow, SendKeys, SendInput, and what have you. It runs fine on both XP and Vista, never had any trouble with it. I did develop on Vista (my main machine runs Vista, and I like it!), and it worked on XP right away. I just don't know if the reverse would also have worked right away.
I did implement automatic retries and a range of checks, e.g. after each SetForeGroundWindow, I wait some msec, then check by reading the title of the result of GetForeGroundWindow, to make absolutely sure I wasn't sending keyboard/mouse actions to the wrong app (the user, not me, might be touching the system while this automation is running).
BTW: I did not use AttachThreadInput, I hadn't even heard of it.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Thank you, I'll implement retries as well, maybe the problem can be solved with some delays here and there and SetForegroundWindow works after all...
I'll let you all know when I can test it, maybe next week. Thanks!
|
|
|
|
|