|
Did you try to use:
try
{
/*some code*/
}
catch (System::Runtime::InteropServices::SEHException *)
{
}
|
|
|
|
|
Sure, but the SEHException doesnt contain anything of MY exception. I tried to simply throw an integer error code and this is later a member of the SEHException. So there is some way of interaction between the exceptions...
|
|
|
|
|
|
Great,
that is exactly the information I searched for - perhaps i should have had a longer try searching MSDN for this.
It's working fine now..
|
|
|
|
|
need sourcecode on checkers software with neural network and genetic algorithm coded in it to make computers play checkers
-- modified at 17:22 Monday 10th October, 2005
|
|
|
|
|
Sure - where should I send my quote ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
to linux_addict1978@hotmail.com
i need a program the program should take as input 2 intgers and the operation to be performed.It should then output the numbers,the operator and the result
|
|
|
|
|
LOL - what's this about ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
You need it for an assignment ? There I was thinking it was a real world application - not. I know you're trying to cheat on your homework, I'm trying to give you a feel for how the real world works ( do you own homework, in other words )
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi for all
Fellows, in my application I'm drawing a font(arial, size: 50).
When the font is displayed their appearance is not so good, it seems that some parts of letters are vertically cutted.
I've put the glHint function, like this:
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
And this is my method that draws the font:
void ImprimeTexto(unsigned int iFont, const char* cValue)
{
if(iFont == 0) MessageBox(0,"Fodeu", "tela",0);
glPushAttrib(GL_LIST_BIT);
glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);
glListBase(iFont - 32);
glCallLists(strlen(cValue), GL_UNSIGNED_BYTE, cValue);
glPopAttrib();
}
My screen resolution is 1024x768.
I don't know what's going on, anyone can help me?
|
|
|
|
|
Hi fellows
I'm need to capture a screen in my app, but I have no idea how I can do this or where I start. Can someone help with this saying where I can get some information about how and where to start?
Thanks a lot
Alex Cutovoi
|
|
|
|
|
Since there is no such thing as a screen in C++ I assume you mean the WindowsAPI. Are you using opengl as I see you have a question about opengl above??
John
-- modified at 12:55 Monday 10th October, 2005
|
|
|
|
|
|
John, I've read that article that you said. I don't understand almost all, it's complicated. Well, I got made this, is this correct??
At this point I'm completely lost, I don't know what is the next step. I'll try to understand.
void CapturaTela()
{
int iWidth = GetSystemMetrics(SM_CXSCREEN);
int iHeight = GetSystemMetrics(SM_CYSCREEN);
HWND screenHwnd;
HDC screenHdc;
HDC copyHdc;
HBITMAP newBitmap;
screenHwnd = GetDesktopWindow();
screenHdc = GetDC(screenhwnd);
copyHdc = CreateCompatibleDC(screenHdc);
HBITMAP bitmap = CreateCompatibleBitmap(screenHdc, iWidth, iHeight);
SelectObject(copyHdc, bitmap);
BitBlt(copyHdc, 0, 0, iWidth, iHeight, screenHdc, 0, 0, SRCCOPY);
newBitmap = bitmap;
}
|
|
|
|
|
Alex Cutovoi wrote:
newBitmap = bitmap;
This seems redundant to me.
This leaks memory ( you need to catch the HBITMAP returned by select object and put it back in, you need to delete your DC and any HBITMAP you're not going to return ), but off the top of my head, it looks pretty much right, in that it should work.
Alex Cutovoi wrote:
HWND screenHwnd;
HDC screenHdc;
HDC copyHdc;
HBITMAP newBitmap;
There is no reason to create these before the moment you assign their value, and it's bad to have variables with random values in them flying about.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Christian and John, my code now is this, it's a little big. Is this correct?
Please, I made this based on the article that you(John) said me, and I don't know if this thing is all correct. It's my first time that I do this.
Thanks for you guys
void CapturaTheScreen()
{
int iWidth = GetSystemMetrics(SM_CXSCREEN);
int iHeight = GetSystemMetrics(SM_CYSCREEN);
HWND screenHwnd;
HDC* screenHdc;
RECT theRect;
HDC copyHdc;
BYTE* desenhobits;
//HBITMAP newBitmap;
theRect.bottom = 0;
theRect.left = 0;
theRect.right = 0;
theRect.top = 0;
screenHwnd = GetDesktopWindow();
screenHdc = GetDC(screenHwnd);
copyHdc = CreateCompatibleDC(screenHdc);
HBITMAP bitmap = CreateCompatibleBitmap(screenHdc, iWidth, iHeight);
SelectObject(copyHdc, bitmap);
BitBlt(copyHdc, 0, 0, iWidth, iHeight, screenHdc, 0, 0, SRCCOPY);
BITMAPINFOHEADER infoHeader;
//Image header info
infoHeader.biSize = sizeof(BITMAPINFOHEADER);
infoHeader.biBitCount = 24;
infoHeader.biPlanes = 1;
infoHeader.biWidth = theRect.right;
infoHeader.biHeight = theRect.bottom;
infoHeader.biCompression = BI_RGB;
infoHeader.biSizeImage = ((((infoHeader.biWidth * infoHeader.biBitCount) + 31) & ~31) >> 3) * infoHeader.biHeight;
theRect = CreateDIBSection(screenHdc, (CONST BITMAPINFO*)&infoHeader, DIB_RGB_COLORS, (void**)&desenhobits, NULL, 0);
ReleaseDC(screenHdc);
//processo de gravação
FILE* fImage = fopen("img1.bmp", "wb");
if(fImage == NULL)
{
//image info
BITMAPFILEHEADER fileHeader;
int iBits= sizeof(BITMAPFILEHEADER) + infoHeader.biSize;
LONG lTamImagem = infoHeader.biSizeImage;
LONG lFileSize = lTamImagem + iBits;
fileHeader.bfOffBits = iBits;
fileHeader.bfType = 'B'+('M'<<8);
fileHeader.bfSize = lFileSize;
fileHeader.bfReserved1 = 0;
fileHeader.bfReserved2 = 0;
unsigned int iTheFileHeader = fwrite(&fileHeader, 1, sizeof(BITMAPFILEHEADER), fImage);
unsigned int iTheInfoHeader = fwrite(&infoHeader, 1, sizeof(BITMAPINFOHEADER), fImage);
unsigned int iTheImage = fwrite(desenhobits, 1, lFileSize, fImage);
}
}
-- modified at 18:10 Monday 10th October, 2005
|
|
|
|
|
I guess the question is, what does it do that you're still asking ?
Alex Cutovoi wrote:
if(fImage == NULL)
I assume this should be != ? I dunno tho, I don't use C file handling.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
John, my code works fine, but when I open the image with Windows Picture appears the message: "Drawing failed". I don't know why. it's strange, cause the code is right(I think);
The Image when it's saved has the size of 4kb. The BITMAPINFOHEADER's biXPelsPerMeter and biYPelsPerMeter properties I set to 0, cause when I saw the horizontal and vertical resolution values, they was absolutely crazy.
Can you help?
Thanks again
Alex Cutovoi
|
|
|
|
|
I hope someone could tell me a efficient way to find some strings in another string.Thanks!
|
|
|
|
|
You can use strstr function.
See more information in MSDN.
-- modified at 5:05 Monday 10th October, 2005
|
|
|
|
|
Are there any wanys even more efficient? Thanks!
|
|
|
|
|
Jacky Chee wrote:
Are there any wanys even more efficient?
Ask yourself this: "Does it need to be more efficient?"
If "yes", then: "Have I profiled the code so that I know this for a fact?"
If "no", then accept the offered strstr for a char* buffer (or std::string::find for a std::string object).
--
The Blog: Bits and Pieces
|
|
|
|
|
I'm new to network programming, and I would apperciate if I could get some links to tutorials/samples of UDP client/server programming in c++.
Thanks
|
|
|
|
|
i need a program, the program should take as input 2 intgers and the operation to be performed.It should then output the numbers,the operator and the result.
|
|
|
|