replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - How to find the name of currently running EXE ?
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to find the name of currently running EXE ?

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
DanRRight



Joined: 10 Mar 2008
Posts: 2939
Location: South Pole, Antarctica

PostPosted: Thu Sep 11, 2025 11:36 am    Post subject: How to find the name of currently running EXE ? Reply with quote

What function can supply the name of currently running program to this program?

I often run several instances of EXE at the same time and eventually become totally lost to find what is what. I may close some wrong program as a result. But if I will give EXE different names and display these names on running Clearwin window I will always know what is what

I know Clearwin command which supplies the path of the running code and display this path on top of each window, but this command does not supply the name of EXE

Opposite situation is with SDBG: it displays on the top the name of my EXE file which it is running but does not supply the path where is this EXE from. Would be good if it display the whole path too. For example now are running 5 programs under SDBG, each took hours to run and it is not easy to find what program is running under this or that open SDBG. Will also note, that the Command Prompt black window which SDBG opens at start has all the right path and the name of SDBG itself (showing that it is in the main FTN95 compiler directory). But what needed is that another SDBG window (where the debug actually happens) had display not just my code EXE name but the whole path with EXE name


Last edited by DanRRight on Thu Sep 11, 2025 12:09 pm; edited 1 time in total
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 840
Location: Lanarkshire, Scotland.

PostPosted: Thu Sep 11, 2025 12:08 pm    Post subject: Reply with quote

Dan, Does this help?

Code:
program get_progname
  use mswin
  implicit none

  integer(7) :: hModule
  integer    :: nChars
  character(len=260) :: buffer

  hModule = 0   ! 0 = current process
  nChars = GetModuleFileName(hModule, buffer, len(buffer))

  if (nChars > 0) then
     print *, 'Running program is: ', trim(buffer(:nChars))
  else
     print *, 'Could not get program name.'
  end if
end program
Back to top
View user's profile Send private message
DanRRight



Joined: 10 Mar 2008
Posts: 2939
Location: South Pole, Antarctica

PostPosted: Thu Sep 11, 2025 12:12 pm    Post subject: Reply with quote

Thanks you Ken, that exactly what was needed
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group