It is currently Fri May 24, 2013 7:09 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: [Editor Tool] VS2010 Help Integration
PostPosted: Sun Jan 29, 2012 12:35 am 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 1290
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.

Top
 Profile  
 
 Post subject: Re: [Editor Tool] VS2010 Help Integration
PostPosted: Sun Jan 29, 2012 1:07 am 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 31, 2005 11:09 pm
Posts: 2240
Location: Italy
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 ?

_________________
[ Home ] [ My PC ] [ New to PB ? ]


Top
 Profile  
 
 Post subject: Re: [Editor Tool] VS2010 Help Integration
PostPosted: Sun Jan 29, 2012 1:41 am 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 1290
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.


Top
 Profile  
 
 Post subject: Re: [Editor Tool] VS2010 Help Integration
PostPosted: Sun Jan 29, 2012 1:53 am 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 31, 2005 11:09 pm
Posts: 2240
Location: Italy
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!

_________________
[ Home ] [ My PC ] [ New to PB ? ]


Top
 Profile  
 
 Post subject: Re: [Editor Tool] VS2010 Help Integration
PostPosted: Sun Jan 29, 2012 1:11 pm 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 1290
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. :)


Top
 Profile  
 
 Post subject: Re: [Editor Tool] VS2010 Help Integration
PostPosted: Sun Jan 29, 2012 6:50 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 31, 2005 11:09 pm
Posts: 2240
Location: Italy
Indeed, thank you, seems to work well :)

Did you get the exported functions lists directly from the libs (DLL) or in some other way ?

_________________
[ Home ] [ My PC ] [ New to PB ? ]


Top
 Profile  
 
 Post subject: Re: [Editor Tool] VS2010 Help Integration
PostPosted: Mon Jan 30, 2012 12:19 am 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 1290
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:
@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:
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:
   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:
@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


Top
 Profile  
 
 Post subject: Re: [Editor Tool] VS2010 Help Integration
PostPosted: Mon Jan 30, 2012 12:42 am 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 31, 2005 11:09 pm
Posts: 2240
Location: Italy
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.

_________________
[ Home ] [ My PC ] [ New to PB ? ]


Top
 Profile  
 
 Post subject: Re: [Editor Tool] VS2010 Help Integration
PostPosted: Mon Jan 30, 2012 1:17 am 
Offline
Addict
Addict
User avatar

Joined: Sat Apr 26, 2003 8:26 am
Posts: 1290
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:
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. ;)


Top
 Profile  
 
 Post subject: Re: [Editor Tool] VS2010 Help Integration
PostPosted: Mon Jan 30, 2012 3:59 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 31, 2005 11:09 pm
Posts: 2240
Location: Italy
Thanks for the suggestions and the code :)

_________________
[ Home ] [ My PC ] [ New to PB ? ]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye