放出AutoHotkey.dll的调用方法,喜欢做自己的AHK可以看看

来源:互联网 发布:汉邦高科软件下载 编辑:程序博客网 时间:2024/05/02 00:18

只是个例子,很简单的,可以实现AHK的IDE,我就懒得写了。

AutoHotkey.dll的源码和编译版都在官方有下载的,自己去搜索吧。

以下是VC6的代码:

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

typedef int (*ahkdll)(wchar_t *, wchar_t *, wchar_t *) ;
typedef int (*ahkReady)();

int main()
{
  
   // Load DLL file
   HINSTANCE hinstLib = LoadLibrary("AutoHotkey.dll");
   if (hinstLib == NULL)
   {
      printf("ERROR: unable to load DLL/n");
      return 1;
   }
  
   // Get function pointer
   ahkdll ahkdll_ = (ahkdll)GetProcAddress(hinstLib, "ahkdll");
   ahkReady ahkReady_ = (ahkReady)GetProcAddress(hinstLib, "ahkReady");
  
   if (ahkdll_ == NULL || ahkReady_ == NULL)
   {
      printf("ERROR: unable to find DLL function/n");
      FreeLibrary(hinstLib);
      return 1;
   }
  
   // Call function.
   ahkdll_(L"D://MyScript.ahk", L"", L"");
  
   // Wait for script to finish
   while (ahkReady_())
      Sleep(50);
   // Unload DLL file
   FreeLibrary(hinstLib);

   return 0;
}

来自: http://hi.baidu.com/creep345/blog/item/f0c9521cbab32b07304e15d7.html
原创粉丝点击