| |

VerySource

 Forgot password?
 Register
Search
View: 1550|Reply: 13

Find the static link solution of dll, or bmp to jpg source code

[Copy link]

3

Threads

29

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

Post time: 2020-1-10 22:40:01
| Show all posts |Read mode
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);
}
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-1-14 11:36:01
| Show all posts
The static link must have a lib file. You can use the CImage :: Save function to convert it.
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-1-14 12:45:01
| Show all posts
CBitmap bmp;
bmp.LoadBitmap (IDB_BITMAP1);

CImage image;
image.Attach (bmp);

image.Save ("c:\\aa", ImageFormatJPEG);
Reply

Use magic Report

0

Threads

57

Posts

27.00

Credits

Newbie

Rank: 1

Credits
27.00

 China

Post time: 2020-1-14 13:18:01
| Show all posts
You are writing a DLL, it is not enough to dynamically load this DLL, bridge it
Reply

Use magic Report

3

Threads

29

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

 Author| Post time: 2020-1-14 16:45:01
| Show all posts
2511718:
Halo, it's that simple? Where is CImage in the class? How can I not find it in msdn?

food0012:
Isn't there a path problem when bridging my dll to call that dll? I use it on the Web.
Reply

Use magic Report

0

Threads

24

Posts

19.00

Credits

Newbie

Rank: 1

Credits
19.00

 China

Post time: 2020-1-14 20:36:01
| Show all posts
Find a JpegLib.
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-1-15 14:00:01
| Show all posts
#include <atlimage.h>

CImage is a class in the atl library
Reply

Use magic Report

0

Threads

59

Posts

43.00

Credits

Newbie

Rank: 1

Credits
43.00

 China

Post time: 2020-1-15 21:54:02
| Show all posts
Maybe your computer does not have the atl library installed, which is usually installed by default in VC.
Reply

Use magic Report

3

Threads

29

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

 Author| Post time: 2020-1-15 22:27:01
| Show all posts
Let me take a look, then no other support is needed at the time of release?
Reply

Use magic Report

3

Threads

29

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

 Author| Post time: 2020-1-16 00:27:01
| Show all posts
Haha, it's installed but can't find it
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list