动态调用的几种写法
1 varTempGetWindowsDirectory : function (lpBuffer: PChar; uSize: UINT): UINT; stdcall;
begin
TempGetWindowsDirectory := GetProcAddress(LoadLibrary('kernel32.dll'),'GetWindowsDirectoryA');
end;
2
var
TempGetWindowsDirectory:function (lpBuffer: PChar; uSize: UINT): UINT; stdcall;
begin
@TempGetWindowsDirectory:= GetProcAddress(LoadLibrary('kernel32.dll'),'GetWindowsDirectoryA');
end;
3
var
TempHWND:HWND;//存取DLL返回的句柄
TempGetWindowsDirectory : function (lpBuffer: PChar; uSize: UINT): UINT; stdcall;
TempWord:LPCSTR;
begin
TempWord := 'GetWindowsDirectoryA';
TempHWND := LoadLibrary('kernel32.dll');
TempGetWindowsDirectory := GetProcAddress(TempHWND,TempWord);
end;
4
type
TempGetWindowsDirectory = function (lpBuffer: PChar; uSize: UINT): UINT; stdcall;
var
TempHWND:HWND;
TempWord:LPCSTR;
MSDirectory:TempGetWindowsDirectory;
bagin
TempWord := 'GetWindowsDirectoryA';
TempHWND := LoadLibrary('kernel32.dll');
MSDirectory :=GetProcAddress(TempHWND,TempWord);
end;
这不是VC的吧?
页:
[1]