[Editor Tool] VS2010 Help Integration

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

[Editor Tool] VS2010 Help Integration

Post by Danilo »

Here an IDE tool to search local VisualStudio2010 Help (Microsoft Help System 1.x):
Open_VS2010_Help

Image

I use H3Viewer as my VS2010 help browser, so ALT+F1 in the PureBasic IDE
opens h3viewer and displays search results for the word under the cursor.

Works also with constants like #WM_QUIT or #WM_LBUTTONDOWN and with structures like WNDCLASSEX.

The latest Windows SDK 7.1 uses VS2010 help, so this little tool should also work if you have
the latest Windows SDK.

For older SDKs and the VS2008 help system (MSHelp2), try edel's Launch Windows SDK.


For functions that end with '_' (like MessageBox_() and Beep_()) it opens the help
in a special mode by default for displaying the help for the command.
This does not always work correctly because the help mode is Visual C++. Sometimes it
opens a help page for a C++ or .NET class that has the same function as a method.

I put some WinAPI functions into an exception list to open help for this commands
correctly. If you find more WinAPI functions that open a wrong help page, i can add
them to the exception list as well if you tell me the function names.

To always open in search mode, use "-search" (without double quotes) as the argument
for the tool.


Version 2: added -search tool mode and some more WinAPI functions exceptions.
Version 3: 3658 API functions included from user32.lib, shell32.lib, gdi32.lib, kernel32.lib, ComCtl32.lib, ComDlg32.lib and winsock2
Last edited by Danilo on Sun Jan 29, 2012 1:09 pm, edited 1 time in total.
User avatar
luis
Addict
Addict
Posts: 3893
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: [Editor Tool] VS2010 Help Integration

Post by luis »

Thank you, just tried it and seems to work ok :)

I was still using the Windows Server 2003 R2 Platform SDK wit h2viewer specifying "MS.PSDKSVR2003R2.1033 /index %WORD" as parameter, so it was a good excuse to do an update.

Can I ask you if your program does something similar but using the h3viewer ?
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: [Editor Tool] VS2010 Help Integration

Post by Danilo »

luis wrote:Can I ask you if your program does something similar but using the h3viewer ?
H3Viewer does not display MSHelp2 content. It is only for the new "Microsoft Help System 1.x"
that comes with VS2010, VS2010 Express and the Windows SDK 7.1.

The PSDK 2003 help is another format, you can not view it with H3Viewer.

BTW: My tool does not require H3Viewer. It just opens your default viewer for MS Help System 1.x.
User avatar
luis
Addict
Addict
Posts: 3893
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: [Editor Tool] VS2010 Help Integration

Post by luis »

Danilo wrote: The PSDK 2003 help is another format, you can not view it with H3Viewer.
I was using H2viewer for that.
Danilo wrote: BTW: My tool does not require H3Viewer. It just opens your default viewer for MS Help System 1.x.
I see ! It was using the browser, now I'm using the h3viewer with its agent, I like it more.

Thanks!
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: [Editor Tool] VS2010 Help Integration

Post by Danilo »

Version 3: 3658 API functions included from user32.lib, shell32.lib, gdi32.lib, kernel32.lib, ComCtl32.lib, ComDlg32.lib and winsock2

Please download again. Should work much better now for ApiFunctions_() from this libraries. :)
User avatar
luis
Addict
Addict
Posts: 3893
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: [Editor Tool] VS2010 Help Integration

Post by luis »

Indeed, thank you, seems to work well :)

Did you get the exported functions lists directly from the libs (DLL) or in some other way ?
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: [Editor Tool] VS2010 Help Integration

Post by Danilo »

luis wrote:Did you get the exported functions lists directly from the libs (DLL) or in some other way ?
Got it from MS Platform SDK 7.1 import libs:

Code: Select all

@echo off
@call "D:\CPP\PellesC\x86\Bin\povars32.bat"
@POLIB.exe ComCtl32.lib /MACHINE:x86 /MAKEDEF:ComCtl32.def
@POLIB.exe ComDlg32.lib /MACHINE:x86 /MAKEDEF:ComDlg32.def
@POLIB.exe Gdi32.lib    /MACHINE:x86 /MAKEDEF:Gdi32.def
@POLIB.exe Kernel32.lib /MACHINE:x86 /MAKEDEF:Kernel32.def
@POLIB.exe Shell32.lib  /MACHINE:x86 /MAKEDEF:Shell32.def
@POLIB.exe User32.lib   /MACHINE:x86 /MAKEDEF:User32.def
@POLIB.exe WS2_32.lib   /MACHINE:x86 /MAKEDEF:WS2_32.def
@pause
After that a small code converts it to data strings, so

Code: Select all

LIBRARY "GDI32.dll"
EXPORTS
"_AbortDoc@4" ; GDI32.dll
"_AbortPath@4" ; GDI32.dll
"_AddFontMemResourceEx@16" ; GDI32.dll
"_AddFontResourceA@4" ; GDI32.dll
"_AddFontResourceExA@12" ; GDI32.dll
"_AddFontResourceExW@12" ; GDI32.dll
is converted to

Code: Select all

   Data.s "AbortDoc"
   Data.s "AbortPath"
   Data.s "AddFontMemResourceEx"
   Data.s "AddFontResource"   ; automatically added for functions with A and W at end
   Data.s "AddFontResourceA"
   Data.s "AddFontResourceEx" ; auto added
   Data.s "AddFontResourceExA"
   Data.s "AddFontResourceExW"
You can also make import libs and defs directly from DLLs if you want (not sure why you ask).

Code: Select all

@echo off
@call "D:\CPP\PellesC\x86\Bin\povars32.bat"
@POLIB.exe gdiplus.dll     /MACHINE:x86 /OUT:gdiplus_x86.lib
@POLIB.exe gdiplus_x86.lib /MACHINE:x86 /MAKEDEF:gdiplus_x86.def
@pause
User avatar
luis
Addict
Addict
Posts: 3893
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: [Editor Tool] VS2010 Help Integration

Post by luis »

Thanks for the detailed reply, I asked because that's the idea I had to generate the lists (exporting from the dlls and then do some processing as you shown) and I was thinking if there was a better way or not.

I noticed (installing the SDK you linked) the GDI+ functions (the flat API) seem to be missing, it's the same in your installation or I did something wrong ?
I noticed the same thing in the past anyway, I never had a MSDN or a SDK installed with the GDI+ docs on it.
I had to look on Internet when I needed them.
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: [Editor Tool] VS2010 Help Integration

Post by Danilo »

luis wrote:I noticed (installing the SDK you linked) the GDI+ functions (the flat API) seem to be missing, it's the same in your installation or I did something wrong ?
I noticed the same thing in the past anyway, I never had a MSDN or a SDK installed with the GDI+ docs on it.
I had to look on Internet when I needed them.
The flat API is not documented, but the classes that are based on it. In .NET it is in System.Drawing.
Press ALT+F1 on "GdipCreatePen1" (with my tool installed) and you get a search result that
shows you how the flat API pen functions map to the C++ Pen Class.
The C++ classes are included as source in the GdiPlus*.h headers, for example GdiPlusPen.h.

I have the "GDI+ Reference" bookmarked in H3Viewer, just search for "GDI+ Reference" and
make a bookmark. Online it is there: GDI+ Reference and it is available offline too
(i have whole MSDN docu installed offline, 6.2GB for German/English).
From that starting Point you look in "Classes", for example "Classes -> Graphics.DrawImage()" and
you browse the GdiPlus*.h headers all the time. :)

I have installed my tool 2 times in the PB IDE. First ALT+F1 without arguments as shown in
the picture above, second time ALT+F2 with -search argument. If ALT+F1 does not show
me nice results i hit ALT+F2 for searching again. Maybe you want to do the same.


Here my code to convert the POLIB .def to Data.s .pbi: Def2pbi.pb

Code: Select all

Global NewList functions.s()
Global count = 0

Procedure addfunc(s.s)
    If Asc(s)='"'
        s = Mid(s,2)
        If Asc(s)='_'
            s = Mid(s,2)
        EndIf
        x = FindString(s,"@",2)
        If x>1
            s = Left(s,x-1)
            s = ReplaceString(s,"@","")
        Else
            Debug "NO @ symbol in: "+s
            x = FindString(s,#DQUOTE$,1)
            s = Left(s,x-1)
            Debug s
        EndIf
        LastElement( functions() )
        AddElement( functions() )
        functions() = s
        If Right(s,1)="A" Or Right(s,1)="W"
            found = 0
            newfunc.s = Left(s,Len(s)-1)
            ForEach functions()
                If functions() = newfunc
                    found = 1
                EndIf
            Next
            If Not found
                LastElement( functions() )
                AddElement( functions() )
                functions() = newfunc
                ;Debug "auto added "+newfunc
            EndIf
        EndIf
    EndIf
EndProcedure

Procedure Def2pbi(filename.s)
    ClearList( functions() )
    If ReadFile(0,filename)
        While Not Eof(0)
            addfunc(ReadString(0))
        Wend
        CloseFile(0)
        If CreateFile(1,filename+".pbi")
            SortList( functions() ,#PB_Sort_Ascending )
            ForEach functions()
                WriteStringN(1,"   Data.s "+#DQUOTE$+functions()+#DQUOTE$)
                count + 1
            Next
            CloseFile(1)
        Else
            Debug "cant create file "+filename+".pbi"
        EndIf
    EndIf
EndProcedure

Def2pbi("ComCtl32.def")
Def2pbi("ComDlg32.def")
Def2pbi("Gdi32.def")
Def2pbi("Kernel32.def")
Def2pbi("Shell32.def")
Def2pbi("User32.def")
Def2pbi("WS2_32.def")

Debug Str(count)+" functions written."
Just modify it for your needs, the functions are in the linkedlist and you can change
the part where it is written into the .pbi. No need to do the same again yourself. ;)
User avatar
luis
Addict
Addict
Posts: 3893
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: [Editor Tool] VS2010 Help Integration

Post by luis »

Thanks for the suggestions and the code :)
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
luis
Addict
Addict
Posts: 3893
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: [Editor Tool] VS2010 Help Integration

Post by luis »

Danilo, could you tell me if your tool works under Windows 8.1 too ?

For the reason why I'm asking this please see this thread -> http://www.purebasic.fr/english/viewtop ... =4&t=57311

If it doesn't work, could tell me if you are using RunProgram and if yes could you try with ShellExecute(Ex) to see if it does make a difference ?

Thanks
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: [Editor Tool] VS2010 Help Integration

Post by Danilo »

luis wrote:Danilo, could you tell me if your tool works under Windows 8.1 too ?
I have only VisualStudio 2013 installed on Win8.1 for now. Just tried H3Viewer and it is not compatible to VS2013 help.
Maybe I will install old VS2008/VS2010/VS2012 later, or I will look how to access VS2013 help system from PB.
Quick test shows that "ms-xhelp:" protocol does not work. Microsoft Help Viewer 2.1 uses "ms-xhelp:///" internally,
but the protocol is not registered within the Win8.1 system, only internally used by Visual Studio 2013.

I will check that later. Can't help for now, sorry.
(Playing with my new Microsoft Surface 2 /64GB Win8.1 tablet now, it's just awesome... ;))
Last edited by Danilo on Fri Nov 08, 2013 12:18 pm, edited 2 times in total.
User avatar
luis
Addict
Addict
Posts: 3893
Joined: Wed Aug 31, 2005 11:09 pm
Location: Italy

Re: [Editor Tool] VS2010 Help Integration

Post by luis »

Danilo wrote: Quick test shows that "ms-xhelp:" protocol does not work. Microsoft Help Viewer 2.1 uses "ms-xhelp:///" internally,
but the protocol is not registered within the Win8.1 system, only internally used by Visual Studio 2013.
Oh, a bad surprise, if you find a way please let us know. I'll keep using vs2010 for now.
A good thing is the local documentation can be updated from what is available online.

Anyway the problem I was talking about in the other thread seems to be identified now, will see.

Thanks and have fun with your new toy :wink:

PS: I know you are using Dash on Mac, on Win there is a simpler version compatible with its helpfiles: Zeal (http://zealdocs.org/)
"Have you tried turning it off and on again ?"
A little PureBasic review
User avatar
Danilo
Addict
Addict
Posts: 3036
Joined: Sat Apr 26, 2003 8:26 am
Location: Planet Earth

Re: [Editor Tool] VS2010 Help Integration

Post by Danilo »

luis wrote:PS: I know you are using Dash on Mac, on Win there is a simpler version compatible with its helpfiles: Zeal (http://zealdocs.org/)
Thanks, looks interesting.
Last edited by Danilo on Sun Nov 10, 2013 8:59 pm, edited 1 time in total.
Nico
Enthusiast
Enthusiast
Posts: 274
Joined: Sun Jan 11, 2004 11:34 am
Location: France

Re: [Editor Tool] VS2010 Help Integration

Post by Nico »

Impossible for me to extract Open_VS2010_help.exe in the zip, can you post the file only?
Post Reply