469,582 Members | 2,316 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,582 developers. It's quick & easy.

[MC++] LinkLabel usage

I am having problems getting my LinkLabel hyperlink to work properly.
Every time I click on it, I get the following exception:

System.ComponentModel.Win32Exception: The requested lookup key was not found in any active activation context
at System.Diagnostics.Process.StartWithShellExecuteEx (ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName)
I placed the LinkLabel on the form using the Designer and set the Text
property to what I want displayed. Then in the form's constructor,
after the call to InitializeComponent(), I set the LinkData property:

linklabel_zlib->Links->Item[0]->LinkData = S"http://www.zlib.net/";

and my LinkLabel Clicked event handler looks like:

System::Void linkLabel_LinkClicked(Object * sender, System::Windows::Forms::LinkLabelLinkClickedEventA rgs * e)
{
using System::String;
using System::Windows::Forms::LinkLabel;

LinkLabel* link = __try_cast<LinkLabel*>(sender);

link->Links->Item[link->Links->IndexOf(e->Link)]->Visited = true;
String* target = __try_cast<String*>(e->Link->LinkData);
System::Diagnostics::Process::Start(target);
}

In the debugger, I have verified that "target" indeed holds the correct
URI.
I have also tried commenting this out and explicitly using the URI:

System::Void linkLabel_LinkClicked(Object * sender, System::Windows::Forms::LinkLabelLinkClickedEventA rgs * e)
{
System::Diagnostics::Process::Start(S"http://www.zlib.net/");
}

but I get the same exception.
Not sure if it's relevant, but my default browser is Mozilla Firefox.
This is on Windows XP Pro SP 2, .NET Framework 1.1, and VS .NET 2003.

Thanks for any hints.

--
Marcus Kwok
Apr 10 '06 #1
1 1571
Marcus Kwok <ri******@gehennom.net.invalid> wrote:
I am having problems getting my LinkLabel hyperlink to work properly.
Every time I click on it, I get the following exception:

System.ComponentModel.Win32Exception: The requested lookup key was not found in any active activation context
at System.Diagnostics.Process.StartWithShellExecuteEx (ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName)


Nevermind, I solved the problem.

--
Marcus Kwok
Apr 11 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by tota | last post: by
2 posts views Thread by Lev | last post: by
3 posts views Thread by vince | last post: by
4 posts views Thread by David Veeneman | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.