Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Name: Leo the 28C (by Sulfurik)
Hello everyone! :D
OK, I've seen many apps that have TextBoxes that highlight URL's when you type them in, and when you click on those URL's, they open up your browser with that URL in the address bar... My question is, where can I download a C# control that does this? Or do I have to code my own? How? Thanks! ;)http://www.boredsource.c
om/eltrucha/
http://tsfc.ath.cx
ftp://tsfc.ath.cx
hotline://tsfc.ath.cxLittle Johnny took a drink
but he shall drink no more.
For what he thought was H2

Code your own, its easy enough. Use the Create Process API and providing the text box contains a properly formed URL, the CreateProcess API will load you default browser and run the URL.
You can use the FindExecutable API to find which is your default browser.
I can show you how to do it in VB, but in C# you are on your own.
Stuart

Hmm... all of those API's are for VB only... :S Or is it in a Windows DLL? Which one? Thanks! ;)
http://www.boredsource.c
om/eltrucha/
http://tsfc.ath.cx
ftp://tsfc.ath.cx
hotline://tsfc.ath.cxLittle Johnny took a drink
but he shall drink no more.
For what he thought was H2

There is no such thing as a VB API. APIs can be used by any language as they are part of the operating system. VB,C++, C# and many others. The only difference is the syntax. Do a search on at Microsoft to find them. All the examples are in C++ so you may have to adjust them for C# of which I know nothing.
Stuart

OK, I found this on MSDN:
http://support.microsoft.com/default.aspx?scid=kb;en-us;174156#appliesto
But the examples are in VB...I kinda understand the VB syntax, but I don't know its functions, which there are many in the article... :Shttp://www.boredsource.c
om/eltrucha/
http://tsfc.ath.cx
ftp://tsfc.ath.cx
hotline://tsfc.ath.cxLittle Johnny took a drink
but he shall drink no more.
For what he thought was H2

All it is doing is creating a Dummy file with an HTML extension. It can be a zero length file.
The file name is then fed into the FindExecutalble API along with a dummy variable and fixed length string to receive the path name of the browser.
The string is then trimmed to remove extra spaces at the end then then fed into ShellExecute which is similar to CreateProcess but not so flexible.
The ShellExecute API contains the handle of the currently running task, the "open" command, the path name to the browser in the variable BrowserExec, the URL to be opened, another dummy variable, and the a constant to define the way the windows is shown.
With both APIs is the value returned < 32 then an error occurred.
Finally the dummy file created earlier is killed off.
The only code there that is unique to VB is the bit that creates the dummy HTML file and the Trim command which trims spaces of the end of a string. MsgBox just displays a message in the screen with an OK button. I am sure you can work something out in C# to do the same.
Look here for a description of the APIs
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/findexecutable.asp
It says it applies to Wint NT and Windows 95 but it works fine under Winows XP and Windows 98.
Stuart

Well, I just decided I'll cancel that program since there's many around, but someday I'll need that, so I'll check out the links. Much thanks! ;)
http://www.boredsource.c
om/eltrucha/
http://tsfc.ath.cx
ftp://tsfc.ath.cx
hotline://tsfc.ath.cxLittle Johnny took a drink
but he shall drink no more.
For what he thought was H2

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |