473,573 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling COM DLL interface function at run-time

I am using C++ unmanaged code, given a string to function name, i need
to be able to call the DLLs COM interface with the same name. How can i
do this in C++ unmanaged code?
thanks,
BRAMOIN

*** Sent via Developersdex http://www.developersdex.com ***

Nov 29 '05 #1
4 1868
Hi,

In order to call COM interface's method you need to go through the
following steps:

1. Create COM object
2. Query for the IDispatch interface
3. Call the IDispatch::Invo ke method passing as one of the arguments
the name of the method you want to execute

Everything is simple enough if the method do not have arguments.
However, if it has arguemts then the steps are the same but it may take
you a while to compose arguments for IDispatch::Invo ke method.

Regards,
Philip

-------------------------------------
BytesRoad.NetSu it - open source network library for .NET platform (C#,
FTP, Socks5 etc)
http://www.bytesroad.com
-------------------------------------

Nov 29 '05 #2
Philip,
What do you mean it may take me a while to compile the arguments? Is
there a method to this or something i need to know? Is there an example
you could point me to?
thanks,
BRAMOIN

*** Sent via Developersdex http://www.developersdex.com ***
Nov 29 '05 #3

"Meya-awe" <br*****@yahoo. com> wrote in message
news:u4******** *****@TK2MSFTNG P15.phx.gbl...
Philip,
What do you mean it may take me a while to compile the arguments? Is
there a method to this or something i need to know? Is there an example
you could point me to?
thanks,
BRAMOIN

*** Sent via Developersdex http://www.developersdex.com ***


You might get better answers when post your C++ question to
microsoft.publi c.dotnet.langua ges.vc, this NG is for CSharp.

Willy.

Nov 29 '05 #4
I am using C++. I receive invoke the IDispatch invoke and it comes back
with "Exception occured". How do i look to see what the exception was
from and what the problem is exactly?
thanks,
BRAMOIN

*** Sent via Developersdex http://www.developersdex.com ***
Dec 6 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3572
by: Gary | last post by:
sorry for not cross-posting originally (originally posted in the components subgroup) I seem to have run into two documented bugs whose workarounds are incompatible. What I have is an OCX written in VB 6 that has a few classes in it. Many of the methods of the OCX are used by ASP, and so far have worked fine. I recently added a COM...
30
3447
by: Joost Ronkes Agerbeek | last post by:
Why is it allowed in C++ to call a static member function of an object through an instance of that object? Is it just convenience? tia, Joost Ronkes Agerbeek
5
3024
by: Francesco Bochicchio | last post by:
Hi all, anybody knows if there is a (standard, portable) way to dinamically build a list of parameters to call a C function? Something like va_start & co, but to be used on the calling side? In other words, suppose that I have a generic pointer : void * f_ptr; I know that this pointer points to a fuction. I also know the function
19
2492
by: Deniz Bahar | last post by:
Hi, I would like to call one of my functions the exact name as an existing C library function (for example K&R2 exercises asks me to make an atof function). If I don't include the header with the declaration for the C library function (stdlib.h in this case) then define/declare my own function with the same name, am I safe? It seems to...
21
13808
by: Helge Jensen | last post by:
I've got some data that has Set structure, that is membership, insert and delete is fast (O(1), hashing). I can't find a System.Collections interface that matches the operations naturally offered by Sets. - ICollection cannot decide containment - IList promises indexability by the natural numbers, which is not achievable (since i hash...
3
1266
by: phl | last post by:
hi, I have a number of usercontrols which inherits a interface. the function in this interface is used to provide information about the usercontrol. I would like to call this function say when a button is clicked. I can do this by lot of hardcoding, as I have the usercontrol names stored and I can call this obligatory function like this:
3
1067
by: Ray Cassick \(Home\) | last post by:
I have several classes that has a public interface (nothing really different there :) ). 1) I would like to ensure that some classes can only be instantiated by a specific class type. 2) I would like to restrict some public methods from being called only from another certain class type. I was trying to figure out a way that I...
3
5054
by: Jerome Cohen | last post by:
AI am trying to call a third-party web service. this service expects an XML fragment that contains the request plus other parameter. adding the web reference created the syntax below(reference.vb). I changed the data type for the structure that contains the XML data from the default "String" to "xml.xmldocument" to enable easy filling of the...
6
1692
by: Lak | last post by:
Hi all I am trying to call a C# method (in a DLL) asynchronously from VB. I don't know how to do this. Any suggestion is appreciated. Thanks.
7
2668
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a C# logging assembly with a static constructor and methods that is called from another C# Assembly that is used as a COM interface for a VB6 Application. Ideally I need to build a file name based on the name of the VB6 application. A second choice would be a file name based on the # COM interface assembly. I have tried calling...
0
7705
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8032
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7796
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6424
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3734
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3739
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2223
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1310
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1044
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.