|
I'm trying to learn ATL and my project is a series of GDI+ graphics filters ( invert, colour, gamma, brightness, emboss, you get the idea ), so I want to create methods like this:
[id(1), helpstring("method DoInvert")] HRESULT DoInvert([in, out] Bitmap * i)
How can I do this ? How can I use COM to pass a Bitmap* into my method ? Is there a way of doing this so that I can still make it an ActiveX control to be used in VB ? Should I care ( i.e. can they access GDI+ anyhow ) ?
Thanks to all who respond....
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
VB can't deal with a Bitmap* object. You mgiht try
[id(1), helpstring("method DoInvert")] HRESULT DoInvert([in, out] HANDLE hBitmap)
VB has certain data type restrictions. If you want your ActiveX to be compatible with VB then you have to use the proper data types in your interface. Look in the docs for a list.
VB can not access GDI+.
|
|
|
|
|
If you need your component to be accessible from VB, you are restricted to using types from the VARTYPE enum - long, IDispatch*, etc. See wtypes.h or MSDN for the full list.
--Mike--
http://home.inreach.com/mdunn/
Sometimes, arming yourself with a big pointy stake just won't do you any good.
|
|
|
|
|
That's pretty much what I thought. So if I discard the idea of VB support, what do I need to do to pass a Bitmap * ? Did I just forgert a #include, or is the problem deeper ?
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I'll have to defer to someone else on that question - I've done little IDL hacking myself; I've always been able to get by with VARIANTs.
--Mike--
http://home.inreach.com/mdunn/
Sometimes, arming yourself with a big pointy stake just won't do you any good.
|
|
|
|
|
Thanks - I managed to do it with VT_PTR, although passing a void * doesn't thrill me. If anyone knows of an alternative, I'd be pleased to hear it, but my project is away, two filters implimented and working nicely. I have a whole swag written as classes, I just need to turn them in to ATL interfaces. I'm so glad I finally am writing ATL code, I've intended to for 18 months.
Lots of ATL questions coming up....
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
As was suggested before pass a HANDLE, but twist it. Since HANDLE is typedef'd as LONG use that.
[id(1), helpstring("method DoInvert")] HRESULT DoInvert([in, out] LONG* hBitmap)
Notice it is also a pointer since it both in and out. I believe you can get the HBITMAP from VB to pass into the method.
What about using IPicture?
|
|
|
|
|
I think that passing in an IPicture is the 'proper' COM approach.
|
|
|
|
|
The thing is, I don't want to pass a CBitmap * or a HBITMAP, but a Bitmap object from GDI+, because that is what I am working with, and I want to use BitmapData* to traverse the bitmap. I suppose I could create a DIBSection, but it would take time and generally be an ugly approach when I have a perfectly good formated object to start with ?
It looks like the VARIANT is going to win... Thanks to everyone for their suggestions.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
OK....
So, can you pass pointers to classes through ATL? For now let's assume C++ to C++ only. For instance, could you pass CArchive?
I live in hope...
> Andrew.
|
|
|
|
|
You can pass the pointer as a long, as pointed out earlier. Whether that pointer has any meaning on the other side...
|
|
|
|
|
i need to know how i can delete a cookie or all temporary internet files at once.
Thanks
Kun
|
|
|
|
|
How to retain the child windows' title when moving around different child windows.
I used SetWindowsText but it disappears when other child window is activated.
Gracias
|
|
|
|
|
i need to store the path (only the path) where my .exe file is run from in a string.
groovy, hehe
oops yea, i also need to know how i can delete a cookie in the temporary internet files folder because they dont seem to act as files
Thanx!
Kun
|
|
|
|
|
I pulled this from my library of routines
Good luck with the cookies
Brad
CString GetLaunchedDir()
{
TCHAR szFullPath[MAX_PATH];
TCHAR szDir[_MAX_DIR];
TCHAR szDrive[_MAX_DRIVE];
CString strLaunched;
::GetModuleFileName(NULL, szFullPath, MAX_PATH);
_splitpath(szFullPath, szDrive, szDir, NULL, NULL);
strLaunched.Format(_T("%s%s"), szDrive, szDir);
return strLaunched;
}
|
|
|
|
|
Hai,
I made a program to input .txt into MS Access.The text file is an output of a math program.Fine.
Now another program retrieves the data and displays it in the list control.Not fine.
The problem is the numbers displayed in the list contains an additional point other than the one already present.
When I checked in the database,it was correct ie same as that in the text file but the point gets added in the list control.Why?Whats the point?
The database fields are strings.
This problem occurs only to certain numbers in random.
I am confused.I need to use this in further calculations but it will harm my other calculations.
Help me.
And this,both the programs DONOT work simultaneously.The first was just a tool to help inputting thousands of numbers from text.
Thanx.
|
|
|
|
|
Hi all,
What is Project->Setting->C/C++->Optimazation ?
I can see Maximize Speed ...
Is that for speed in executing my EXE file ?
I mean, if i choose that, my EXE file will running faster ?
So, this option is for my EXE speed ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
yes, it's the speed of your exe...
A compiler man make different optimizations of your code. It can make your program run faster, make a smaller executable, and other stuff.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I am trying to make a program that will stream MP3s over a TCP/IP LAN, what would be the best way to set something like this up.
Thanks
-Matt Newman
|
|
|
|
|
I am having a rather anoying problem with my CString's. Consider the following code:
CString strTest = _T("hello world");
ASSERT(strTest.Replace(_T("world"), _T("universe")) > 0)
ASSERT(strTest.Find(_T("world")) == -1)
Now, that the last ASSERT will always fail (indicating that "world" is present in the string). This can be verified by sticking an AfxMessageBox call in there too.
Why (or rather how) can this happen when the replace call always succeeds with one replacement.
Cheers,
James Millson
|
|
|
|
|
I think the culprit is your last ASSERT statement, CString's Find member returns -1, if the sub string was not found.
It should be:
ASSERT ( strTest.Find ( _T ( "world" ) ) != -1 )
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Nope, It should be just as James wrote it...
You want the ASSERT to PASS if "world" is NOT found.
In fact I compiled this snippet and both asserts
pass just fine on my system.
Steve T.
|
|
|
|
|
Your right Steve, I have no idea what it was that I thought he was asking... This kind of thing has been happening all day, I must be on crack or something
cheers,
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
That's what I thought . I can only get it to pass on my system if I do:
CString strTemp = _T("hello world");
CString strTest = new CString(strTemp).GetBuffer(0);
ASSERT(strTest.Replace(_T("world"), _T("universe")) > 0)
ASSERT(strTest.Find(_T("world")) == -1)
And I don't know if that's a very good way of doing it.
And the problem only occurs in the current usuage (i.e. it works elsewhere in the project). But i've stepped backwards and forwards for hours and nothing else looks wrong, and nothing is there to indicate it is.
How very odd
Cheers
James Millson
p.s. Oh, and yes, I made up the actual text in the example above, but other than that it is the same. In both cases the equivalent of "world" should not be present in the string.
|
|
|
|
|
I have one VB object and one VC object.
This VB object will create one ADO Connection object.
To share the same connection, it is need to pass the connection
from VB to VC object.
Is it possible?
If yes, how can it be done?
Thanks.
|
|
|
|