|
There must be some nice simple function i can use to get the full directory location of where i am running my program from. Lets say my program is "me.exe" from "C:\WINDOWS\stuff\me.exe", then i want to get "C:\WINDOWS\stuff" or "C:\WINDOWS\stuff\" .
My search failed so thats why im asking here, thanks
edit: im in visual studio with a MFC dialog based application
edit2: maybe i should add i want to find the full directory from the program itself, so it knows where its running from...
//Johannes
|
|
|
|
|
Do you need to GetModuleFileNameEx ?
|
|
|
|
|
Is there something less hightech and more simple?
Like none of the DWORD and all the other stuff
(i edited my question abit)
//Johannes
|
|
|
|
|
|
Im using the code:
TCHAR szPath[MAX_PATH];
GetModuleFileName(NULL,szPath,MAX_PATH);
AfxMessageBox(szPath);
however the messagebox show the full path and the executable name, i just want the full dir,
thanks
//Johannes
|
|
|
|
|
if i use that in combination with
PathRemoveFileSpec(szPath);
it works
thanks WhiteSky!
//Johannes
|
|
|
|
|
I glad your problem solved.
|
|
|
|
|
Are you kidding?
C++ too technical for ya? There's always VB...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Dear Friend,
Sometimes when I try to select file from the desktop in release mode, application closing without message. In debug mode there is error message saying "Unhandled exception at 0x7d64159e in Project1.exe: 0xC0000005: Access violation reading location 0x02f24b20." In call stack window, there is shell32.dll!7d64159e().
If I uninstall Adobe reader it is not happening.
Is there any way to fix it without uninstalling Adobe reader?
Best Regards,
Suman
|
|
|
|
|
How do you call CFileDialog ?
|
|
|
|
|
Here is code:
<br />
char szFilters[] = "CSV Files (*.csv)|*.csv|";<br />
CFileDialog dlg(TRUE, "CSV", "*.csv",<br />
OFN_FILEMUSTEXIST| OFN_HIDEREADONLY, szFilters, this);<br />
if(dlg.DoModal()== IDOK)<br />
{<br />
CString strPath = dlg.GetPathName();<br />
}<br />
The code is inside a function of class derived from CMDIFrameWnd.
Best Regards,
Suman
|
|
|
|
|
Your code doesnt seem has any problem whats your compiler?
|
|
|
|
|
WhiteSky wrote: Your code doesnt seem has any problem whats your compiler?
Visual Studio .Net 2003 (VC++ 7.1)
Best Regards,
Suman
|
|
|
|
|
rp_suman wrote: If I uninstall Adobe reader it is not happening.
There is some problem with the pdfshell.dll file. The moment you move your cursor over a file( or a pdf file not sure ) the file dialog disappears.
Unregister this dll using regsvr32(There is no use in doing this, since this could happen anywhere). Also if you use "new" for creating <code>CFileDialog this won't happen. This recently happened in one of our projects.
If you use VC debugger to see what all dll's are being loaded then you will see that the moment this dll is loaded the file dialog crashes. It's a shell extension dll for pdf files.
|
|
|
|
|
Thanks for great help from everybody.
I will try "new" for creating file dialog.
Best Regards,
Suman
|
|
|
|
|
Nibu babu thomas wrote: Also if you use "new" for creating CFileDialog this won't happen. This recently happened in one of our projects.
Hi Thanks for great help, but it is happening even if I use "new" to create CFileDialog.
What kind of application you got the same problem? Was that dialog based or SDI/MDI?
If you have some more information it will be helpful for fixing.
Best Regards,
Suman
|
|
|
|
|
rp_suman wrote: Hi Thanks for great help, but it is happening even if I use "new" to create CFileDialog.
What kind of application you got the same problem? Was that dialog based or SDI/MDI?
If you have some more information it will be helpful for fixing.
It was a dialog based application. Using "new" solved the issues.
|
|
|
|
|
Hi, thanks for reply. My application is little complicated, it is not just a dialog or MDI and I am still analyzing problem while fixing other bugs.
I will update if I find the solution.
Best Regards,
Suman
|
|
|
|
|
Nibu babu thomas wrote: The moment you move your cursor over a file( or a pdf file not sure ) the file dialog disappears
Hi Nibu thomas,
Yes you are correct.
The problem is happening only when the File dialog shows the location "desktop" and the mouse cursor is on top of any file.
If I uncheck Folder Options --> View --> Show pop-up description
for folder and desktop items it is not happening. The problem seems related
to tool tip for files in desktop.
Thank you very much for your great help.
Best Regards,
Suman
|
|
|
|
|
rp_suman wrote: The problem is happening only when the File dialog shows the location "desktop" and the mouse cursor is on top of any file.
Exactly.
If you unregister pdfshell.dll then it works fine. BTW I suggested newing of CFileDialog , does that help.
|
|
|
|
|
I have tried newing but that did not fix the problem. My system have Japanese OS. Can we unregister pdfshell.dll through program? If we do so, what will be the effect in end user system?
Thanks for your great help!!
Best Regards,
Suman
|
|
|
|
|
rp_suman wrote: Can we unregister pdfshell.dll through program? If we do so, what will be the effect in end user system?
End users might or might not have pdfshell. So disabling it on your machine is of no good. So you will have to find a workaround. I don't think it's due to Japaneese OS.
|
|
|
|
|
OK. I hope there will be some workaround.
Thanks for your great help.
Best Regards,
Suman
|
|
|
|
|
Hi all:
I just did not find description about when the MapViewOfFile is called, how's the file on disk is updated, It seems to be updated periodically by OS, beside to do it explicitly with FlushViewOfFile. But I'm not sure about it.
|
|
|
|
|
The web server reported the following error when attempting to create or open the web projectlocated at the following URL:'http://localhost/Webapplication1'.'HTTP/1.1 500 Internal Server Error'.
I am gettinng the above error in asp.net while running the web application.How to rectify this?.. can anyone help me?
regards,
C.Sridevi
|
|
|
|