I have GdPicture.NET.9
I installed the program, then registered the dll using framework 2.0 and created the tlb.
Then I generated the CLicenseManager and CGdPictureImaging classes from the tlb.
So far so good.
Then I tried the following code:
CLicenseManager* pLicenseManager = new CLicenseManager();
CGdPictureImaging* pGdImaging = new CGdPictureImaging();
long lImageID = pGdImaging ->CreateGdPictureImageFromFile(path_of_the_photo);
long lError = pGdImaging ->GetStat();
the lImageID and lError returned by both functions would be -858993460, and I'm not sure what steps I missed.
I am not sure if I actually need to instantiate a new class with GdPicture in COM, but I tried both instantiating and without.
I did realized the m_lpDispatch inside the classes are 0, but I'm not sure how to fix that.
The way you are creating the objects is wrong. Here is what you should be doing:
Code: Select all
CLicenseManager pLicenseManager; pLicenseManager.CreateDispatch(L"GdPicture10.LicenseManager"); pLicenseManager.RegisterKEY(L"XXXX"); // Please replace XXXX with your license key CGdPictureImaging pGdImaging; pGdImaging.CreateDispatch(L"GdPicture10.GdPictureImaging"); long lImageID = pGdImaging.CreateGdPictureImageFromFile(L"D:\test.jpg"); long lError = pGdImaging.GetStat(); pGdImaging.ReleaseGdPictureImage(lImageID);
So i'm trying to mess around with the program more and having trouble.
This takes in a SafeArray, below is my code.
When I ran it, the function returns "the parameter is incorrect".
I'm developing in VS 2005, that's why I'm using COleSafeArray instead of CComSafeArray
// lSizeOfMyByteArray is long and lpMyByteArray is BYTE FAR*
saPhoto.CreateOneDim(VT_UI1, (DWORD)lSizeOfMyByteArray, lpMyByteArray); // I've tried VT_I4 as well
LPSAFEARRAY psa = NULL;
long lImageID = gdImaging.CreateGdPictureImageFromByteArray(&psa);
I'm also trying to save the resulting image into memory, would you recommend using SaveAsStream or SaveAsByteArray?
I see that SaveAsStream outputs LPDISPATCH, how do I go about converting that into a usable format?
Who is online
Users browsing this forum: No registered users and 1 guest