|
A HANDLE is just a number ( 32 bit, from memory, or maybe only 16 ).
The real question is, will it have meaning in the context of the COM dll ?
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
To pass a pointer or handle to a COM object, simply just pass it as a long, and in the COM Object you cast it back to what you know it is, like MyHandle = (HANDLE)newVal;
It's kinda dangerous, but works perfectly fine
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Unless you have OLE automation type requirements on your interface, you can pass it as it is. IIRC, HANDLE is just a void* . Passing it as long is not 64-bit safe.
--
Shine, enlighten me - shine
Shine, awaken me - shine
Shine for all your suffering - shine
|
|
|
|
|
I have a window that is hosted by other windows. I don't want it to draw its background because the dialog that hosts it has a special background, however, even with the transparent setting, CDialogImp still paints its background, thus making the transparent setting worthless to me. Is there an easy way around this? Is there another base class I could be using that works better for windows hosted in other windows?
|
|
|
|
|
The WS_EX_TRANSPARENT style doesn't automagically make your window transparent. It just means that your window gets painted last, after all sibling windows. That means all your drawing has to be confined to the region of your window, so the end result is your window looks transparent. And use SetBkMode(TRANSPARENT) before drawing text.
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
BUY MY SOFTWARE!! (please?) RightClick-Encrypt | 1ClickPicGrabber
My IntarWeb Homepgae!!!11
|
|
|
|
|
I didn't mean to imply that there would be free transparency. The issue is that in ATL the window background is always painted. In MFC this isn't necessarily the case (or at least does not seem to be). This is especially important when dealing with tab pages in XP themed work. I've never had problems with MFC painting the window background and thus obscuring the white tab page (as long as the window flags were set correctly). But I always have to catch the WM_ERASEBKGND
|
|
|
|
|
Can anyone point me to a primer on how to use ATL control versioning? I need to change the interface for a control (adding new methods) and I want to bump up the version number. I need to know what changes to make to my controls RGS/IDL files to allow both versions of the control to be used. There doesn't seem to be any ATL7 control samples on the MSDN that use versioning...
When I am king, you will be first against the wall.
|
|
|
|
|
The easiest way to do this is to NOT version the control. What you are supposed to do is create a new interface that the control also implements. for example
you would have two interfaces in your IDL file.
interface ISomeInterface : IUnknown
{
};
...
coclass SomeInterface
{
interface ISomeInterface;
};
Your Implementation class would be some class:
class CSomeInterface : public ISomeInterface, ( others here ) { };
What you need to do is a new interface like
interface ISomeInterface2 : IUnknown // or you could derive from ISomeInterface depending your requirements
{
};
and then
coclass
{
interface ISomeInterface;
interface ISomeInterface2;
};
and class
// of course if you derivce ISomeInterface2 from ISomeInterface you can leave out
// ISomeInterface from the inheritence list below.
class CSomeInterface : public ISomeInterface, ISomeInterface2 ( others here ) { };
Hope This is what you were looking for.
Good Luck.
Joseph Dempsey
joseph_r_dempsey@yahoo.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
Does anyone know if ATL7 is available as a separate download from MS, or if there are any plans to ship ATL7 with the Win32 SDK...?
When I am king, you will be first against the wall.
|
|
|
|
|
ATL, like MFC is part of Visual C and can not be downloaded.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hi,
today I feel like a little child not understanding anything from the bitmap API. What I want to do is to fetch a large image via the clipboard using one of the CF_BITMAP of CF_DIB types. Since I need the data in an image processing application I must convert the data to some specific format, namely a 24 bpp DIB. Nothing special, but the format of the DIB in the clipboard can be anything. Additionally I need the data in my own data buffer and finally the image is tiled and must be composed back into one image using supsequent calls the the external application and ::GetClipboardData.
Since the image is very large I don't want to copy memory around just to compose a DIB from the clipboard data, copy this DIB into a DDB with the desired new format and later copy the data into the user supplied buffer.
As I said, I feel like a little child today, not understanding anything anymore from the DIB/BITMAP API. While trying to solve my problem I had the following questions:
1.) How can I wrap a user provided buffer into a DDB or DIB?
It seems to me, that this is not possible, but why?
2.) What is the difference between a HBITMAP and a HANDLE or a HDIB? Or better, why does GetObject fail if I try to use it on a HANDLE returned from ::GetClipboardData (CF_BITMAP)?
3.) How do I wrap the data in the cipboard into a CImage? I cannot Attach to the HANDLE returned either from CF_BITMAP or CF_DIB and I can't use the API directly since there is no function to return the pointer to the start of the bits buffer. The function GetBits () returns a pointer to Pixel (0,0) which is in the most cases at the end of the bits buffer.
4.) What is the difference of a DIBSECTION and a DDB/DIB? The DIBSECTION seems to combine all the needs for a DDB and a DIB. It has BITMAP header and a BITMAPINFOHEADER. In the BITMAP header there is a member bmBits that points to the bitmap data. In the CImage::UpdateBitmapInfo this member is used as a pointer to the bits for a DIBSECTION image. But why is this member not valid for a BITMAP image?
5.) There are a lot of wrappers available for DIBs. One treats a DIB as an inherited CBitmap, another introduces a HDIB handle the next one only wraps the DIBSECTION API. All wrappers seem to be written before the existance of ATL7. But the CImage class still does not cover a good range of functions to deal with this problem. Is there a wrapper available that extends the CImage class for DIB/DDB conversion?
Thanks a lot for your answers.
Dirk
|
|
|
|
|
How would i go on making property sheets in WTL? I can't really find an example on this....
|
|
|
|
|
|
How can i make a system to hide/show Splitter Panes in WTL? I know you can hide them using SetSinglePaneMode(0) but i can't get the hidden one to show after i call this function.
|
|
|
|
|
SetSinglePaneMode() turns on/off the mode, depending on the param. Passing 0 is the same as SPLIT_PANE_LEFT, which means turn on 1-pane mode and show the current left pane only. Call SetSinglePaneMode() with SPLIT_PANE_NONE to go back to 2-pane mode.
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I've gotten in to using the STL, and as you guys said, I know prefer it over MFC's containers (and other functions). My question is, I've got this vector of values and I am trying to use a function that requires a pointer to an array of values (the ones in the vector). Is there a way to easily do this or do I need to create an array, copy the vector's contents into it, use the function, and then copy the values back into the vector?
Thanks in advance for your help.
|
|
|
|
|
One solution is to pass an address of an element in the contain.
vecSome::iterator iData = data.begin();
somefunction(&iData);
somefunction[&data[0]);
Kuphryn
|
|
|
|
|
Kuphryn,
Thank you for your suggestion, the second one worked. I suddenly like the STL containers even more.
When I tried the first
somefunction(&iData);
... it wouldn't accept it, saying something along the lines of could not convert vector< ... > to const blah ...
But the second way
somefunction(&iData[0]);
... worked perfectly.
Try doing that with CArray!
|
|
|
|
|
Easy,
somefunction (Data .GetData ());
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hmm... I'll have to try that one.
Thanks
|
|
|
|
|
This works too.
somefunction (data .begin ());
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
This just works out of luck. std::vector iterators need not be pointers. &data[0] is the way to go.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Yup, you are right. I guess it is one of those things you see so often you forget it is .... WRONG.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I am working with a project which handles large compound files. Now I face a problem with IStream::Write().
IStream::Write()retuns an error STG_E_DOCFILETOOLARGE (Error:"The compound file is too large for the current implementation").
I am trying to write in a compound file created with 512 Byte sectors (Info MSDN see below). The current file size is about 300 MByte and the number of streams are about 100000 ! The error occurs only with Win 2000 SP3 and XP SP1. In Win NT 4.0 SP6a it works !!! When I create the file with 4096 Byte sectors in StgCreateStorageEx, IStream::Write works for Win 2000 and XP too. Now my question: Is this a bug?
Info from MSDN Library:
The compound file implementation can be configured to use 512 or 4096 byte sectors, as defined in the STGOPTIONS structure. File size limits: 512: 2 gigabytes (GB) 4096: Up to file system limits Number of elements in a file: 512: Unlimited, but performance may degrade if elements number in the thousands 4096: Unlimited
Mainul Hossain
Germany
Mainul Hossain
|
|
|
|
|
I am working on an ATL service. My problem is that I want to display an Icon whenever the service starts. Also on the click of icon it should display a menu from where I can stop the service.
I tried using NOTIFYICON data structure but it requires parameters such as handle to the parent window and to the icon. How do I get handles to the window as there is no UI for an ATL service
|
|
|
|