none
How to use Help View 2 in standalone Winform app similar to VS Package Help2 from DTE2 RRS feed

  • Question

  • Hello,

     We are successfully obtaining a DTE2 object and then the Help2 object to connect our context id names with triggering the Help Viewer 2 in a VS package but can’t seem to do the same outside of VS.

     Here’s a sample of how we handle getting it okay from the VS package code:

    dte2 = Package.GetGlobalService(typeof(DTE)) as DTE2;
    help2 = (Help2) dte2.GetObject("Help2");

     Then we can set out context id like this:

    helpId = “MYFORMCONTEXTIDHERE”;
    help2.DisplayTopicFromF1Keyword(helpId);

    Within VS this works fine for our package.  However, the winform app version can’t get the DTE2 object as no instance of VS is running.  For instance, an example like this:

    dte2 = (DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.11.0");

    won’t work as there’s no VS instance.

    Given all this…and us not wanting to use the older CHM HelpProvider winforms approach, is there any way we can achieve what the package version is doing in a pure Winforms application?

    Thanks,
    Michael

    Thursday, November 13, 2014 9:21 PM

Answers

  • Hi Michael,

    Thanks for your friendly response.

    Since it is not the VS IDE issue, I moved your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will
    direct you to a right forum.
    Appreciate your patience.

    If it is the WinForm development issue, you could post it to the Winform general forum here:

    https://social.msdn.microsoft.com/Forums/windows/en-US/home?forum=winforms

    Since this case opens for a long time, to help you resolve this issue as soon as possible, if the moderator forum experts provide a better forum for this issue, you could post a new case to that forum,  You know that the new case would get more attention from communicated members:)

    If you get any VS IDE issue, welcome to the VS General forum.

    Sincerely,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, November 26, 2014 2:18 AM

All replies

  • Hi Michael,

    Thank you for posting in the MSDN forum.

    Based on your description, I’m afraid that it is not the correct forum for this issue, since this forum is to discuss:

    Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.

    To help you find more useful information or find the correct forum for this issue, would you mind letting us know more information about it?

    It is the WinForm developing issue, am I right?

    You said that you use the DTE 2 object, is it related to the VS extension?

    >> However, the winform app version can’t get the DTE2 object as no instance of VS is running.  For instance, an example like this:

    dte2 = (DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.11.0");

    won’t work as there’s no VS instance.

    I did some research about it, the following case and document shared some information about the “Get References to the DTE and DTE2 Objects”, it seems that it also shares some information about “Get an instance of the currently running Visual Studio IDE” like the code here:

    // Get an instance of the currently running Visual Studio IDE.
    
    EnvDTE80.DTE2 dte2;
    
    dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.
    
    GetActiveObject("VisualStudio.DTE.11.0");
    

    Reference:

    http://msdn.microsoft.com/en-us/library/vstudio/68shb4dw(v=vs.110).aspx

    Another case:

    http://stackoverflow.com/questions/21986644/use-addin-project-in-another-application

    If still no help, I might not have the correct detailed answer you need, but I might lead you into the right direction to solve your problem.

    If it is the WinForm developing issue, you could select the correct forum here:

    https://social.msdn.microsoft.com/Forums/windows/en-US/home?forum=winformsdesigner%2Cwinforms%2Cwinformsdatacontrols&filter=alltypes&sort=lastpostdesc

    If it is related to the VS extension, maybe this forum would be better for you:

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vsx

    If I have misunderstood this issue, please feel free to let me know, I will help you find the correct forum for this issue as soon as possible.

    Best Regards,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, November 14, 2014 3:15 AM
  • Hi Jack,

    This issue is related to a Winforms project.  Unlike getting the DTE2 object in a VS addin or package, when Visual Studio isn't running, and you're only running your Winforms application, you can't use this approach.  The problem is "GetActiveObject"...Visual Studio isn't running so it won't work.  It seems you either would have to use the older Winforms HelpProvider chm (which I don't want to use) or the Help Viewer 2.0 API which isn't what I'm after either.  And I think I read there was a Windows 8 way, but I need something that works on Win 7.

    Michael

    Friday, November 14, 2014 9:19 PM
  • hi Michael

    look  at Microsoft Help Viewer 2 Runtime API Samples


    Please use Mark as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    Friday, November 14, 2014 10:10 PM
  • Hi Michael,

    Could you get useful information from Daniel's suggestion?

    Would you mind letting us know the latest information about this issue?

    You know that actually this forum is to discuss the VS IDE usage, if still no help, and it is related to the WinForm development, I suggest you post this issue to the WinForm forum here:

    https://social.msdn.microsoft.com/Forums/windows/en-US/home?forum=winformsdesigner%2Cwinforms%2Cwinformsdatacontrols&filter=alltypes&sort=lastpostdesc

    And there you would get dedicated support from the WinForm members.

    Sincerely,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, November 20, 2014 2:02 AM
  • We were hoping to use a Help2 object to call the help engine (Help Viewer 2) like we do from within the IDE...But it looks like for a standard Winforms/standalone exe you can't obtain a Help2 object.  We didn't want to have to re-write or handle things differently after we have a Help2 object.  The issue is getting one though as standalone exe.  The approach we used by getting the DTE2 object within the IDE can't be used in a standard exe like this as you have to get it by the running IDE process...Which we won't have as a standard exe. 

    Separately, I was going to just move this to a different forum as suggested, but I don't see an option to do that.  Would I need to somehow mark this as "dead" and just post a new (same as this) issue in a different forum?  I see mention of trying to post in a winforms forum...Is there a specific one so I don't get told I'm in the wrong one again?

    Thanks,

    Michael


    Michael

    Tuesday, November 25, 2014 4:24 PM
  • Hi Michael,

    Thanks for your friendly response.

    Since it is not the VS IDE issue, I moved your question to the moderator forum ("Where is the forum for..?"). The owner of the forum will
    direct you to a right forum.
    Appreciate your patience.

    If it is the WinForm development issue, you could post it to the Winform general forum here:

    https://social.msdn.microsoft.com/Forums/windows/en-US/home?forum=winforms

    Since this case opens for a long time, to help you resolve this issue as soon as possible, if the moderator forum experts provide a better forum for this issue, you could post a new case to that forum,  You know that the new case would get more attention from communicated members:)

    If you get any VS IDE issue, welcome to the VS General forum.

    Sincerely,

    Jack


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Wednesday, November 26, 2014 2:18 AM