|
RobJones wrote: ...it takes between 2 and 10 times of opening the dialog and clicking OK before it will crash.
Which OK button, the one on your dialog, or the one on the File Open dialog?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Sorry I ment to say the 'Open' button on the CFileDialog..
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
It appears that m_ldFile.GetPathName() is causing the issue...
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
So if you commented out everything in between these two statements, would the exception persist:
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Yeah, I think the part that is actually throwing the exception is m_ldFile.GetPathName() but I don't know why. The following trows the exception but if I remark out the m_ldFile.GetPathName() the exception stops.
static char BASED_CODE szFilter[] = _T("Text File (*.txt)|*.txt||");
CFileDialog m_ldFile(TRUE, _T(".txt"), NULL, OFN_HIDEREADONLY, szFilter);
if (m_ldFile.DoModal() == IDOK)
{
CString strFilePath = m_ldFile.GetPathName();
}
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
RobJones wrote: CString strFilePath = m_ldFile.GetPathName();
You might put a breakpoint on this statement and step into the GetPathName() method to get the exception narrowed down a bit further.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
If you are using Visual Studio 8, enable breaking on first change exceptions in the debugger.
You can do that by going to Debug->Exceptions, expanding the Win32 Exceptions node and marking the ones you care about.
This will let the debugger stop where it's happening so you can narrow down the probelm.
gmileka
|
|
|
|
|
I set the 0xC0000005 to break and it still doesn't really show anything it just goes directly into disassembly.
I did notice that I have to display the file dialog 2 times in order for the crash to happen.
I'm off to do some more testing...
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
You should be able to see the call stack - and narrow it down to the call originating from your code (Debug->Windows->Call Stack while app is running under the debugger).
gmileka
|
|
|
|
|
The only thing it shows in the call stack is:
shell32.dll!7ca51406()
In the quick watch it shows 7CA51406 = CXX0013: Error: missing operator
Whoever said nothing's impossible never tried slamming a revolving door!
-- modified at 14:50 Thursday 13th April, 2006
|
|
|
|
|
After doing alot of research on the net I found that quite a few others are having the same issues and everyone suggested to use GetOpenFileName instead... I have implemented that and everything seems to be working fine.
Thanks for all the suggestions!
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
how to close or recycle FILE f_ptr after using it. e.g.
FILE *f_ptr1
if((f_ptr1 = fopen(textFileName,"w")) == NULL) {
...}
....
And how to recycle a array after use it within a program.
double data[10000];
....using it and finish use it
how to close or destroy it so reserve the memory
|
|
|
|
|
mrby123 wrote: how to close...
How about fclose() ?
mrby123 wrote: double data[10000];
....using it and finish use it
how to...destroy it
It's on the stack. What's to destroy?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
fclose90 works, thanks! I mean in the heap?
-- modified at 13:32 Thursday 13th April, 2006
|
|
|
|
|
mrby123 wrote: I mean in the heap?
mrby123 wrote: double data[10000];
Memory for data has not been allocated on the heap. The only way to free it up is to close the application.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: The only way to free it up is to close the application.
Depends.
If array data is global then yes.
|
|
|
|
|
mkuhac wrote: If array data is global...
As opposed to what?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hi, I use this way to capture the screen:
CRect lpRect;
CImage image;
CString strPath;
char chPath[256];
CWnd *pWnd;
int nBB;
//Get the window desktop
pWnd=GetDesktopWindow();
//Create a CWindowDC to hold the desktop info
CWindowDC winDC(pWnd);
//Get the size of desktop
pWnd->GetWindowRect(lpRect);
//Retrieve number of bits per inch
nBB=winDC.GetDeviceCaps(BITSPIXEL)*winDC.GetDeviceCaps(PLANES);
if (nBB<24)
nBB=24;
////////////////////////End///////////////////////////////////
Is there any way to send picture bits or make an array of pixels (A fast way)?
and I have know that there is another way to capture the screen using GDI+,
Can you possibly tell me how to do this?(Is it faster of above code?)
Thanks.
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
CImage::GetBits is just what you need.
<font=sans-serif>|-|3llo Wo|2ld
|
|
|
|
|
hi all
let us say I have MFC application (dialog based) and have a string which contains some file path
strPath = "c:\\hello_guys.txt"
what is a handy way to retrieve size of this file, programatically ?
thank you.
|
|
|
|
|
GetLength()[^]
It's frustrating being a genius and living the life of a moron!!!
|
|
|
|
|
Hockey, i'm truly sorry... i intended to give you a '5', but my mouse moved wrongly
|
|
|
|
|
How about GetFileSize() ?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
hi David
as I see GetFileSize() needs HANDLE to a file as a parameter , that means as i know I need to open the file for reading at least.
I need to retrieve sizes of files in loop. I did it by opening them and calling GetLength method, but it seemd ugly
<br />
for(...)<br />
{<br />
CFile file<br />
file.Open(path,CFile::modeRead)<br />
Length[i] = file.GetLength()<br />
file.Close()<br />
}<br />
Is not there any API like this for example?
ULONGLONG GetFileSize(LPCTSTR sPath);
or any more convenient way?
thank you
|
|
|
|
|
big_denny_200 wrote: I did it by opening them and calling GetLength method, but it seemd ugly
But does it work, and is it easy to understand both now and in the future?
big_denny_200 wrote:
Is not there any API like this for example?
There's also _stat() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|