Click here to Skip to main content
16,013,918 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CImage Woes Pin
VonHagNDaz29-May-07 5:47
VonHagNDaz29-May-07 5:47 
GeneralRe: CImage Woes Pin
Mark Salsbery29-May-07 6:58
Mark Salsbery29-May-07 6:58 
GeneralRe: CImage Woes Pin
VonHagNDaz29-May-07 7:38
VonHagNDaz29-May-07 7:38 
GeneralRe: CImage Woes Pin
Mark Salsbery29-May-07 7:52
Mark Salsbery29-May-07 7:52 
GeneralRe: CImage Woes Pin
Mark Salsbery29-May-07 8:41
Mark Salsbery29-May-07 8:41 
GeneralRe: CImage Woes Pin
VonHagNDaz29-May-07 9:37
VonHagNDaz29-May-07 9:37 
GeneralRe: CImage Woes Pin
Mark Salsbery29-May-07 9:50
Mark Salsbery29-May-07 9:50 
GeneralRe: CImage Woes Pin
Mark Salsbery29-May-07 9:58
Mark Salsbery29-May-07 9:58 
If you don't trust that the bits pointer is pointing to valid data, try this anywhere in your code
// Load an image and draw it directly to the screen at 0,0
 
CImage image;
image.Load(_T("...\\CMYK.tif"));
BYTE *pImageBits;
if (image.GetPitch() < 0)
	pImageBits = (BYTE*)image.GetBits() + (image.GetPitch() * (image.GetHeight() - 1));
else
	pImageBits = (BYTE*)image.GetBits();
HDC hdc = ::GetDC(0);
image.Draw(hdc, 0, 0, image.GetWidth(), image.GetHeight());
::ReleaseDC(0, hdc);

Also remember for CMYK.tif, the bits pointer is pointing to an array of 3173868 bytes!


"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

GeneralRe: CImage Woes Pin
VonHagNDaz29-May-07 10:16
VonHagNDaz29-May-07 10:16 
GeneralRe: CImage Woes Pin
Mark Salsbery29-May-07 10:29
Mark Salsbery29-May-07 10:29 
GeneralRe: CImage Woes [modified] Pin
Mark Salsbery29-May-07 8:45
Mark Salsbery29-May-07 8:45 
QuestionCannot write in EditBox Pin
garfield18529-May-07 3:18
garfield18529-May-07 3:18 
AnswerRe: Cannot write in EditBox Pin
garfield18529-May-07 3:51
garfield18529-May-07 3:51 
QuestionRe: Cannot write in EditBox Pin
David Crow29-May-07 3:54
David Crow29-May-07 3:54 
AnswerRe: Cannot write in EditBox Pin
garfield18529-May-07 4:01
garfield18529-May-07 4:01 
QuestionHow to replace menu item with Image Pin
NiceNaidu29-May-07 3:01
NiceNaidu29-May-07 3:01 
QuestionRe: How to replace menu item with Image Pin
Hamid_RT29-May-07 5:53
Hamid_RT29-May-07 5:53 
Questionproblem withh Adding ATL Simple Object? Pin
Banks K29-May-07 2:49
Banks K29-May-07 2:49 
Questionapplication crash Pin
lavate malllik29-May-07 2:39
lavate malllik29-May-07 2:39 
AnswerRe: application crash Pin
_AnsHUMAN_ 29-May-07 3:10
_AnsHUMAN_ 29-May-07 3:10 
GeneralRe: application crash Pin
lavate malllik29-May-07 8:12
lavate malllik29-May-07 8:12 
QuestionRe: application crash Pin
Hamid_RT29-May-07 5:41
Hamid_RT29-May-07 5:41 
AnswerRe: application crash Pin
lavate malllik29-May-07 8:12
lavate malllik29-May-07 8:12 
GeneralRe: application crash Pin
Hamid_RT29-May-07 19:04
Hamid_RT29-May-07 19:04 
QuestionProperty Sheet in V Studio 2005 Pin
tom groezer29-May-07 2:32
tom groezer29-May-07 2:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.