Click here to Skip to main content
15,898,991 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Converting To Pixels Pin
Pazzuzu11-Mar-04 1:28
Pazzuzu11-Mar-04 1:28 
GeneralStoring the visual representation in a document Pin
mymauve2110-Mar-04 23:03
mymauve2110-Mar-04 23:03 
GeneralStoring the visual representation in a document Pin
mymauve2110-Mar-04 23:02
mymauve2110-Mar-04 23:02 
GeneralRe: Storing the visual representation in a document Pin
David Crow11-Mar-04 2:53
David Crow11-Mar-04 2:53 
GeneralBitmap Pin
Rassul Yunussov10-Mar-04 22:48
Rassul Yunussov10-Mar-04 22:48 
GeneralRe: Bitmap Pin
Mike Dimmick11-Mar-04 1:01
Mike Dimmick11-Mar-04 1:01 
GeneralRe: Bitmap Pin
Rassul Yunussov11-Mar-04 22:20
Rassul Yunussov11-Mar-04 22:20 
GeneralRe: Bitmap Pin
Mike Dimmick12-Mar-04 8:36
Mike Dimmick12-Mar-04 8:36 
Firstly I'd pull out every use of GetSystemMetrics(SM_CXSCREEN) and GSM(SM_CYSCREEN) and store them in variables instead - this will make the code clearer.

The value of a two-character literal is undefined. Set BFH.bfType to 0x4D42.

The documentation for BITMAPINFOHEADER indicates that biPlanes should be set to 1. I think you can get away with setting biClrUsed to zero; if you do this, you should not write any RGBQUAD structures after the BITMAPINFOHEADER.

biCompression should be set to BI_RGB. You should probably set biXPelsPerMeter and biYPelsPerMeter: you can either compute them from GetDeviceCaps( hDC, LOGPIXELSX ) or simply write in the appropriate value for 96dpi: 3780.

A line of a DIB is always an exact multiple of 4 bytes long. If the number of bytes per pixel multiplied by the number of pixels per line is not a multiple of 4, you must round up to the next multiple. This also affects your original block allocation.

I seem to remember that there are also some odd alignment requirements for a BMP file, but I can't remember them off-hand.

If other programs render your bitmap upside down, you may need to set biHeight to a negative value (e.g. -480 for a 480-pixel high image).

If none of this helps, step through the code and see which line fails, and what the Windows error value is.

Stability. What an interesting concept. -- Chris Maunder
GeneralDraw a great circle of a sphere in c++ Pin
Tal S.10-Mar-04 22:40
Tal S.10-Mar-04 22:40 
GeneralRe: Draw a great circle of a sphere in c++ Pin
Robert A. T. Káldy11-Mar-04 1:18
Robert A. T. Káldy11-Mar-04 1:18 
GeneralRe: Draw a great circle of a sphere in c++ Pin
Tal S.14-Mar-04 20:07
Tal S.14-Mar-04 20:07 
GeneralFile IO Pin
vikramlinux10-Mar-04 22:14
vikramlinux10-Mar-04 22:14 
GeneralRe: File IO Pin
Antti Keskinen10-Mar-04 22:30
Antti Keskinen10-Mar-04 22:30 
GeneralRe: File IO Pin
Brian D10-Mar-04 22:37
Brian D10-Mar-04 22:37 
GeneralRe: File IO Pin
David Crow11-Mar-04 2:55
David Crow11-Mar-04 2:55 
GeneralNamed Pipes Vs Sockets Pin
vikramlinux10-Mar-04 22:04
vikramlinux10-Mar-04 22:04 
GeneralRe: Named Pipes Vs Sockets Pin
Antti Keskinen10-Mar-04 22:26
Antti Keskinen10-Mar-04 22:26 
GeneralRe: Named Pipes Vs Sockets Pin
Steve S11-Mar-04 0:32
Steve S11-Mar-04 0:32 
GeneralRe: Named Pipes Vs Sockets Pin
GuimaSun11-Mar-04 0:40
GuimaSun11-Mar-04 0:40 
GeneralRe: Named Pipes Vs Sockets Pin
vikramlinux11-Mar-04 1:00
vikramlinux11-Mar-04 1:00 
General.net application and C dll Pin
mosquitooth10-Mar-04 21:39
mosquitooth10-Mar-04 21:39 
GeneralRe: .net application and C dll Pin
Antti Keskinen10-Mar-04 22:21
Antti Keskinen10-Mar-04 22:21 
GeneralDebugging symbols for Windows XP Pin
rrrado10-Mar-04 21:15
rrrado10-Mar-04 21:15 
GeneralPropertyPage Title Pin
Florin Ochiana10-Mar-04 20:30
Florin Ochiana10-Mar-04 20:30 
GeneralRe: PropertyPage Title Pin
Prakash Nadar10-Mar-04 21:36
Prakash Nadar10-Mar-04 21:36 

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.