Hi all,
I'm trying to use a .net api from unmanaged MFC code.
I'm trying to use ClrCreateManage dInstance api, but as shown above,
my
var pDisp equals null before the ClrCreateManage dInstance call.
Can you correct my code ? (Or any other way to do that ?)
#include "mscoree.h"
#pragma comment (lib, "mscoree.li b")
CComPtr<IDispat chpDisp;
HRESULT hr = S_OK;
hr = ClrCreateManage dInstance(L"Sys tem.Windows.For ms.MessageBox,
System.Windows. Forms, Version=2.0.507 27.42, Culture=neutral ,
PublicKeyToken= b77a5c561934e08 9",IID_IDispatc h, (void**)&pDisp) ;
Thansk in advance for your help,
Best,
S. 4 3169
On 13 avr, 15:08, timor.su...@gma il.com wrote:
Hi all,
I'm trying to use a .net api from unmanaged MFC code.
I'm trying to use ClrCreateManage dInstance api, but as shown above,
my
var pDisp equals null before the ClrCreateManage dInstance call.
Can you correct my code ? (Or any other way to do that ?)
#include "mscoree.h"
#pragma comment (lib, "mscoree.li b")
CComPtr<IDispat chpDisp;
HRESULT hr = S_OK;
hr = ClrCreateManage dInstance(L"Sys tem.Windows.For ms.MessageBox,
System.Windows. Forms, Version=2.0.507 27.42, Culture=neutral ,
PublicKeyToken= b77a5c561934e08 9",IID_IDispatc h, (void**)&pDisp) ;
Thansk in advance for your help,
Best,
S.
Let me add some information, if i try with System.Random that is part
of mscorlib
this :
hr =
ClrCreateManage dInstance(L"Sys tem.Random,msco rlib,PublicKeyT oken=b03f5f7f11 d50a3a",
IID_IManagedObj ect, (void**)&pWrap) ;
is working :)
but if i try with my own assembly :
hr = ClrCreateManage dInstance(L"MyA ssembly.Class1, MyAssembly",
IID_IDispatch, (void**)&pDisp) ;
i have the hresult : E_NOINTERFACE value
Nb : my assembly isn't strong signed
Thanks for your answer
<ti*********@gm ail.comwrote in message
news:11******** *************@e 65g2000hsc.goog legroups.com...
On 13 avr, 15:08, timor.su...@gma il.com wrote:
>Hi all,
I'm trying to use a .net api from unmanaged MFC code.
I'm trying to use ClrCreateManage dInstance api, but as shown above, my var pDisp equals null before the ClrCreateManage dInstance call.
Can you correct my code ? (Or any other way to do that ?)
#include "mscoree.h" #pragma comment (lib, "mscoree.li b")
CComPtr<IDispat chpDisp; HRESULT hr = S_OK; hr = ClrCreateManage dInstance(L"Sys tem.Windows.For ms.MessageBox, System.Windows .Forms, Version=2.0.507 27.42, Culture=neutral , PublicKeyToken =b77a5c561934e0 89",IID_IDispat ch, (void**)&pDisp) ;
Thansk in advance for your help,
Best,
S.
Let me add some information, if i try with System.Random that is part
of mscorlib
this :
hr =
ClrCreateManage dInstance(L"Sys tem.Random,msco rlib,PublicKeyT oken=b03f5f7f11 d50a3a",
IID_IManagedObj ect, (void**)&pWrap) ;
is working :)
but if i try with my own assembly :
hr = ClrCreateManage dInstance(L"MyA ssembly.Class1, MyAssembly",
IID_IDispatch, (void**)&pDisp) ;
What compiler version is your assembly built with? Did you call
CorBindToRuntim eEx? If not, the documentation indicates that the .NET 1.0
runtime gets loaded and you won't be able to load newer assemblies.
>
i have the hresult : E_NOINTERFACE value
Nb : my assembly isn't strong signed
Thanks for your answer
<ti*********@gm ail.comwrote in message
news:11******** *************@e 65g2000hsc.goog legroups.com...
On 13 avr, 15:08, timor.su...@gma il.com wrote:
>Hi all,
I'm trying to use a .net api from unmanaged MFC code.
I'm trying to use ClrCreateManage dInstance api, but as shown above, my var pDisp equals null before the ClrCreateManage dInstance call.
Can you correct my code ? (Or any other way to do that ?)
#include "mscoree.h" #pragma comment (lib, "mscoree.li b")
CComPtr<IDispat chpDisp; HRESULT hr = S_OK; hr = ClrCreateManage dInstance(L"Sys tem.Windows.For ms.MessageBox, System.Windows .Forms, Version=2.0.507 27.42, Culture=neutral , PublicKeyToken =b77a5c561934e0 89",IID_IDispat ch, (void**)&pDisp) ;
Thansk in advance for your help,
Best,
S.
Let me add some information, if i try with System.Random that is part
of mscorlib
this :
hr =
ClrCreateManage dInstance(L"Sys tem.Random,msco rlib,PublicKeyT oken=b03f5f7f11 d50a3a",
IID_IManagedObj ect, (void**)&pWrap) ;
is working :)
but if i try with my own assembly :
hr = ClrCreateManage dInstance(L"MyA ssembly.Class1, MyAssembly",
IID_IDispatch, (void**)&pDisp) ;
Maybe ClrCreateManage dInstance doesn't load the assembly for you. Try
loading System.Reflecti on.Assembly from mscorlib, and call Assembly.Load.
See http://msdn2.microsoft.com/en-us/lib...ft(VS.80).aspx
>
i have the hresult : E_NOINTERFACE value
Have you set the COMVisibleAttri bute on your class?
>
Nb : my assembly isn't strong signed
Thanks for your answer
<ti*********@gm ail.comwrote in message
news:11******** **************@ p77g2000hsh.goo glegroups.com.. .
Hi all,
I'm trying to use a .net api from unmanaged MFC code.
I'm trying to use ClrCreateManage dInstance api, but as shown above,
my
var pDisp equals null before the ClrCreateManage dInstance call.
Can you correct my code ? (Or any other way to do that ?)
#include "mscoree.h"
#pragma comment (lib, "mscoree.li b")
CComPtr<IDispat chpDisp;
HRESULT hr = S_OK;
hr = ClrCreateManage dInstance(L"Sys tem.Windows.For ms.MessageBox,
System.Windows. Forms, Version=2.0.507 27.42, Culture=neutral ,
PublicKeyToken= b77a5c561934e08 9",IID_IDispatc h, (void**)&pDisp) ;
Thansk in advance for your help,
Best,
S.
You can't instantiate S.W.F.MessageBo x, because it has a private constructor
:-)
Marcus This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: jason mazzotta |
last post by:
Hi,
I'm rather new to both MySQL and PHP. I've been trying to use PHP to
write to a MySQL database. I call mysql_pconnect to get a database
connection, but then when I call mysql_db_select, I get the following
error :
Unknown MySQL Server Host 'localhost '
I can connect to the database via the command line ok. Where can I
look to find...
|
by: Jeff |
last post by:
Is there a way to echo back a case sensitive $HTTP_HOST in PHP? For
example if I type HostName.domain.com in my browser I want to return it
exactly as it appears in the location part of the browser
"HostName.domain.com" but it keeps returning a case insensitive result
"hostname.domain.com".
|
by: Dave |
last post by:
I know that Remoting requires a host application on the
server. Is it possible to use COM+ as the host? If so,
where can a good example be found?
|
by: Tim |
last post by:
I am in the process of moving a site from one hosting company to another.
This site is fairly large, with hundreds of asp files, each with multiple
"include" statements.
The new host has a different webspace folder structure for it's clients than
the old host. At the moment, this is forcing me to have to append all the
paths for all the...
|
by: ytrewq |
last post by:
Should dynamic ("expando") properties be restricted to native and
user-defined objects? Or should host objects - such as references to
the browser or a plug-in or to the document and its elements - also
allow them?
Adding (and removing) object properties dynamically is an acceptable
and common practice in JavaScript, and greatly adds to the...
| |
by: Jeff |
last post by:
I have an ASP.NET web page accessing a SQL database. I've used VS to build
the app and stored it in the eNPTest02 directory of my localhost on my
development machine. The database is on the web. I've found a way that
works on the web, and I'm trying to get it to also work in debug mode in the
IDE. The "on the web" page and my SQL database...
|
by: Brian Henry |
last post by:
is there a way to get the host name of someone? like mine is
68-23-123-123-pitt-pa.adelphia.net?
Request.UserHostName doesn't seem to return the host name like it states in
the documentation, only gives me back an IP address.. which is what I
assumed Request.UserHostAddress would do... they both return the same values
all the time
|
by: zxo102 |
last post by:
Hi,
I am doing a small project using socket server and thread in python.
This is first time for me to use socket and thread things.
Here is my case. I have 20 socket clients. Each client send a set
of sensor data per second to a socket server. The socket server will
do two things: 1. write data into a file via bsddb; 2. forward the data
to...
|
by: misha |
last post by:
Hello.
I was wandering if someone could explain to me (or point to some
manual) the process of mapping the addresses of host variables by DB2.
Especially I would like to know when DB2 decides to reinitialize the
addresses and even more when it decides not to do it.
Recently I've ben strucked with a problem of host variables defined in...
|
by: Krice |
last post by:
There is a component class inside the host class:
class Host
{
Component *c;
....
In some cases Component needs to call the host and
I guess the only way is that you pass the host for it:
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
|
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...
| |