Click here to Skip to main content
15,885,546 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: DirectX problem Pin
Mark Salsbery6-Dec-07 14:28
Mark Salsbery6-Dec-07 14:28 
GeneralRe: DirectX problem Pin
MarkB7776-Dec-07 15:13
MarkB7776-Dec-07 15:13 
Generalstring class Pin
linksys20066-Dec-07 12:18
linksys20066-Dec-07 12:18 
GeneralRe: string class Pin
linksys20066-Dec-07 12:31
linksys20066-Dec-07 12:31 
GeneralRe: string class Pin
linksys20066-Dec-07 12:47
linksys20066-Dec-07 12:47 
Generaloff topic Pin
Nelek6-Dec-07 21:27
protectorNelek6-Dec-07 21:27 
GeneralRe: string class Pin
jhwurmbach6-Dec-07 21:43
jhwurmbach6-Dec-07 21:43 
GeneralCreatedibsection Returning Error_not_enough_memory, misterious problem Pin
csmanul6-Dec-07 12:06
csmanul6-Dec-07 12:06 
hello , i am trying to write a bmp to file , sometimes works sometimes it doesn't work properly . i am making recorder for ymsg.

i tried to snapshot the whole screen and look what happens when the webcam window is present in the snapshot , the image is clear before the webcam window , why ? i don't have a clue. and CreateDIBSection returns ERROR_NOT_ENOUGH_MEMORY. and after all this i've written a tester to see when CreateDIBSection returns ERROR_NOT_ENOUGH_MEMORY.

i am thinking that this problem may have 2 issues , 1. my code is wrong , 2. bug in windows and of course this api function.

here is the sample snapshot image:
http://www.rohitab.com/discuss/index.php?act=attach&type=post&id=1658[^]

tester to see when CreateDIBSection return an error


#include <stdio.h>
#include <windows.h>

DWORD error=0;

BOOL test(int nWidth, int nHeight)
{

HDC memDC = CreateCompatibleDC(NULL);

BITMAPINFO i;
ZeroMemory(&i.bmiHeader, sizeof(BITMAPINFOHEADER) );
int extrabytes = (4 - (nWidth * 3) % 4) % 4;
i.bmiHeader.biWidth = nWidth;
i.bmiHeader.biHeight = nHeight;
i.bmiHeader.biPlanes = 1;
i.bmiHeader.biBitCount = 24;
i.bmiHeader.biSizeImage = (nWidth * 3 + extrabytes) * nHeight;
i.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
i.bmiHeader.biClrUsed = 0;
i.bmiHeader.biClrImportant = 0;

VOID *pvBits;

error=0;
HBITMAP h = CreateDIBSection(memDC, &i, DIB_RGB_COLORS, &pvBits, NULL, 0);
error=GetLastError();
if (h==NULL)
{
DeleteDC(memDC);
return 1;
}
DeleteObject(h);
DeleteDC(memDC);
return 0;
}



int main()
{
for (int k=1;k<100000;k++)
{
test(k,k);
printf("\n%u eror:%d", k,error);

}

return 0;


}
GeneralRe: Createdibsection Returning Error_not_enough_memory, misterious problem Pin
Bram van Kampen7-Dec-07 13:38
Bram van Kampen7-Dec-07 13:38 
GeneralRe: Createdibsection Returning Error_not_enough_memory, misterious problem Pin
csmanul7-Dec-07 23:56
csmanul7-Dec-07 23:56 
GeneralRe: Createdibsection Returning Error_not_enough_memory, misterious problem Pin
Bram van Kampen8-Dec-07 16:15
Bram van Kampen8-Dec-07 16:15 
GeneralRe: Createdibsection Returning Error_not_enough_memory, misterious problem Pin
Mike Dimmick7-Dec-07 17:04
Mike Dimmick7-Dec-07 17:04 
GeneralRe: Createdibsection Returning Error_not_enough_memory, misterious problem Pin
csmanul9-Dec-07 23:20
csmanul9-Dec-07 23:20 
QuestionNeed to call FormatRange member of a richedit control in a modeless dialog from the view class Pin
lctrncs6-Dec-07 9:42
lctrncs6-Dec-07 9:42 
GeneralRe: Need to call FormatRange member of a richedit control in a modeless dialog from the view class Pin
Mark Salsbery6-Dec-07 9:48
Mark Salsbery6-Dec-07 9:48 
GeneralRe: Need to call FormatRange member of a richedit control in a modeless dialog from the view class Pin
led mike6-Dec-07 10:01
led mike6-Dec-07 10:01 
GeneralRe: Need to call FormatRange member of a richedit control in a modeless dialog from the view class Pin
Mark Salsbery6-Dec-07 11:28
Mark Salsbery6-Dec-07 11:28 
GeneralRe: Need to call FormatRange member of a richedit control in a modeless dialog from the view class Pin
David Crow6-Dec-07 16:01
David Crow6-Dec-07 16:01 
GeneralRe: Need to call FormatRange member of a richedit control in a modeless dialog from the view class Pin
Mark Salsbery7-Dec-07 8:05
Mark Salsbery7-Dec-07 8:05 
GeneralRe: Need to call FormatRange member of a richedit control in a modeless dialog from the view class Pin
led mike7-Dec-07 8:33
led mike7-Dec-07 8:33 
GeneralRe: Need to call FormatRange member of a richedit control in a modeless dialog from the view class Pin
Mark Salsbery7-Dec-07 8:38
Mark Salsbery7-Dec-07 8:38 
GeneralRe: Need to call FormatRange member of a richedit control in a modeless dialog from the view class Pin
led mike7-Dec-07 8:42
led mike7-Dec-07 8:42 
GeneralRe: Need to call FormatRange member of a richedit control in a modeless dialog from the view class Pin
lctrncs7-Dec-07 8:27
lctrncs7-Dec-07 8:27 
GeneralRe: Need to call FormatRange member of a richedit control in a modeless dialog from the view class Pin
led mike7-Dec-07 8:41
led mike7-Dec-07 8:41 
GeneralRe: Need to call FormatRange member of a richedit control in a modeless dialog from the view class Pin
lctrncs7-Dec-07 8:51
lctrncs7-Dec-07 8:51 

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.