用Vim调用MSDN查询
来源:互联网 发布:微信开发源码 编辑:程序博客网 时间:2024/09/21 08:17
找了一下, 暂时发现有两种方案.
一,
原文:http://vim.wikia.com/wiki/Context_sensitive_access_to_MSDN_help
created November 3, 2006 · complexity basic · author gosaca · version 6.0
Access MSDN help for a specific keyword from gvim on Windows.
Add following to gvimrc:
nmap <F1> :silent ! start iexplore "http://www.google.com/search?hl=en&btnI=I\%27m+Feeling+Lucky&q=site\%3Amsdn.microsoft.com\%20<cWORD>"<CR>
This accomplishes the following:
- Starts a new instance of Internet Explorer.
- Navigates to Google search.
- Limits the search to site msdn.microsoft.com.
- Searches for the term under the cursor.
- Navigates the browser directly to the first page returned from the search.
For example, putting your cursor over WaitForSingleObject and hitting <F1> brings you directly to the documentation for that API on the MSDN site.
Use :set ch=2 to avoid the Hit Enter To Continue message.
The space between "!" and "start" is needed to avoid a "command not found" error. The space causes Vim to send the start command to the cmd.exe shell. Start is a cmd command, not a separate program.
CommentsEdit
Is there any reason that you don't search msdn directly? Something like:
nmap <F3> :silent !cmd /C start iexplore "http://search.msdn.microsoft.com/search/default.aspx?query=<cWORD>"<CR>;
The msdn search brings you to a search results page, from which you must click on another link to get the desired documentation.
Using Google's I'm Feeling Lucky feature navigates you directly to the first page returned by the search, which more often than not is the page you want (since you have limited your search to the msdn.microsoft.com site).
This closely replicates the function of context sensitive help via F1 when working in MSDEV.
In addition, you can always change the site: filter in the search query string to something other than msdn, if you aren't working on a win32 project.
用gvim 调browse到网上查询, 试了一下,效果很一般,,,,而且当网速不给力的时候就悲剧了,,不过实现就相对简单,
第二种
原址:
http://groups.google.com/group/vim-cn/tree/browse_frm/month/2008-06/7423d7f090bbe17e?rnum=31&_done=%2Fgroup%2Fvim-cn%2Fbrowse_frm%2Fmonth%2F2008-06%3F
主要程序为
/********callmsdn.c********** by reaky 2012-02-09 hunter modify the format ******************************/ #include <windows.h> int main(int argc, char *argv[]) { MSG msg; HWND hPaneWnd, hPaneLast, hCtlWnd; HWND hwndHelp; hwndHelp = FindWindow("HH Parent", "Microsoft Platform SDK, August 2001 Edition"); while(!IsWindow(hwndHelp)) { WinExec("D:\\MSDNLITE\\msdn.exe",SW_SHOW); Sleep(2000); //wait for the startup of msdn hwndHelp = FindWindow("HH Parent", "Microsoft Platform SDK, August 2001 Edition"); } ShowWindow(hwndHelp, SW_NORMAL); SetForegroundWindow(hwndHelp); //send ALT+N to the msdn window PostMessage(hwndHelp, WM_SYSKEYDOWN,0x4E,1<<29); hPaneWnd = FindWindowEx(hwndHelp, NULL, "HH Child", NULL); for (;;) // last HH Child { hPaneLast = FindWindowEx(hwndHelp, hPaneWnd, (LPCTSTR)("HH Child"), NULL); // last HH Child if (!hPaneLast) break; hPaneWnd = hPaneLast; } hCtlWnd = FindWindowEx(hPaneWnd, NULL, (LPCTSTR)("Button"), NULL); // skip Tab Control if (hCtlWnd) { hCtlWnd = FindWindowEx(hPaneWnd, NULL, (LPCTSTR)("Edit"), NULL); // skip Tab Control // Set window text SendMessage(hCtlWnd, WM_SETTEXT, 0, (LPARAM)argv[1]); // fill it by our query SendMessage(hwndHelp, WM_COMMAND, 0x00000bbe, 0); // 0x3f1 -- 'Display' button, it shows first item } else { MessageBox(NULL,"MSDN not found!","ATTENTION",MB_OK); } return 0; } #if 0/*callmsdn.c===>callmsdn.exe cl /O1 /nologo callmsdn.c /link /subsystem:windows /entry:"mainCRTStartup" /align:32 /MACHINE:x86 /RELEASE user32.lib kernel32.lib //Add this into the _vimrc nmap <C-F1> :silent !start callmsdn <cword><cr> 本人水平一般,望大牛改进。*/ #endif
上面这链接是一个思路,写一个程序,让VIM调用, 把需要查询的字符以参数形式传入这个自己写的程序中去.
程序的思路就是找到当前的MSDN窗口,如未启动就启动它,
把需要查询的字符传输入框之后,再发查询消息.
我试了一下,还是没有实现...可能是我装的MSDN2001与文中所写不太一致吧...
另外,介于本人是一个vim控, 如果最后能把MSDN的输出拦截,放到vim中去就好了.....
- 用Vim调用MSDN查询
- linux ubuntu c 查询函数 msdn vim 中查询函数
- MSDN 查询 笔记
- MSDN在线查询
- MSDN在线文档查询
- MSDN查询技巧
- 在vim中直接调用google code search查询代码
- 调用dll vc++(转自msdn)
- MSDN Oct2001 C++用
- msdn
- MSDN
- msdn
- mSDN
- msdn
- MSDN
- MSDN
- MSDN
- MSDN
- Hibernate的持久化类中什么时候需要重写hashcode()和equals()方法
- HttpHander与httpModel配置与应用
- 在PlayBook NDK中创建自己的Cocos2dx项目
- C/C++数组名与指针区别深入探索
- android常用代码
- 用Vim调用MSDN查询
- sql中时间日期操作(时间日期函数,时间日期格式,时间日期转换参数,时间日期比较,时间日期计算)
- db2 范围分区表常用命令
- spring 集成flex(2)
- StartUp.xls宏病毒清除方法(excel宏病毒)
- 药家鑫案遇害者亲属愿接受药父20万元赠款
- c++关键字详解
- 用ATL建立轻量级的COM对象
- fstatfs/statfs详解