|
There is a dll that converts bmp to jpg, no .h, no .lib, but it was successfully called by me, the code is attached at the back.
There is no problem in calling it in ordinary programs, but I call it in ActiveX, and I run into a path problem. My ActiveX finally needs to be packaged into a cab with this dll and released after digital signature.
My test found (not using cab, but two separate), ActiveX to find the dll on the desktop when using it on the Web, I guess it may be the path of IE shortcut. In this way, you cannot find the dll after packaging, because ActiveX and dll will be downloaded under the path C:\WINDOWS\Downloaded Program Files.
I think there should be no path problem with static linking, but there is no .h and even .lib. Can static linking be achieved?
Of course, there are other dlls or class source code that can provide bmp to jpg. You can use VC ++ 6, not C and VC ++. Net.
Attachment: dynamic link code
typedef bool (__ stdcall CHANGE) (char *, char *);
void CJpeg :: BmpToJpeg (CString Bmp, CString Jpeg)
{
HINSTANCE hInst;
CHANGE * pFunc;
hInst = :: LoadLibrary ("jpgdll.dll");
pFunc = (CHANGE *) :: GetProcAddress (hInst, "BmpToJpg");
pFunc (Bmp.GetBuffer (Bmp.GetLength ()), Jpeg.GetBuffer (Jpeg.GetLength ()));
Bmp.ReleaseBuffer ();
Jpeg.ReleaseBuffer ();
:: FreeLibrary (hInst);
} |
|