|
It seems easier to convert from FILE * to HANDLE :
#include <io.h>
#include <fcntl.h>
FILE * f = . . .;
HANDLE h = (HANDLE)_get_osfhandle(fileno(f));
The other conversion looks longer:
HANDLE h = . . .
FILE * f = _fdopen(_open_osfhandle((intptr_t)h, _O_RDONLY), "rb");
I hope this works. I am not sure mixing of operations with FILE * and HANDLE cannot be avoided.
|
|
|
|
|
Viorel. wrote: I hope this works. I am not sure mixing of operations with FILE * and HANDLE cannot be avoided
In fact the mix can usually be avoided (and should be avoided, at least to maintain the code coherence). There are, of course, exceptions...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi Friends ...
I have to install the dll build in VS2005 ? It is giving error to install that dll? I installed Framework2.0 on the same machine still there is problem exists.
I have also copied mfc71.dll in sytem32 folder?
What should I do to register my dll?
Please help me ...
Thanking You...
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
|
Thanks Mark.
But still the problem exists there.
I am still not able to register DLL.
Installed patch required for the same.
I also tried the INstallers way...but not getting the result.
I dont know wht i am missing please help me.
The secret of life is not enjoyment
but education through experience.
- Swami Vivekananda.
|
|
|
|
|
When the error occurs:
1) What exactly are you doing (or trying to do)?
2) What is the exact error message?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I am using the CImageList::Add(CBitmap* pbmImage,COLORREF crMask) to add a bitmap to the ImageList. The problem is that, this API will change the background color in the supplied bitmap to black. But as per my requirenment it should not be happened since I have to use the bitmap again.
So how can I retain the bitmap?
Thanks in advance.
- NS -
|
|
|
|
|
You didn't correctly initialize your image list.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
My code looks like this...
HIMAGELIST hImageList = ImageList_Create( stBitmapsize.bmWidth, stBitmapsize.bmHeight, ILC_COLOR32 | ILC_MASK, 0, 2 );<br />
m_ImageList.Attach( hImageList );<br />
m_ImageList.Add( &bitmap, clrTransparent_i );
Could you please tell me whether there is any problem?
- NS -
|
|
|
|
|
As John mentioned...
Use the ILC_MASK flag when creating your image list if you want masked bitmaps.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
But it is already there.
From the MSDN documentation of CImageList::Add, crMask parameter:
"crMask
Color used to generate the mask. Each pixel of this color in the given bitmap is changed to black and the corresponding bit in the mask is set to one."
Does it mean that the given bitmap will be modified? It happens so.
- NS -
|
|
|
|
|
Add the flag when you create the image list.
When you add the bitmap, the color will be used to generate the mask, but the image list has
to be created to use a mask.
See CImageList::Create() nFlags parameter.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I think my code just like that you said.
HIMAGELIST hImageList = ImageList_Create( stBitmapsize.bmWidth, stBitmapsize.bmHeight, ILC_COLOR32 | ILC_MASK, 0, 2 );<br />
m_ImageList.Attach( hImageList );<br />
m_ImageList.Add( &bitmap, clrTransparent_i );
Could you please tell me whether there is any problem?
- NS -
|
|
|
|
|
So the bitmap you add gets changed? I didn't know that. I guess I've never had to reuse the
bitmap - I use alot of image lists
All you can do is make a copy of the source bitmap or reload it.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: All you can do is make a copy of the source bitmap or reload it.
I think so... I will try.
Thank you
- NS -
|
|
|
|
|
|
Please don't post the same question multiple times, once is enough and in some cases more than enough.
|
|
|
|
|
If you know the file format of the respective image files, you could very well extract RGB compnoents of the pixel.
Regards,
Paresh.
|
|
|
|
|
How can I extract the RGB components of Images with formats
MNG,PNG,TIFF.Kindly tell me where I could find some sample codes
|
|
|
|
|
|
Thank u,
but all the Zip files downloaded are corrupted.
they are .htm files renamed as .zip
|
|
|
|
|
I am sorry. I am not sure about that.
But here I could download it... I just did download the full source code now.
- NS -
|
|
|
|
|
For png and I think tiff you can use of CImage class.
|
|
|
|
|
Hi
Nowadays I am learning MFC and i have a problem with CMainFrame.
I am looking codes which VS2005 MFC wizard create, something different.
When i write a MFC App, i create a class which is derived from CWinApp and then create a CFrameWnd.
I handle menu messages in FrameWnd's message map.
But in VS 2005 codes. There is message map in Application class and menu messages are associated with application class message map.
For example:
MFCSingle.exe -> MFCSingle.cpp
BEGIN_MESSAGE_MAP(CMFCSingleApp, CWinApp)<br />
ON_COMMAND(ID_APP_ABOUT, &CMFCSingleApp::OnAppAbout)<br />
ON_COMMAND(ID_FILE_NEW, &CWinApp::OnFileNew)<br />
ON_COMMAND(ID_FILE_OPEN, &CWinApp::OnFileOpen)<br />
ON_COMMAND(ID_FILE_PRINT_SETUP, &CWinApp::OnFilePrintSetup)<br />
END_MESSAGE_MAP()
So where is CMainFrame?
Isn't menu control belong to CMAinFrame?
|
|
|
|
|
You probably made a Dialog based Application or did unselect Doc/View.
Failure is not an option - it's built right in.
|
|
|
|