|
Please help and correct me if I am using the incorrect method (I am only learning). What I am trying to do is save a frame from a buffer to a .bmp file. The buffer contains the bits of a bmp image which is 768 * 576 * 32bit. Here is the code that I have been trying to get to work.
CBitmap FrameBitmap;
CFile myBmpFile("Captures/test.bmp", CFile::modeCreate | CFile::modeReadWrite);
//Create the storing archive.
CArchive arStore(&myBmpFile, CArchive::store);
//Create the CBitmap
FrameBitmap.CreateBitmap(768,576,1,32,pImageBuffer);
if(FrameBitmap.IsSerializable())
{
FrameBitmap.Serialize(arStore);
}
//Close the archive and the file
arStore.Close();
myBmpFile.Close();
Thanks
Dave
|
|
|
|
|
|
You've indicated what you want to do, but have not indicated what is actually happening. Are you getting compiler/linker errors? Is an assertion firing? Have you single-stepped through the code to see what is going on? Something a little more detailed than "Here is some code that is not working." leaves a lot to be desired.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I am not getting any errors at all, all that is happening is the test.bmp file is being written to the hard drive its size is 0kb and it will not open in an image editor. It seems like it does not contain any information.
I have also tryed the following method to no avail, this following method creates a valid .bmp file with all the correct dimensions which will open in an image editor, problem is the whole image is black. I am not sure what to do with the RGBQUAD bmPallette[1]; & bmInfo.bmiColors = bmPallette; and i guess this could be the problem in this method:-
BITMAPFILEHEADER bmfHeader;
BITMAPINFO bmInfo;
BITMAPINFOHEADER bmiHeader;
//RGBQUAD bmPallette[1];
bmfHeader.bfType = 0x4D42;
bmfHeader.bfSize = (sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFO) + (768*576*4));
bmfHeader.bfOffBits = (bmfHeader.bfSize - (768*576*4));
bmfHeader.bfReserved1 = 0;
bmfHeader.bfReserved2 = 0;
bmiHeader.biBitCount = 32;
bmiHeader.biClrImportant = 0;
bmiHeader.biCompression = BI_RGB;
bmiHeader.biHeight = 576;
bmiHeader.biPlanes = 1;
bmiHeader.biSizeImage = 0;
bmiHeader.biWidth = 768;
bmiHeader.biClrUsed = 0;
bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmiHeader.biXPelsPerMeter = 2834.6;
bmiHeader.biYPelsPerMeter = 2834.6;
//bmInfo.bmiColors = bmPallette;
bmInfo.bmiHeader = bmiHeader;
DWORD dwBitsSize = bmfHeader.bfSize;
CFile file("Captures/test.bmp", CFile::modeCreate | CFile::modeReadWrite);
file.Write((LPSTR)&bmfHeader, sizeof(bmfHeader));
file.Write((LPSTR)&bmInfo, sizeof(bmInfo));
file.Write((LPSTR)&pBuffer, sizeof(pBuffer));
file.Close();
Thanks
Dave
|
|
|
|
|
How to laod C# Form in MFC project?
|
|
|
|
|
You should ask Tom Archer or Nish for that. They are the experts for this.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Hi There,
I've made a key accelerator table, and I've linked this one to my app. But how do I associate the message from the accelerator to a function?
Is this also possible in a dialog based app?
Thanks,
|
|
|
|
|
A keyboard accelerator generates (through the ::TranslateAccelerator function) a WM_COMMAND message with the identifier you've assigned in the accelerator table.
In MFC, CFrameWnd::PreTranslateMessage calls ::TranslateAccelerator for you. Handle the message with an ON_COMMAND macro. For a raw API application, you should add a call to TranslateAccelerator in your message loop and handle the message in your window's window procedure.
For an MFC dialog-based application, override PreTranslateMessage and add a call to TranslateAccelerator . Again, handle with ON_COMMAND .
Note that menu items, command buttons, toolbar buttons and accelerators all generate WM_COMMAND messages. You should assign all items in the above categories which perform the same operation the same identifier (e.g. ID_FILE_SAVE for the File > Save menu item, the Save button in the toolbar, and the Ctrl+S key combination).
|
|
|
|
|
hi,
i want to use the function StrRetToStr(...) in a Console Application, i have included the corresponding file Shlwapi.h and the library Shlwapi.lib but the function isn't declared in them ? is this a bad joke from microsoft ??
Does this function exist at all ?
Thanks in advance !
|
|
|
|
|
Hi,
What IE version u have ?
Use the func below. Check if same thing happening with this also
StrRetToBuf
The chosen One
|
|
|
|
|
StrRetToBuf also doesn't exist/work !
|
|
|
|
|
What @ IE version u r having on ur machine?
The chosen One
|
|
|
|
|
|
i have the one which came with VS6!
Can you give me a favour, and send me the shlwapi.h which came with the SDK ?
Thanks in advance!
|
|
|
|
|
All these functions are exported from Shlwapi.dll (7/24/2002) as (ASCII: StrRetToBufA, UNICODE: StrRetToBufW etc)
If not included in your version of Shlwapi.h you could consider checking in the latest W32 SDK (note that the standard MSDevStudio files are usually quite out of date).
Quick solution might be to add its declaration yourself in your code.
You would need of course to make sure that the right version of Shlwapi.dll is installed on the target system
|
|
|
|
|
After using VS.NET c++ for several hours and doing many "find in file" operations. Find in files will hang at the begining of a search and you will not be able to interrupt it. If subsequently you try to do a normal Find the whole application hangs.
Has anyone else noticed this?
I seen a newspost saying that pressing ctrl scroll
lock may fix this, but I tried that and it does not work.
I am using Microsoft Development Environment 2003 Version 7.1.3088 under Windows XP.
|
|
|
|
|
Hi.
I'm using FindFirstChangeNotification to get an event about a new file being created in a specific directory. for some odd reason, calling DeleteFile on that file doesn't do anything.
Even when calling the deleteFile after calling CloseChangeNotification.
Any idea ?
|
|
|
|
|
Have you tried using ::GetLastError() after the delete to check why it fails? Also from memory you can't delete r/o files.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Is the file on your local drive or on a network drive? I could not get it to work on a network drive, only on my local c: drive. I have found some articles on the internet that says it works with network drives and other articles that says it does not work with network drives.
|
|
|
|
|
Hi,
How do i toggle a checkbox? if lets say i want it to be FALSE initially...the moment i click on it...i want it to be TRUE, and so on...how do i do that?? Also, how do i get the state of the check box? Thanks 4 ur help!!
|
|
|
|
|
checkbox is button with style as BS_CHECKBOX
Use GetState() and SetState() of CButton class.
The chosen One
|
|
|
|
|
If you give it the BS_AUTOCHECKBOX style, it toggles automatically when you click.
otherwise, as already said, it's internally a BUTTON class, you can query and change the check state with BM_SETCHECK and BM_GETCHECK (or CButton::SetCheck, GetCheck)
"Vierteile den, der sie Hure schimpft mit einem türkischen Säbel."
sighist | Agile Programming | doxygen
|
|
|
|
|
Hi all,
I have the file strings.mc (from the message compiler).
i want to read it using CStdioFile class....
performing :
CStdioFile file(szFile,CFile::modeRead);
char buff[MAX_PATH];
do
{
file.ReadString(buff,MAX_PATH);
} while (buff != NULL);
doesn't work so good.....
can any1 help?
thanks in advanced
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Hi,
add "_UNICODE" in project/settings/C++/general/Preprocessor definations.
CStdioFile file;
CString str;
while( file.ReadString(str))
{
//Do something
}
if u get any linking error with libraries starting or ending with "u" (e.g. uafxcwd.lib), then u need to install unicode support for VC ide on ur machine.
The chosen One
|
|
|
|
|
thanks
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|