linkLabel_LinkClicked

With managed C++ what would I have to type on this linkLabel_LinkClicked code in order to make my link go to a website of my choice

#pragma endregion

private: System::Void linkLabel1_LinkClicked(System::Object^ sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs^ e) {

}

};

}




Answer this question

linkLabel_LinkClicked

  • Richard M Malone

    from what I can see on my computer i have Microsoft Platform SDK and it is under the directory C:\Program Files\Microsoft Platform SDK\

  • ondrej_bohaciak

    how would I use Process.Start and isn't it supposed to be Process::Start since it's C++ instead of C#

  • Soar

    Oh, you don't have a platform SDK installed, you're using Express. Express is kind of a half a Windows C++ compiler, IMO. You can use Process.Start instead, which is the .NET way to do things. I guess you've abandoned standard C++ anyhow ( not that ShellExecute is standard C++, it's part of the Windows SDK libraries ).



  • et3ishak

    ok I put that code in and I got these errors:

    ------ Build started: Project: linktest, Configuration: Debug Win32 ------

    Compiling...

    linktest.cpp

    c:\documents and settings\removed\desktop\linktest\linktest\Form1.h(88) : error C2039: 'm_hWnd' : is not a member of 'linktest::Form1'

    c:\documents and settings\removed\desktop\linktest\linktest\Form1.h(22) : see declaration of 'linktest::Form1'

    c:\documents and settings\removed\desktop\linktest\linktest\Form1.h(89) : error C2065: 'SW_SHOW' : undeclared identifier

    c:\documents and settings\removed\desktop\linktest\linktest\Form1.h(88) : error C3861: 'ShellExecute': identifier not found

    Build log was saved at "file://c:\Documents and Settings\removed\Desktop\linktest\linktest\Debug\BuildLog.htm"

    linktest - 3 error(s), 0 warning(s)

    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



  • soccerdude1000

    yeah I read it and I go t the following errors:

    ------ Build started: Project: linktest, Configuration: Debug Win32 ------

    Compiling...

    linktest.cpp

    c:\documents and settings\removed\desktop\linktest\linktest\Form1.h(88) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option

    When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^

    c:\documents and settings\removed\desktop\linktest\linktest\Form1.h(88) : error C3921: Use of S-prefixed strings requires /clr:oldSyntax command line option

    When compiling with /clr, an implicit conversion exists from string literal type to System::String^. If necessary to avoid ambiguity, cast to System::String^

    c:\documents and settings\removed\desktop\linktest\linktest\Form1.h(88) : error C2653: 'Process' : is not a class or namespace name

    c:\documents and settings\removed\desktop\linktest\linktest\Form1.h(88) : error C3861: 'Start': identifier not found

    Build log was saved at "file://c:\Documents and Settings\removed\Desktop\linktest\linktest\Debug\BuildLog.htm"

    linktest - 4 error(s), 0 warning(s)

    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



  • shark312

    I do have a Platform SDK installed, it's just with Express.

  • Darin Tomack

    Did you read the link I gave you It has an example. Process::Start DOES work, the example code on the MSDN site goes over it in depth. System::Uri is unlikely to be what you want.



  • vky

    System::Process::Start doesn't work but how about System::Uri

    can you think of anything to type after that, when I type that in I've got a ton of options (too many to list).



  • Brad King

    The most obvious error is that you have not put the URL in quotes. I meant that my example was using a variable that contained the URL.

    Beyond that, maybe you need System::Process::Start



  • Dude987

    If you have the PSDK installed and configured, you should have access to ShellExecute



  • Etherline

    OK, I guess it's something that's just core, and not in the SDK, and is still removed from Express. Process.Start is probably better, as you're committing to .NET anyhow. I would just steer people away from .NET if they are using C++, so they learn stuff that can move to non-.NET projects.



  • sujun

    Yes, it probably is Process::Start. To be honest, I use C++ and C# both every day, but I'd never consider using managed C++, so I'm pretty much answering because it's a .NET question, so I gave the C# syntax.

    http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpref/html/frlrfsystemdiagnosticsprocessclassstarttopic.asp

    Process::Start(myURL);

    where myURL is just the URL as a string.



  • FrenchStudent

  • swathi237

    This is the code I put in:

    #pragma endregion

    private: System::Void linkLabel1_LinkClicked(System::Object^ sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs^ e) {

    Process::Start(www.google.com);

    }

    };

    }

    and these are the errors I got:

    ------ Build started: Project: linktest, Configuration: Debug Win32 ------

    Compiling...

    linktest.cpp

    c:\documents and settings\removed\desktop\linktest\linktest\Form1.h(88) : error C2653: 'Process' : is not a class or namespace name

    c:\documents and settings\removed\desktop\linktest\linktest\Form1.h(88) : error C3861: 'Start': identifier not found

    Build log was saved at "file://c:\Documents and Settings\removed\Desktop\linktest\linktest\Debug\BuildLog.htm"

    linktest - 2 error(s), 0 warning(s)

    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========



  • linkLabel_LinkClicked