|
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
|
|
|
|
|
Interesting problem. One solution is to design an interface (GUI) for the service and have it communicate with the user.
Kuphryn
|
|
|
|
|
Can it not be done without a UI??
|
|
|
|
|
Create a seprate trayicon.exe application that can communicate with your service.
Todd Smith
|
|
|
|
|
Maybe I am wrong, but I remember than when I some time ago did something with event log, I have first register a message before use the eventlog - the message format was something like
messageID=XYZ; "Some error occured in function %s"
This message definition is stored somewhere in registry I guess...
Then when I wanted to write such an error to eventlog I only refer to the definition and add the string to be completed (say "main").
ReportError( XYZ; "main" );
in eventlog viewer it appears to be:
"Some error occured in function main"
I think that this is because it can save a quite big amount of space in the evt file, because they can store only the "main" string in each entry instead of the whole message.
I don't think, that this will help you a much, but at least you know reason why it doesn't work for you now.
|
|
|
|
|
What is the error? What flags do you use for FormatMessage? Is it possible that not all the messages came from the same message DLL? How do you deal with parameters?
|
|
|
|
|
I am implementing interface to handle event . I am stuck in defining _ATL_FUNC_INFO .
Sample of my code is
/////////////////////////////////////////////////////////////////////////////
class CCTIHPPCHelper;
#define EVENT_SOURCE_CTI 1
#define CTIHPPCEventDIID HiPathProCenterLibrary:IID__IMediaManagerEvents
typedef IDispEventSimpleImpl<event_source_cti, cctihppchelper,="" &ctihppceventdiid=""> SCTIHPPCEventImpl;
and in .tlh file i have
_IMediaManagerEvents : IDispatch
{
//
// Wrapper methods for error-handling
//
// Methods:
HRESULT EventOccurred (
struct IMediaEvent * MediaEvent );
};
My problem is how should i define _ATL_FUNC_INFO as parameter in "EventOccurred" is a struct type and what should be my BEGIN_SINK_MAP definition.
Is there any other way for implementing interface.
Thanks
|
|
|
|
|
Hi,
I didn't get your question completelly, but the general approach how to handle the events is very simple in ATL.
Assume you have class CWantEvents and you want to receive the event you described.
Then you have to define the sink map as follows:
<br />
BEGIN_SINK_MAP(CWantEvents)<br />
SINK_ENTRY_EX(0, __uuidof(_IMediaManagerEvents), 1, OnEventOccurred)<br />
END_SINK_MAP()<br />
<br />
void __stdcall OnEventOccurred( IMediaEvent* ipMediaEvent )<br />
{<br />
};<br />
Then when you attach to the event source (using DispEventAdvise ), you have to be able to receive such an event.
Hope this helps.
Ya, and note - the member marked in my sample as dispid might be different for you (depend on dispID of the real event method you want to receive)
|
|
|
|
|
Ok, if I got this right, event sinking is when you listen for COM events?
I am trying to listen for Internet Explorer events (idc_print, idc_printpreview) from an ActiveX control within internet explorer. I was wondering if someone can help me out or point me in the right direction.
MoMad the NoMad
|
|
|
|
|
idc_print? idc_printpreview? Take a look at the DWebBrowserEvents2 dispinterface. Those are the events you can sink. (At least what's been published by Microsoft. )
--
tlhIngan maH! Heghlu'meH QaQ jajvam!
|
|
|
|