ReadConsoleOutput ERROR_NOT_ENOUGH_MEMORY
4 отговора
124 прегледа
ReadConsoleOutput ERROR_NOT_ENOUGH_MEMORY
kato puskam slednoto program4e nqkade okolo 64-tata iteracia polu4avam ERROR_NOT_ENOUGH_MEMORY a bi trqbvalo da ima dostata4no
nqkoj da ima ideq sto taka
-------------------------
#include <windows.h>
#include <stdio.h>
int main(){
HANDLE hConsoleOutput=NULL;
COORD c;
CHAR_INFO asScreenBuff[255 * 255];
COORD c1;
SMALL_RECT sr;
int i=0;
hConsoleOutput=GetStdHandle(STD_OUTPUT_HANDLE);
c.X=255;
c.Y=255;
if(SetConsoleScreenBufferSize(hConsoleOutput,c)==0){
char acBuff[255];
snprintf(acBuff,250,"GetLastError()=%d",GetLastError());
MessageBox(NULL,acBuff,"SetConsoleScreenBufferSize",0);
}
c.X=255;
c.Y=255;
c1.X=0;
c1.Y=0;
for(i=0;i<255;i++){
sr.Left=0;
sr.Top=0;
sr.Right=255;
sr.Bottom=i;
if(ReadConsoleOutput(hConsoleOutput,asScreenBuff,c,c1,&sr)==0){
char acBuff[255];
snprintf(acBuff,250,"GetLastError()=%d at sr.Bottom=%d",GetLastError(),i);
MessageBox(NULL,acBuff,"ReadConsoleOutput",0);
break;
}
}
return(0);
}
Re: ReadConsoleOutput ERROR_NOT_ENOUGH_MEMORY
lpBuffer
[out] Pointer to a destination buffer that receives the data read from the console screen buffer. This pointer is treated as the origin of a two-dimensional array of CHAR_INFO structures whose size is specified by the dwBufferSize parameter. The total size of the array must be less than 64K.
[out] Pointer to a destination buffer that receives the data read from the console screen buffer. This pointer is treated as the origin of a two-dimensional array of CHAR_INFO structures whose size is specified by the dwBufferSize parameter. The total size of the array must be less than 64K.
Re: ReadConsoleOutput ERROR_NOT_ENOUGH_MEMORY
255 * 255 = 64 K vav size-a sam
osven tova 64*255 = 16K oste tam spira
osven tova 64*255 = 16K oste tam spira
Re: ReadConsoleOutput ERROR_NOT_ENOUGH_MEMORY
Ami cheti vnimatelno de. 16K * sizeof(CHAR_INFO) = ????