|
I changed the code a bit so I could test it, but here's a couple examples that hopefully you can
extract some useful parts from (note that I assumed drawing from a window class so I used a
CClientDC).
To convert the DIB to a DDB and draw the DDB:
FILE *file = fopen("C:\\test.bmp", "rb");
fseek(file, SEEK_END, SEEK_END);
long nSize = ftell(file);
BYTE *byBmp = new BYTE[nSize];
fseek(file, SEEK_SET, SEEK_SET);
fread(byBmp,nSize, 1, file);
fclose( file );
BITMAPFILEHEADER *bmfh = (BITMAPFILEHEADER *)byBmp;
BITMAPINFO *bmi = (BITMAPINFO *)(byBmp + sizeof(BITMAPFILEHEADER));
BITMAPINFOHEADER *bmih = (BITMAPINFOHEADER *)bmi;
CClientDC dc(this);
CDC dcMemBkImage;
dcMemBkImage.CreateCompatibleDC(0);
CBitmap m_bmpBackImage;
LONG lScanLines = bmih->biHeight > 0 ? bmih->biHeight : -bmih->biHeight;
int nRet = m_bmpBackImage.CreateCompatibleBitmap(&dc, bmih->biWidth, lScanLines);
::SetDIBits(dcMemBkImage, m_bmpBackImage, 0, lScanLines, byBmp + bmfh->bfOffBits, bmi, DIB_RGB_COLORS);
delete [] byBmp;
...
CClientDC dc(this);
CBitmap *pOldBitmap = dcMemBkImage.SelectObject(&m_bmpBackImage);
BITMAP bitmap;
::GetObject(m_bmpBackImage,sizeof(bitmap),&bitmap);
dc.BitBlt(50, 50, bitmap.bmWidth, bitmap.bmHeight, &dcMemBkImage, 0, 0, SRCCOPY);
dcMemBkImage.SelectObject(pOldBitmap);
dcMemBkImage.DeleteDC();
An alternative is to draw the DIB bits without converting to a DDB:
FILE *file = fopen("C:\\test.bmp", "rb");
fseek(file, SEEK_END, SEEK_END);
long nSize = ftell(file);
BYTE *byBmp = new BYTE[nSize];
fseek(file, SEEK_SET, SEEK_SET);
fread(byBmp,nSize, 1, file);
fclose( file );
BITMAPFILEHEADER *bmfh = (BITMAPFILEHEADER *)byBmp;
BITMAPINFO *bmi = (BITMAPINFO *)(byBmp + sizeof(BITMAPFILEHEADER));
BITMAPINFOHEADER *bmih = (BITMAPINFOHEADER *)bmi;
LONG lScanLines = bmih->biHeight > 0 ? bmih->biHeight : -bmih->biHeight;
CClientDC dc(this);
::SetDIBitsToDevice(dc, 50, 50, bmih->biWidth, lScanLines, 0, 0, 0, lScanLines, byBmp + bmfh->bfOffBits, bmi, DIB_RGB_COLORS);
delete [] byBmp;
-- modified at 22:07 Monday 1st January, 2007
*EDIT* Fixed code in first example
-- modified at 22:15 Monday 1st January, 2007
|
|
|
|
|
Thanks a lot ,
you have solved my problem.
thanks again.
omar lodhi
|
|
|
|
|
Hi all,
HiEdit V1.0.1.4 has been released. HiEdit is a multi-tabbed, high speed, large file edit control. It uses no more than ~140K of memory due to its sophisticated memory management. It supports most standard edit/richedit control messages and many custom ones. You can use it with any programming language since it is packaged as a standard dll and a static library. A full source demo application (written in Assembly) is inluded. You can get it here[^].
In addition, you can get HiEditor V1.0.1.5 (a full blown application that uses HiEdit)
Any feedback/suggestions is highly appreciated
Regards,
Antonis Kyprianou
-- modified at 3:53 Friday 29th December, 2006
http://www.winasm.net
|
|
|
|
|
|
Thanks for your reply. There is no question. HiEdit is a custom control that can be used in your applications and I wanted to let you know, in case you are interested.
Regards,
Antonis
http://www.winasm.net
|
|
|
|
|
Haven't read point no. 10 in Chris's sticky post at the top ?
"No advertising or soliciting."
|
|
|
|
|
akyprian wrote: In addition, you can get HiEditor V1.0.1.5 (a full blown application that uses HiEdit)
Any feedback/suggestions is highly appreciated
ads are not allowed here, as per forum guidelines, you better post article here, expect the any feed back there
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
Excuse my ignorance, but is the post about a free custom control considered as an ad? If so, please delete my post. Only questions are allowed?
http://www.winasm.net
|
|
|
|
|
akyprian wrote: Excuse my ignorance, but is the post about a free custom control considered as an ad? If so, please delete my post. Only questions are allowed?
i am not Admin here, i just showing you way to get good feedback
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
akyprian wrote: Excuse my ignorance...
Ignorance issues aside, it's simply against forum guidelines to post an ad in a Q&A forum. Feel free to create an article about your custom control, however.
akyprian wrote: ...is the post about a free custom control considered as an ad?
It is in the context in which you did it.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
If this kind of post is an ad, then I don't know what to say. I 've never considered this kind of posts in any of the forums I admin/moderate as an ad.
Thanks for your kindness, anyway
Antonis
http://www.winasm.net
|
|
|
|
|
if you have an article and you think its helpful for other people you can post your article to the codeproject
|
|
|
|
|
Thanks a lot WhiteSky. I 'll do.
Cheers,
Antonis
http://www.winasm.net
|
|
|
|
|
You're welcome
|
|
|
|
|
Everybody 4got my prob as its now so many pages after the root page...
plz help.
the messgae title was NAVIGATION ERROR
Shouvik
|
|
|
|
|
HI I M NEW HERE, I WANT A LITTLE HELP , I M CREATING A SOUND PROJECT , FOR THAT I WANT UR HELP , PLEASE TELL ME HOW CAN I DIFFERNTIATE BETWEEN HEIGHTS OF DIFFERENT WAVES WHICH I INPUT THROUGH MIC (HOW CAN I CALCULATE THE HEIGHT OF TWO DIFFERENT SOUND WAVES)??????????????? PLEASE HURRY ITS VERY URGENT....
Dark Verdict
|
|
|
|
|
though i think i'll be not at all helpful.. U must have heard of Audacity project.
they have open source libraries(DSP Pluggins). Checkout in
http://sourceforge.net/projects/audacity/[^]
hope this helps.
All the best with ur proj
Shouvik
|
|
|
|
|
shouvik.d wrote: http://sourceforge.net/projects/audacity/[^]
nice project
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
is it something u dint like
Shouvik
|
|
|
|
|
shouvik.d wrote: is it something u dint like
isn't that project is good!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
darkverdict wrote: PLEASE HURRY ITS VERY URGENT....
That's your problem. Don't SHOUT and ask your question nicely.
That in case you want someone to help you.
|
|
|
|
|
dont thrash he must be in real need
Shouvik
|
|
|
|
|
I don't... We all are from time to time, but imperative demands have no place on a forum where we're all spending time for free.
|
|
|
|
|
Did you see Audio/video on the codeproject? maybe it some helpfuls
|
|
|
|
|
Don't say "urgent". It's just plain rude. Also don't shout.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|