473,665 Members | 2,827 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bypassing the CCW

Hi,

I have a DLL that exposes COM interfaces.

One of the COM Object receives an IDispatch pointer. I know that this
IDispatch pointer is in fact a COM Callable Wrapper for a
System::Drawing ::Bitmap object. How can I get a reference to the .NET Bitmap,
bypassing the CCW?

ex:
HRESULT MyMethod( IDispatch* _CCWOfBitmap )
{
System::Drawing ::Bitmap* dotnetBitmap = MagicMethod( _CCWOfBitmap );

System::Drawing ::Color myColor = dotnetBitmap->GetPixel(1,1 );
// ... continuing enjoying .NET here...
}

Question: MagicMethod should do what to make this code working?

Thanks
Eric
Nov 17 '05 #1
3 1366
Try Marshal::GetCom InterfaceForObj ect

"Eric St-Onge" <er**********@c ommunity.nospam > wrote in message
news:42******** *************** ***********@mic rosoft.com...
Hi,

I have a DLL that exposes COM interfaces.

One of the COM Object receives an IDispatch pointer. I know that this
IDispatch pointer is in fact a COM Callable Wrapper for a
System::Drawing ::Bitmap object. How can I get a reference to the .NET
Bitmap,
bypassing the CCW?

ex:
HRESULT MyMethod( IDispatch* _CCWOfBitmap )
{
System::Drawing ::Bitmap* dotnetBitmap = MagicMethod( _CCWOfBitmap );

System::Drawing ::Color myColor = dotnetBitmap->GetPixel(1,1 );
// ... continuing enjoying .NET here...
}

Question: MagicMethod should do what to make this code working?

Thanks
Eric

Nov 17 '05 #2
Hi,

Thanks for quick reply...

How's this solve my problem since I receive a COM interface and want a .NET
Object? This API is actually the other way around from my understanding (it
returns an IntPtr).

In the sample bellow I need a replacement for MagicMethod with return a
reference to a .NET object...

Eric

"Marcus Heege" wrote:
Try Marshal::GetCom InterfaceForObj ect

"Eric St-Onge" <er**********@c ommunity.nospam > wrote in message
news:42******** *************** ***********@mic rosoft.com...
Hi,

I have a DLL that exposes COM interfaces.

One of the COM Object receives an IDispatch pointer. I know that this
IDispatch pointer is in fact a COM Callable Wrapper for a
System::Drawing ::Bitmap object. How can I get a reference to the .NET
Bitmap,
bypassing the CCW?

ex:
HRESULT MyMethod( IDispatch* _CCWOfBitmap )
{
System::Drawing ::Bitmap* dotnetBitmap = MagicMethod( _CCWOfBitmap );

System::Drawing ::Color myColor = dotnetBitmap->GetPixel(1,1 );
// ... continuing enjoying .NET here...
}

Question: MagicMethod should do what to make this code working?

Thanks
Eric


Nov 17 '05 #3
Have you looked at Marshal::GetTyp edObjectForIUnk nown?

--
Regards,
Nish [VC++ MVP]
"Eric St-Onge" <er**********@c ommunity.nospam > wrote in message
news:42******** *************** ***********@mic rosoft.com...
Hi,

I have a DLL that exposes COM interfaces.

One of the COM Object receives an IDispatch pointer. I know that this
IDispatch pointer is in fact a COM Callable Wrapper for a
System::Drawing ::Bitmap object. How can I get a reference to the .NET
Bitmap,
bypassing the CCW?

ex:
HRESULT MyMethod( IDispatch* _CCWOfBitmap )
{
System::Drawing ::Bitmap* dotnetBitmap = MagicMethod( _CCWOfBitmap );

System::Drawing ::Color myColor = dotnetBitmap->GetPixel(1,1 );
// ... continuing enjoying .NET here...
}

Question: MagicMethod should do what to make this code working?

Thanks
Eric

Nov 17 '05 #4

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

Similar topics

2
3230
by: Ben | last post by:
Hi all, I have written a web server that listens for requests: class MyHandler(BaseHTTPRequestHandler): def do_GET(self): if (self.path)=='/': data=makeList() else:
4
1266
by: Andy Lee | last post by:
Hi I have a bit of code which executes an SQL statement.on my webpage. If the execution fails i do not want a standard error coming up that asp normally shows - instead i would like something like if (cnn.execute) = failed Then 'Do This End If
2
11158
by: Jens Kalkbrenner | last post by:
MS SQL-Server 7.0 Bypassing recovery for database 'EfW_765' because it is marked IN LOAD. What does this mean? Our customer is backing up is maindatabase and is recovering it to this database for testing. Our custumer tries it serveral times and then the recovery works and the data are corrupt. I have written a little programm which does some selects to this database. The program is stopped during recovery but our customer beleves that...
1
1535
by: John Reading | last post by:
I belong to an association that features a searchable database. The results are doled out in pages with ten listings per page. I'd like to bypass this and view the whole or at least larger results. Below is the HTML code for a search for people with the job title "Director" in the database: https://Membership/Membership_directory.cfm?pn=2&qid=7789&rc=1033&ln=&fn=&jt=Director&cn=&cc= ...
4
1889
by: antonyliu2002 | last post by:
Let me try to make clear what my concern is. I think it is a pretty interesting one, which I think of while I am developing my web application. I have an authenticated/authorized web application. People have to login from http://mydomain.com/ to access the information on my site. For now, this is working fine. People cannot bypass the login form, any attempt to check out a page (if they happen to know the file name) will be...
0
2965
by: John Smith | last post by:
Hello, I am developing a VB.NET 2003 application that will use lots of Crystal Reports. Sometimes the users will preview a report in a Crystal report viewer, and sometimes they will send the report directly to the printer bypassing the Crystal report viewer altogether. When sending the job directly to the printer I use the PrintToPrinter command CR.PrintToPrinter(1, False, 0, 0)
1
1891
by: =?Utf-8?B?QXVzdGluIFN0ZXBoZW5z?= | last post by:
In my commercial financial application I run a deposit report. I use an option to copy the report to the Clipboard. I then run a .NET consol app to “grab” the Clipboard and format the data and print laser deposit tickets. I use the following to set my printer: PrintDocument doc = new PrintDocument(); if (printer != "default") doc.PrinterSettings.PrinterName = printer; I then raise an event: doc.PrintPage += new...
10
5519
by: Tim Streater | last post by:
I have a form and a button to submit it. The button is made from: <input type=button onclick='myHandler(this.form);'> This all works fine except that in Safari 2.0.4, the enter/return keys, if pressed, submit the form - bypassing my onclick handler. I can partially fix this with: <form onsubmit='return false;'>
4
2138
Chrisjc
by: Chrisjc | last post by:
The question at hand is I bypass an array in column 4... but I also have something else that should be going in there from the database but because I am bypassing it and forcing it to show the ony think I want to show it will not show what is being generated from the database... and if I take the bypass out it works with no issues.... any ideas? // ------------------------------------------------------------------------------- //...
0
8438
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8348
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8863
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8636
tracyyun
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5660
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4356
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2765
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
2
2004
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1761
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.