getprocaddress,当第二个参数为序数的时候,如何指定,直接用数字是不行的蒙了一把,用pchar(8)可以使用,但总觉得不正规,望指点

解决方案 »

  1.   

    The GetProcAddress function returns the address of the specified exported dynamic-link library (DLL) function. FARPROC GetProcAddress(    HMODULE hModule, // handle to DLL module  
        LPCSTR lpProcName  // name of function 
       );
     ParametershModuleIdentifies the DLL module that contains the function. The LoadLibrary or GetModuleHandle function returns this handle. lpProcNamePoints to a null-terminated string containing the function name, or specifies the function's ordinal value. If this parameter is an ordinal value, it must be in the low-order word; the high-order word must be zero.  Return ValuesIf the function succeeds, the return value is the address of the DLL's exported function.
    If the function fails, the return value is NULL. To get extended error information, call GetLastError. If this parameter is an ordinal value, it must be in the low-order word; the high-order word must be zero. 
    如果参数是序数值,必须在低2字节上,高2字节必须为0.也就是序数范围0~65535.
      

  2.   

    用MFC写的话,是LPSTR “数字”,估计Delphi就是PANSIchar了 
      

  3.   

    其实就是强制转换下参数类型。高2字节为0,这样GetProcAddress函数就不会认为那参数是一个pchar指针,反之高2字节非0,则代表该参数是一个pchar指针。