Accessing DDK Help from Visual Studio

One of the biggest benefits of the Windows DDK is the bountiful information included in the HTML help collections. Unfortunately, there are a few pitfalls along the path toward help nirvana.

People sometimes have problems accessing help after installing the DDK on Windows 98/SE/ME. The symptom is a complaint that "Help is unable to open the file ...help/winddk.col". A similar problem occurs on machines that dual-boot more than one operating system, in that the DDK help is not accessible except under the OS where you installed the DDK. Finally, installing a new version of the DDK doesn't upgrade the information in the MSDN collection you can access from Visual Studio. The root cause of all these problems is that the help collections are not registered correctly.

In this brief article, I'll explain how you can register a help collection so that it becomes easily accessible in your development environment.

Before you do anything, though, be sure you're running Internet Explorer 6.0 with Service Pack 1 or later: the HTML help that comes with the DDK isn't compatible with earlier versions of IE. 

Registering a help collection:

You can write the following throwaway console program to register a help collection. This program uses an undocumented entry point into the HHCOL.DLL file to construct and register a collection index:

#include <windows.h>
#include <stdio.h>

typedef long (*PFNCREATECOLLECTION)( char const *, char const * );

int main( int argc, char ** argv )
{
  SetErrorMode( SEM_NOOPENFILEERRORBOX );
  HMODULE hDll = LoadLibrary( "HHCOL.DLL" );
  if( hDll == INVALID_HANDLE_VALUE )
  {
    printf( "Whoops, HHCOL.DLL was not found./n" );
    return -1;
  }

  PFNCREATECOLLECTION pfnCreateCollection = (PFNCREATECOLLECTION)
    GetProcAddress(
      hDll,
      "?CreateCollection@@YGJPBD0@Z"
      );

  pfnCreateCollection(
    "C://WINDDK//4242//help", // collection directory name
    "D://X86//hh.dat"
    );

  FreeLibrary( hDll );
  return 0;
}

In this example, I assumed that you're starting with a Windows DDK disc, version 4242 (a made-up number) in the D-drive and that you've already installed that DDK into, say, the C:/WINDDK/4242 directory. Note that you need to run this program from a current directory where HHCOL.DLL lives. I found it in the X86 directory, which is also where I found HH.DAT. If you're going to do this often, use command line arguments in place of the literal constants in the call to the CreateCollection routine.

What's going on here is that CreateCollection scans the HH.DAT file in order to construct an index of the HTML help files in the given directory, and it registers the resulting index as a collection in whatever way is appropriate to the operating system. Registration is all you need to do in order to access the collection by double-clicking the .COL file.

Incidentally, if you want to use the DDK help under a different OS on the same computer, simply copy and edit the HH.DAT file to change the Collection name that appears in the very first line of the file.

Accessing help from Visual Studio:

For many years, the MSDN library did not include the DDK documentation. People who do their development work in the Visual Studio integrated development environment were frustrated that they couldn't just hit F1 and get help about, say, KeReadProgrammersMind. Microsoft now includes DDK help entries in the MSDN library, but that information doesn't get updated when you install a new DDK. If you're installing every new beta DDK as it comes out, you'll be getting stale information by pressing F1 in the IDE.

You can make a few simple changes to the registry in order to persuade Visual Studio to use the DDK help collection instead of MSDN. Pop into regedit and surf to this key:

HKLM
  /Software
    /Microsoft
      /HTML Help Collections
        /Developer Collections
          /0x0409

Create a subkey under the "0x0409" key with any name you wish, such as "0x12345678". The value is supposed to be a date value, but nothing ever checks that it really is a date. Under this key, set the default value to some mnemonic name, like "DDK Documentation", add a REG_DWORD value called "Full" and set the value to 1, and add a REG_SZ value called "Filename" and set it to the path for the .COL file. 

If you'd rather not wade through these instructions, just cut-and-paste the following snippet to a text file called "collect.reg", make sure the pathname in the "Filename" string is correct, and call "regedit collect.reg". 

REGEDIT4

[HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/HTML Help Collections/Developer Collections/0x0409/0x12345678]
@="DDK Documentation"
"Filename"="C://WINDDK//2600//help//WINDDK.COL"
"Full"=dword:00000001

After you import that file, you can use the regular Visual Studio 6 Tools menu to make the DDK your current help collection, after which F1 will do what it is supposed to do.

About the author:

Tim Roberts is a partner in Providenza & Boekelheide, Inc., a technology consulting company in Tigard, Oregon. Tim does video, graphics, capture, multimedia, and USB drivers for  operating systems from Windows to CE to Linux.

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值