Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get another thread current directory !

Status
Not open for further replies.

captanblack

Programmer
Mar 2, 2004
20
IR
Hi

it seems every application (exactly every thread) in windows has its own current directory - i want to get current directory of each application that is running !
anybody knows ?

So Thanx


 
ok

this article shows how to get the path to executable file of a application , but i need the current directory that application use !!!!! that would be another directory !
 
Post (send) a message to the thread, and have it return you the directory it is working on. Only that thread can know it's internal data structures.

HTH
TonHu
 
Hi

but what message should i post ?
(wm_what ? or ...)

so thanx !
 
Any user-defined message would do, as your app will (should) be the only one receiving the message, knowing what to return.....;-) like WM_USER + 1 ?

HTH
TonHu
 
I think he wants to know the current directory of a foreign thread/application. Anyway, don't think this is possible. workingdirectory is availabe in a shortcut (.lnk).

--------------------------------------
What You See Is What You Get
 
I assumed he wrote/writes the foreign thread, so can adapt that to process the user-message, and respond with the current application-path. If what he wants is the WorkingDir from the shortcut, then just read/query the .lnk file.

HTH
TonHu
 
Hi

i think u r missing something !
let me explane what i need !

if u use getcurrentdirectory api function it returns the current directory for your application , for example u can use setcurrentdirectory function or useing a opendialog to change the directory !

and what i want :

i want to do something if foreground application in windows (active application) set its current directory to (for example :) c:\workdirectory !

if there is some miss understanding let me know to make it clear !

so thanx
 
Ah, I got the impression you had created some threads yourself, and you needed the current dir of those threads. In that case my scenario would have worked just fine AFAICS.

When viewing with ProcessExplorer, the properties of all processes seem to point to some 'Current directory', but I haven't been able to either find a way to extract that info, or verify if it is the current dir, according to that process :-( May try that later, so maybe you are lucky to find this by yourself now...

HTH
TonHu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top