Link to home
Start Free TrialLog in
Avatar of svfafel
svfafel

asked on

Wrapping a COM dll

Is there a way to wrap a COM dll with a Windows 32-bit dll?  I am working with an application that can only "talk" with windows dll's.  

Any help would be appreciated...
ASKER CERTIFIED SOLUTION
Avatar of VincentLawlor
VincentLawlor

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of svfafel
svfafel

ASKER

If that is the case, is there anyway to write a Windows 32-bit DLL in vb?
For this task i code an interface Dll which can communicate with the COM dll through an self defined interface and then call this one.

Hope that helps
;) WoK
No way you must write you dll with C++
...
>>If that is the case, is there anyway to write a Windows 32-bit DLL in vb?

No.

You will have to write it in C++.

What does youre DLL do ?

Vin.
I may be able to help with the C++ code.

Vin.
Avatar of svfafel

ASKER

Wolfgang or Vincent:

This DLL simply connects to a SQL server and executes a stored procedure that returns messages.  Fairly simple.

I would rather not rewrite the DLL in C++ (i don't know how) but is there a way to wrap it with ease?

I appreciate any input you can offer...

- Steve
>>I am working with an application that can
only "talk" with windows dll's.

What does the API for this DLL look like ?

You won't be able to do this without using C++.

Vin.  

Avatar of svfafel

ASKER

Vincent, do you have any sample C++ code that i could look at?  Maybe something using ADO?  something that might help?

Or

Wolfgang, do you have any sample code of wrapping a COM dll?
I'll have a look and get back to you.

What do you want to do ?

Vin.
Avatar of svfafel

ASKER

I would like either:
1.  to wrap my COM dll in C++
or
2.  to write a Windows dll that uses basic ADO functionality (recordset, command object, etc)

Anything you could provide would be helpful...

- STeve
Avatar of Richie_Simonetti
Interesting...
Here's a thought: you say that your application (the one that needs to talk to the VB DLL) can oly "talk" to 32-bit DLLs. I don't know the language and the capabilities of that application, but it is possible to create objects and talk to them using sheer DLL calls. COM is written to be accessed by any language and - although it'll be a tough task to tackle - it can be done using functions already defined in system DLLs.

The function to look for is CoCreateInstance(Ex). Now I hope that you have an easy way of dealing with V-tables, otherwise you should create just a tiny wrapper in C++ only to call functions by name on a certain pointer (the fn should utilize AddRef, Release and QeryInterface calls at least, and possibly remove the burden of calling Invoke, GetIDsOfNames, GetTypeInfo and GetTypeInfoCount). That way you have a method of calling into any VB COM object, but you'll have to tackle quite a lot, I think.

Abel
Instead of creating a wrapper, I think it can also be done using only API calls. Think of utilizing DispGetIdsOfNames and DispInvoke, in adjunction with other helper function like SafeArrayAccessData, VariantInit, VariantClear, VariantCopy, SysAllocString, SysFreeString and the likes. Those are needed to deal with VARIANTs and BSTRs. You can look them all up in the MSDN documentation.
svfafel:

You have many open questions:

https://www.experts-exchange.com/jsp/qShow.jsp?qid=20151411
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20142486
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20152290
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20153618
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20155682
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20169125
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20175800
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20180978
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20190767
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20169126
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20146852
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20128521
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20134835
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20136451

To assist you in your cleanup, I'm providing the following guidelines:

1.  Stay active in your questions and provide feedback whenever possible. Likewise, when feedback has not been provided by the experts, commenting again makes them receive an email notification, and they may provide you with further information. Experts have no other method of searching for questions in which they have commented, except manually.

2.  Award points by hitting the Accept Comment As Answer button located above and to the left of that expert's comment.

3.  When grading, be sure to read:
https://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp#3
to ensure that you understand the grading system here at EE. If you grade less than an A, you must explain why.

4.  Questions that were not helpful to you should be PAQ'd (stored in the database for their valuable content?even if not valuable to you) or deleted. To PAQ or delete a question, you must first post your intent in that question to make the experts aware. Then, if no experts object after three full days, you can post a zero-point question at community support to request deletion or PAQ. Please include the link(s) to the question(s).
CS:  https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
At that point, a moderator can refund your points and PAQ or delete the question for you. The delete button does not work.

5.  If you fail to respond to this cleanup request, I must report you to the Community Support Administrator for further action.

Our intent is to get the questions cleaned up, and not to embarrass or shame anyone. If you have any questions or need further assistance at all, feel free to ask me in this question or post a zero-point question at CS. We are very happy to help you in this task!


thanks!
amp
community support moderator

2/6
Avatar of svfafel

ASKER

Thank you all for the input....apologies for the delay...

We came up with an alternate solution at this time....