GDI+可以动态加载吗?解决思路
GDI+可以动态加载吗?
我用的是这个 http://www.mitov.com/html/igdi_.html
我想实现这样的效果:如果系统中有GDI+库,则使用GDI+;没有GDI+库,则不使用GDI+,并且不会引起异常。
可以把它转化成这个形式吗:
如果这样的话,工作量会很大。有没有现成的动态GDI+包下载?或者有其他的一些办法?
------解决方案--------------------
好像是有,没有的话,自己写个程序,将静态的函数声明转换为动态的
------解决方案--------------------
xp系统就开始自带 Gdiplus.dll 了。。
GdiplusStartup 是初始化gdi+的
------解决方案--------------------
你看一下DEV的dxGDIPlusAPI单元。。
------解决方案--------------------
{ GDI+ loading }
procedure GdiPlusLoad;
const
DefaultStartup: GdiplusStartupInput =
(GdiplusVersion: 1;
DebugEventCallback: nil;
我用的是这个 http://www.mitov.com/html/igdi_.html
我想实现这样的效果:如果系统中有GDI+库,则使用GDI+;没有GDI+库,则不使用GDI+,并且不会引起异常。
可以把它转化成这个形式吗:
unit RT_tags;
interface
uses
Windows;
var
TAGS_Read: function (handle: DWORD; const fmt: PAnsiChar): PAnsiChar; stdcall;
TAGS_GetLastErrorDesc: function : PAnsiChar; stdcall;
TAGS_GetVersion: function : DWORD; stdcall;
var BassTag_Handle : Thandle = 0;
function Load_BassTagDLL(const dllfilename : string) : boolean;
procedure Unload_BassTagDLL;
implementation
function Load_BassTagDLL(const dllfilename : string) : boolean;
var
oldmode : integer;
begin
if BassTag_Handle <> 0 then // is it already there ?
result := true
else begin {go & load the dll}
oldmode := SetErrorMode($8001);
BassTag_Handle := LoadLibrary(pchar(dllfilename)); // obtain the handle we want
SetErrorMode(oldmode);
if BassTag_Handle <> 0 then
begin {now we tie the functions to the VARs from above}
@TAGS_Read := GetProcAddress(BassTag_Handle, 'TAGS_Read');
@TAGS_GetLastErrorDesc := GetProcAddress(BassTag_Handle, 'TAGS_GetLastErrorDesc');
@TAGS_GetVersion := GetProcAddress(BassTag_Handle, 'TAGS_GetVersion');
// check if everything is linked in correctly
if (@TAGS_Read = nil){ or
(@TAGS_GetLastErrorDesc = nil) or
(@TAGS_GetVersion = nil)} then
begin
FreeLibrary(BassTag_Handle);
BassTag_Handle := 0;
end;
end;
result := (BassTag_Handle <> 0);
end;
end;
procedure Unload_BassTagDLL;
begin
if BassTag_Handle <> 0 then
FreeLibrary(BassTag_Handle);
BassTag_Handle := 0;
end;
end.
如果这样的话,工作量会很大。有没有现成的动态GDI+包下载?或者有其他的一些办法?
------解决方案--------------------
好像是有,没有的话,自己写个程序,将静态的函数声明转换为动态的
------解决方案--------------------
xp系统就开始自带 Gdiplus.dll 了。。
GdiplusStartup 是初始化gdi+的
------解决方案--------------------
你看一下DEV的dxGDIPlusAPI单元。。
------解决方案--------------------
{ GDI+ loading }
procedure GdiPlusLoad;
const
DefaultStartup: GdiplusStartupInput =
(GdiplusVersion: 1;
DebugEventCallback: nil;