By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,824 Members | 1,247 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,824 IT Pros & Developers. It's quick & easy.

[MC++] LinkLabel usage

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.