|
Hockey -
The problem is that the exception handler could itself throw another exception. So, dont use the above code snippet.
For example : if m_pStack[i] referred to uncommited virtual memory, both references to m_pStack[i] would throw a ILLEGAL_ACCESS exception.
Hth-
V
|
|
|
|
|
What technique should I use then...???
I think it would be wise to use exceptions when deleting memory incase it's a bogus pointer...no...???
thanx
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
i am a beginner try to make my own installer. how do i copy files to a directory that the user picks to install to?
|
|
|
|
|
Use the CopyFile function.
Step back, rub your eyes, take a deep breath, stretch a bit, and reflect on the relative importance of CP, CG, the age / travel time sustained by supposedly 'fresh' cheese curds, and Life in General. - Shog9
|
|
|
|
|
If my function has try and catch in it, do I put a return at the end of the catch block? I have a return at the end of my try block. My function returns an int.
Thanks,
ns
|
|
|
|
|
You should put the return outside the try catch block, otherwise you need to return inside the catch and the try. The point of the catch is that the rest of the try code will not be executed. I'd do something like this
int MyFunc()
{
int nRetVal = -1;
try
{
}
catch (...)
{
}
return nRetval;
}
Where -1 is a sensibile value to indicate failure, or to have no effect.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
|
|
|
|
|
Appreciate the response.
ns
|
|
|
|
|
I've looked in my .h file quite carefully, but dont see anything suspicious:
Compile error is:
c:\trainer\db2\dbclass.cpp(4) : error C2143: syntax error : missing ';' before 'PCH creation point'
and it points to the first line in the file...
Thanks,
ns
|
|
|
|
|
Probably something is wrong in your stdafx.h
Try to correct it and do a full rebuild
Concussus surgo.
When struck I rise.
|
|
|
|
|
Thanks,
I had a missing ; just like it said. It was not in an obvious place, but I did track it down. Learned how importannt it is to put #include <stdafx.h> before a #import directive, the hard way!!!
Thanks for responding,
ns
|
|
|
|
|
I am a beginner just jumping right in and was wondering if anyone new a way to call an external .exe from inside mc++ source?
|
|
|
|
|
spawn, CreateProcess, ShellExecute, WinExec, you have many options.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
Surely I dont have to recreate the project from scratch? The sample code I am using isnt an MFC app, so I dont know wht all to add, or not add, since I am getting the compile error of #include windows.h , a no-no in MFC apps apparently...
|
|
|
|
|
What kind of database class are you wanting to add?
ADO should be as simple as adding the following to your CPP file
#include "stdafx.h"
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" rename_namespace("littleADO") rename("EOF", "EndOfFile")
Michael
Time flies like an arrow. Fruit flies like a banana
|
|
|
|
|
Its what I had been trying to do to include support for a simple access db. i had the order of the #include and #import reversed, so wasted several hours debugging the errors I got. I thought I was missing something and needed more files to include or something. Thanks so much for the response,
ns
|
|
|
|
|
I only have these files in my added class in an MFC project:
#import "C:\\Program Files\\Common Files\\SYSTEM\\ADO\\msado15.dll" \
no_namespace \
rename( "EOF", "adoEOF" )
#include "stdafx.h"
#include <ole2.h>
I get the compile error (for my added class:
c:\program files\microsoft visual studio\vc98\mfc\include\afxv_w32.h(14) : fatal error C1189: #error : WINDOWS.H already included. MFC apps must not #include <windows.h>
What is missing or extra ?
Thanks,
ns
|
|
|
|
|
Move import line after
#include "stdafx.h"
|
|
|
|
|
Thanks so much! That worked!
ns
|
|
|
|
|
Hi again,
I've been asked to write a simple ftp client, usually that would be easy enough with wininet but for this it needs to be able to perform server to server transfers. Its for a system we're trying to implement for backing up our work. I know of FXP but how would I go about doing this in an MFC program? Its a bit daunting to be honest but we really need to get it done soon. Or even better if anyone knows of a library out there that has the features of being able to make server to server transfers, life would be great
Thanks
|
|
|
|
|
i intend to develop a software to manage my private files.
when this software is running, no "save" or "edit" commands will
be allowed in the MS office (word, excel...). Now i
am wondering whether there has already been some software
like this, or, if not, can anyone give me some hints?
(now i can use my program to capture the windows messages,
like WM_SIZE, WM_CLOSE in another program, but not
the "save" command.)
can i use API hooking to do this?
|
|
|
|
|
I have:
char* tempImage = (char *) (_bstr_t) pRecordset->Fields->GetItem ("pImage")->Value;
The stuff stored in Value is a pointer to data gotten out of a bmp (so its binary right? )
So should I be doing char*?
Not sure.
Also how to get the size of the image stored in Value? Strlen would count upto the first embedded Null, of which there are plenty in the binary data. So, what function to read the size?
Thanks,
ns
|
|
|
|
|
The safer way would be checking the Value.vt and verify the Variant type you are receiving. Prolly a SAFEARRAY of BYTE or a BSTR; in this case, I would not use char *, I would use LPCTSTR indeed.
Concussus surgo.
When struck I rise.
|
|
|
|
|
The safer way would be checking the Value.vt and verify the Variant type you are receiving. Prolly a SAFEARRAY of BYTE or a BSTR; in this case, I would not use char *, I would use LPCTSTR indeed. The _bstr_t or SAFEARRAY manipulation classes and APIs have methods for safely determining the length.
Concussus surgo.
When struck I rise.
|
|
|
|
|
Hi,
I would like detect when I execute an application (exe) if exist. Ok for that part I finding the code.
Now I would like if the EXE exist active the window.
Best Regards
youssef
|
|
|
|
|
how to use valarray.
i get many errors from #include<valarray>
|
|
|
|