473,322 Members | 1,614 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

GetCurrentDirectory is not working for real application path

Hi ,

I have a simple program thats open some file a.txt. When program starts it
gets GetCurrentDirectory and finds / opens the a.txt file. But if i create
a shortcut on desktop it couldnot find real working directory. How can i do
this ?

this is not working for shortcuts
char buf[2001];
GetCurrentDirectory(2000, buf);
m_strCurrentDir = buf;

thanks in advance


Apr 28 '06 #1
1 1657
Hi Hasan!
I have a simple program thats open some file a.txt. When program starts it
gets GetCurrentDirectory and finds / opens the a.txt file. But if i create
a shortcut on desktop it couldnot find real working directory. How can i do
this ?

this is not working for shortcuts


It works perfectly for shortcuts!

But maybe you expected some other results as GetCurrentDirectory returns.
GetCurrentDirectory returns always the current directory. And for
shortcuts this is mostly "c:\windows\system32".

If you want to have the directory of your EXE, then you must use
"GetModuleFileName(NULL, ...)" and retrive the path from the returned
string.

Greetings
Jochen
Apr 28 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Dan | last post by:
I have built a C# Windows application using a C# library hosted in a DLL. Both the library and the application need to access some files which at program installation are placed in the EXE's path;...
8
by: Hardy Wang | last post by:
Hi: Is it possible for me to create/open web application from remote machine other than port 80? And create application directly under virtual web site instead of creating a virtual directory?...
3
by: Maileen | last post by:
Hi, I have a little trouble with the function "Directory.GetCurrentDirectory()". It seems that it keeps into memory the path of the Debug version of my application. It doesn't work correctly...
2
by: tshad | last post by:
This has been driving me crazy. I have been trying to get the error handling working on my system and can get parts of it working and others won't work at all. I found that you can't access...
3
by: RobertS | last post by:
I'm trying to figure out what I need to do to configure IIS 5.1 on XP Pro to work when referencing WebResources.axd. For example, I have an aspx script that works fine when run from Visual Web...
1
by: pb | last post by:
I am using asp.net and have some code in a file in the App_Code directory. I also have a text file in the same directory that I want to access. This file will always br in the same directory but I...
0
by: JohnIdol | last post by:
Hi Guys, anyone could help me understand the difference between these two methods? path =...
1
by: Mark B | last post by:
This is my first try at using AJAX. I want the calendars to be enabled if the user checks CheckBox1. It works OK for a normal all page refresh but once I introduced the AJAX code it stopped...
6
by: josequinonesii | last post by:
I've searched, I've read, I've tested and re-read numerous post but to no avail yet... Quite simply, the settings I've applied to my httpd.conf, httpd-vhost.conf and my hosts files simply does not...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.