|
-
Dec 30th, 2005, 07:52 AM
#1
Thread Starter
New Member
NON standard COM Interface
Hi, i want to use a DLL which doesn't use a standard COM interfaces for creating objects.
Since it uses non standard COM interface, when i add a reference to it, it gives an error.
can anyone throw some light on it.....
Btw, im trying to implement 7zip algorithm to compress some files using vb. i have got the dlls from the developer from the site: www.7-zip.org/sdk.html
any help shall be highly appreciated....
regards,
Hussu
-
Dec 30th, 2005, 09:20 AM
#2
Re: NON standard COM Interface
-
Dec 30th, 2005, 09:29 AM
#3
Re: NON standard COM Interface
First off, it's either COM or it isn't. There's no such thing as "non-standard COM interface" - that would be a contradiction.
Next, if you can't set a reference to it, then it's not a COM-creatable object. That means it's more likely to be a standard C-style DLL. And that means API calls. Judging by the contents listed in the SDK, that's where I would be looking. You'll need to get a description of the API calls that you can make with it and include the necessary Declare statements to get to the API functions.
-tg
-
Dec 30th, 2005, 10:24 AM
#4
Thread Starter
New Member
Re: NON standard COM Interface
Hello Mod,
thx for the link but that wont help, that gives a standard zip compression which i already have. I need 7zip compression only.
Hello tg,
i will be writing to the developers if they can provide me with some assistance with the API declaration. will get back asap.
regards,
Hussu
-
Dec 30th, 2005, 11:14 AM
#5
Re: NON standard COM Interface
You shouldn't need to. It should all be in the SDK. At worst, it's in the header (.h) file(s). Simply look through it for the function(s) you need, translate it into the VB equivelent and use it as the Declare line.
-tg
-
Dec 31st, 2005, 01:14 PM
#6
Thread Starter
New Member
Re: NON standard COM Interface
i checked out the source, its written in c++ and uses com interface... im pasting the dllexports.cpp file code here, for u to have a look... i really cant figure out y it cant be used in vb as reference....
i can do it as u had told me but still i dunno what parameters to pass..... this dll is to creating a compressed archive....
regards,
Hussu
// DLLExports.cpp
#include "StdAfx.h"
#include "../../../Common/MyInitGuid.h"
#include "../../../Common/ComTry.h"
#ifdef _WIN32
#include "../../../Common/Alloc.h"
#endif
#include "../../ICoder.h"
#include "7zHandler.h"
#ifndef EXCLUDE_COM
// {23170F69-40C1-278B-06F1-070100000100}
DEFINE_GUID(CLSID_CCrypto7zAESEncoder,
0x23170F69, 0x40C1, 0x278B, 0x06, 0xF1, 0x07, 0x01, 0x00, 0x00, 0x01, 0x00);
#else
#include "../../Compress/LZ/IMatchFinder.h"
#endif
HINSTANCE g_hInstance;
#ifndef _UNICODE
bool g_IsNT = false;
static bool IsItWindowsNT()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(versionInfo);
if (!::GetVersionEx(&versionInfo))
return false;
return (versionInfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}
#endif
extern "C"
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
g_hInstance = hInstance;
#ifndef _UNICODE
g_IsNT = IsItWindowsNT();
#endif
#ifdef _WIN32
SetLargePageSize();
#endif
}
return TRUE;
}
STDAPI CreateObject(
const GUID *classID,
const GUID *interfaceID,
void **outObject)
{
COM_TRY_BEGIN
*outObject = 0;
if (*classID != NArchive::N7z::CLSID_CFormat7z)
return CLASS_E_CLASSNOTAVAILABLE;
if (*interfaceID == IID_IInArchive)
{
CMyComPtr<IInArchive> inArchive = new NArchive::N7z::CHandler;
*outObject = inArchive.Detach();
}
#ifndef EXTRACT_ONLY
else if (*interfaceID == IID_IOutArchive)
{
CMyComPtr<IOutArchive> outArchive = new NArchive::N7z::CHandler;
*outObject = outArchive.Detach();
}
#endif
else
return E_NOINTERFACE;
COM_TRY_END
return S_OK;
}
STDAPI GetHandlerProperty(PROPID propID, PROPVARIANT *value)
{
NWindows::NCOM::CPropVariant propVariant;
switch(propID)
{
case NArchive::kName:
propVariant = L"7z";
break;
case NArchive::kClassID:
{
if ((value->bstrVal = ::SysAllocStringByteLen(
(const char *)&NArchive::N7z::CLSID_CFormat7z, sizeof(GUID))) != 0)
value->vt = VT_BSTR;
return S_OK;
}
case NArchive::kExtension:
propVariant = L"7z";
break;
case NArchive::kUpdate:
propVariant = true;
break;
case NArchive::kKeepName:
propVariant = false;
break;
case NArchive::kStartSignature:
{
if ((value->bstrVal = ::SysAllocStringByteLen((const char *)NArchive::N7z::kSignature,
NArchive::N7z::kSignatureSize)) != 0)
value->vt = VT_BSTR;
return S_OK;
}
}
propVariant.Detach(value);
return S_OK;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|