Project1

标题: CallBackFunction... [打印本页]

作者: yangff    时间: 2011-7-13 14:03
标题: CallBackFunction...
  1. // dllmain.cpp : 定义 DLL 应用程序的入口点。
  2. #include "stdafx.h"

  3. BOOL APIENTRY DllMain( HMODULE hModule,
  4.                        DWORD  ul_reason_for_call,
  5.                        LPVOID lpReserved
  6.                                          )
  7. {
  8.         switch (ul_reason_for_call)
  9.         {
  10.         case DLL_PROCESS_ATTACH:
  11.         case DLL_THREAD_ATTACH:
  12.         case DLL_THREAD_DETACH:
  13.         case DLL_PROCESS_DETACH:
  14.                 break;
  15.         }
  16.         return TRUE;
  17. }
  18. typedef int haha(int a,int b,int c);
  19. int test(haha *acfun) //我继续自重去 = =
  20. {
  21.         acfun(50,555,59);
  22.         return 1;
  23. }heihe...
复制代码
  1. #你终于发现我在坑爹了么= = 晚了啊嫂年!
  2. require 'dl'
  3. require 'dl/callback'
  4. require 'dl/func'
  5. require 'Win32API'
  6. #以下代码我自重= = |
  7. include DL
  8. avfun=Win32API.new("RubyCBPTest.dll","test","l","l") #= =
  9. handle=set_cdecl_callback(DL::TYPE_LONG,3 ){|a,b,c| print "callback#{[a.to_i,b.to_i,c.to_i]}" ;0} #回掉函数a ,b ,c是CInt...
  10. avfun.call(handle.to_i) #API= =
复制代码

作者: 英顺的马甲    时间: 2011-7-13 14:22
什么来的?
作者: Losses    时间: 2011-7-13 16:16
haha= =! lz坏掉了
作者: link006007    时间: 2011-7-13 16:20
cdecl callback 不是1.9.2才有的吗。。。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1