|
Hi Mark. Thanks for your continuous help. I did some experiment and it actually worked by returning exit code 0. Though what I did may not be the right step. Since I don't really edit the ExitInstance() (as I have never used it before) I tried to check on my OnClose() function. By switching the original CDialog::OnClose() with PostQuitMessage(0), it actually returned the proper exit code of 0. But it may not be right since I forced it to return 0. Could you please check on this one?
void CApplicationDlg::OnClose() <br />
{<br />
SomeClass.CleanUp();<br />
<br />
CWnd* ThisDlg;<br />
ThisDlg= GetDlgItem(IDC_LEFTPICBOX);<br />
ThisDlg->ReleaseDC(&GlobalLeftPicDC);<br />
GlobalLeftPicDC.DeleteDC();<br />
ThisDlg= GetDlgItem(IDC_RIGHTPICBOX);<br />
ThisDlg->ReleaseDC(&GlobalRightPicDC);<br />
GlobalRightPicDC.DeleteDC();<br />
<br />
CDialog::OnClose();
}
I may be somehow going away from my problem here but I just want to prove that exit codes doesn't really have an effect on my program. Again, thank you for your help!
|
|
|
|
|
Llasus wrote: Program '[2788] Application.exe: Native' has exited with Code 2 (0x2).
If it's a dialog-based application, are you dismissing the dialog via OK or Cancel?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
No, I actually removed those two buttons that come as default when creating a new dialog.
|
|
|
|
|
How does the dismissal of the dialog by OK or Cancel relate to the Exit Code 2?
|
|
|
|
|
It relates to it 100%. Try it and see.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes you are right! Exit code of 0 is done when the OK or Cancel button is pushed. And Exit code 2 is when close button or alt-F4 is done. Thank you very much for your help!
|
|
|
|
|
I am compiling these samples from the command line. 1st and foremost, the vcvars32.bat doesn't show up where the documentation says it should, or at all for that matter. The include, bin, and lib env vars have been set, yet and still, when I run nmake, cl.exe cant find any of my include paths. Oh yea, Im using the cl.exe from the drivers developers kit since the platform sdk doesnt have a 32bit version included. Please help me.
|
|
|
|
|
shatterstar6457 wrote: the vcvars32.bat doesn't show up where the documentation says it should
Where are you expecting to find vcvars32.bat?
It's created when installing a visual C++ compiler and it sounds like you don't have
one installed.
MArk
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
..\vc\bin, isnt it installed with the installer?
|
|
|
|
|
What installer are you referring to??
shatterstar6457 wrote: Oh yea, Im using the cl.exe from the drivers developers kit since the platform sdk doesnt have a 32bit version included.
That seemed to imply you haven't installed a development environment...
Are you tring to use a compiler that came with the PSDK? I had no idea there was one included.
MArk
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
shatterstar6457 wrote: from the drivers developers kit
After reading your post 6 times I finally read that correctly
Anyway, I have no idea if the DDK installer sets up a useable vcvars32.bat
but I know the visual studio installer does.
Maybe download and install 2005 Express. You'll get a free up-to-date compiler
and the vcvars32.bat should be valid and where you expect it to be.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
Can i create two Cbrush objects in same dialog class?, i tried to do like this
<br />
void CMyChessView::OnDraw(CDC* pDC)<br />
{<br />
CBrush *white = new CBrush;<br />
CBrush *black = new CBrush;<br />
<br />
CMyChessDoc* pDoc = GetDocument();<br />
ASSERT_VALID(pDoc);<br />
white->CreateSolidBrush(RGB(255,255,255));<br />
black->CreateSolidBrush(RGB(0,0,0));<br />
<br />
for (int i=1;i<=8;i++)<br />
for (int j=1;j<=8;j++)<br />
{<br />
pDC->Rectangle((i-1)*56,(j-1)*56,i*56,j*56);<br />
}<br />
<br />
<br />
<br />
<br />
}<br />
but onresize the window some exception errors accured? does anyone know why the errors?
-- modified at 17:02 Monday 5th November, 2007
|
|
|
|
|
Gofur Halmurat wrote: Can i create two Cbrush objects in same dialog class?
Yes. The problem is somewhere else.
What line of code causes the exception? What is the specific exception?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello, i just changed the post, could u look at the code again please?
now, the error is "Debug Assertion Failed"?
|
|
|
|
|
Gofur Halmurat wrote: now, the error is "Debug Assertion Failed"?
There's lots of places that assertions can occur -
you really need to be more specific.
The only thing I can see is you're not freeing the brushes when you're done with them.
Are you depleting all your GDI resources??
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
Yes, i am deleting all GDi resources in desctroctor
I found where the problem is, the creation of those CBrushs cannt be in OnDraw Method, because OnResize method, it will create again the bruths
thanks
|
|
|
|
|
FWIW, you can simplify your code and reduce the chance of leaks
something like this:
void CMyChessView::OnDraw(CDC* pDC)
{
CBrush white(RGB(255,255,255));
CBrush black(RGB(0,0,0));
CMyChessDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
for (int i=1;i<=8;i++)
for (int j=1;j<=8;j++)
{
pDC->Rectangle((i-1)*56,(j-1)*56,i*56,j*56);
}
} mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark for trying to help me;)
|
|
|
|
|
Hello anyone and everone
I'm looking for a great website to learn C++
i"m a newbe at it and can barely make any sence of C++ code
I would like to programm games so any info in that diretion would be great
thanks for any advice.
|
|
|
|
|
|
|
hello!
How can i create a shortcut to a file on-the-run ?
If I could specify the folder where to create it, it would be great!
Thanks!
Shpid3r
|
|
|
|
|
|
uu... i`m really impressed! That article (on codeproject.com) answered all my questions!
Many thanks!
Shpid3r
|
|
|
|
|
Hello
I need to write a DLL for some functions that I have which depend on a separate lib file.
when i write a short test program that uses the functions as is and link against the lib file, everything works great. But when i take the same functions and put them in a DLL, it doesn't work (i get some unresolved references to any function that I use from the lib file).
Am i supposed to do anything special to get it to recognize the functions from the lib?
thanks for your time.
|
|
|
|