Click here to Skip to main content
15,908,111 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: AFX_MANAGE_STATE in CMyThread::InitInstance()? Pin
Mark Salsbery24-Jan-08 9:52
Mark Salsbery24-Jan-08 9:52 
GeneralRe: AFX_MANAGE_STATE in CMyThread::InitInstance()? Pin
led mike24-Jan-08 10:19
led mike24-Jan-08 10:19 
GeneralRe: AFX_MANAGE_STATE in CMyThread::InitInstance()? Pin
Mark Salsbery24-Jan-08 10:26
Mark Salsbery24-Jan-08 10:26 
GeneralRe: AFX_MANAGE_STATE in CMyThread::InitInstance()? Pin
led mike24-Jan-08 10:52
led mike24-Jan-08 10:52 
GeneralRe: AFX_MANAGE_STATE in CMyThread::InitInstance()? Pin
Mark Salsbery24-Jan-08 11:01
Mark Salsbery24-Jan-08 11:01 
GeneralRe: AFX_MANAGE_STATE in CMyThread::InitInstance()? Pin
Wes Jones24-Jan-08 10:40
Wes Jones24-Jan-08 10:40 
GeneralRe: AFX_MANAGE_STATE in CMyThread::InitInstance()? Pin
Mark Salsbery24-Jan-08 10:43
Mark Salsbery24-Jan-08 10:43 
General16-24 Bit image issue for MFC Pin
sunny.rana24-Jan-08 7:05
sunny.rana24-Jan-08 7:05 
Hi i had posted this before too i have and image acquisition code that acquires image from CCD camera and stores it to pointer named "*memory"

pl_exp_start_seq(hCam, memory)

i want to display this memory as bmp file and save it to my hard disk, i did write code for it but that saves it in 8 bit format and i loose a lot of valuable information can any one please help, y code is as follows and thankz in advance





void Create_DIB( HWND hWnd )
{

HDC hDC;
unsigned char i;
long k,j, NumBytes;
LPBITMAPINFO info;
unsigned char *dat;
DWORD error;

hDC = GetDC (hWnd) ;
// Intialize BITMAPINFOHEADER data.
//.................................
bi.biSize = sizeof (BITMAPINFOHEADER) ;
bi.biWidth = W;
bi.biHeight = -H; // top-down DIB
bi.biPlanes = 1;
bi.biBitCount = COLORBITS;
bi.biCompression = BI_RGB;
bi.biSizeImage = ( ALIGNLONG( (W * COLORBITS)/8 ) * H);
bi.biXPelsPerMeter = 0;
bi.biYPelsPerMeter = 0;
bi.biClrUsed = 256;
bi.biClrImportant = 256;


// Allocate memory for BITMAPINFO structure.
//..........................................
NumBytes = sizeof(BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD); // +
//( ALIGNLONG( ( W * COLORBITS ) / 8 ) * H );

lpbi = (BITMAPINFOHEADER*)GlobalAlloc( GPTR, NumBytes );

if( lpbi == NULL )
{
LPVOID lpMsgBuf;
FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf, 0, NULL );
// Display the string.
MessageBox( NULL, (LPCTSTR)lpMsgBuf, "Error", MB_OK | MB_ICONINFORMATION );
// Free the buffer.
LocalFree( lpMsgBuf );

exit( EXIT_FAILURE ); // Get out now!
}

// Copy BITMAPINFOHEADER information.
//...................................
*lpbi = bi;

// Create The Palette
info = (LPBITMAPINFO) lpbi;


for ( i=0; i<255; i++ )
{
info->bmiColors[i].rgbRed = i;
info->bmiColors[i].rgbBlue = i;
info->bmiColors[i].rgbGreen = i;
info->bmiColors[i].rgbReserved = 0;
}

// Set pointer to bitmap’s bit data.
//..................................
// lpstBitmap = (LPSTR)lpbi + (WORD)sizeof(BITMAPINFOHEADER) +
// (256 * sizeof(RGBQUAD));

hBitmap = ::CreateDIBSection(hDC,(LPBITMAPINFO)lpbi, DIB_RGB_COLORS,(VOID **)&lpstBitmap, NULL,0);
dat = (unsigned char*)lpstBitmap;

for ( k=0; k< H; k++ )
for ( j = 0; j < W; j++ )
*dat++ = (unsigned char)k;

// Create uninitialized DIB bitmap.
//.................................
/* hBitmap = CreateDIBitmap( hDC,
&bi,
0 ,
0,
(LPBITMAPINFO) lpbi, */




error = GetLastError();


ReleaseDC( hWnd, hDC);



}

void Save(int num)
{

CString prefix = "C:\\Documents and Settings\\Garner Lab\\My Documents\\Xanoscopeimages\\image";
char buf[4];
itoa(num, buf, 10);
CString number = buf;
CString suffix = ".bmp";
fullname = prefix + number + suffix;
CImage image;
image.Attach(hBitmap);
image.Save(fullname); // save as BMP
image.Detach();
GeneralRe: 16-24 Bit image issue for MFC Pin
Mark Salsbery24-Jan-08 7:28
Mark Salsbery24-Jan-08 7:28 
GeneralRe: 16-24 Bit image issue for MFC Pin
sunny.rana25-Jan-08 9:39
sunny.rana25-Jan-08 9:39 
GeneralRe: 16-24 Bit image issue for MFC Pin
Mark Salsbery27-Jan-08 7:06
Mark Salsbery27-Jan-08 7:06 
GeneralDialog Displays Differently Pin
Reagan Conservative24-Jan-08 6:47
Reagan Conservative24-Jan-08 6:47 
QuestionRe: Dialog Displays Differently Pin
David Crow24-Jan-08 7:31
David Crow24-Jan-08 7:31 
GeneralRe: Dialog Displays Differently Pin
Reagan Conservative24-Jan-08 8:17
Reagan Conservative24-Jan-08 8:17 
QuestionRe: Dialog Displays Differently Pin
David Crow24-Jan-08 9:17
David Crow24-Jan-08 9:17 
GeneralRe: Dialog Displays Differently Pin
Reagan Conservative24-Jan-08 9:19
Reagan Conservative24-Jan-08 9:19 
QuestionRe: Dialog Displays Differently Pin
David Crow24-Jan-08 9:23
David Crow24-Jan-08 9:23 
GeneralRe: Dialog Displays Differently Pin
Reagan Conservative24-Jan-08 9:47
Reagan Conservative24-Jan-08 9:47 
QuestionRe: Dialog Displays Differently Pin
David Crow24-Jan-08 9:52
David Crow24-Jan-08 9:52 
GeneralRe: Dialog Displays Differently Pin
Reagan Conservative24-Jan-08 10:14
Reagan Conservative24-Jan-08 10:14 
QuestionRe: Dialog Displays Differently Pin
David Crow24-Jan-08 10:18
David Crow24-Jan-08 10:18 
GeneralRe: Dialog Displays Differently Pin
Reagan Conservative24-Jan-08 10:22
Reagan Conservative24-Jan-08 10:22 
QuestionRe: Dialog Displays Differently Pin
David Crow24-Jan-08 10:32
David Crow24-Jan-08 10:32 
GeneralRe: Dialog Displays Differently Pin
Reagan Conservative24-Jan-08 10:48
Reagan Conservative24-Jan-08 10:48 
QuestionRe: Dialog Displays Differently Pin
David Crow24-Jan-08 11:01
David Crow24-Jan-08 11:01 

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.