On Windows, looking for barebones C++ program that works to determine another program's starting arguments when it started


I've looked at other programs such as here but when I tried to reduce the code by deleting username and password, the code didn't have anything of substance.

My problem is in a Visual Studio 11 C++ program, I have coded the name of another program such as n49.exe. Outside of my program, there "might" be several of these n49.exe programs running. They were not started by my program. They could have existed before my program started. But, they all have different argument lists that were used to start them.

Question: From my program (from a non-n49.exe program), how do I determine the argument list for each program such as n49.exe from within my C++ program?

For example, from my program called "abc.exe", I want to know about the arguments used by "n49.exe" when it started. "n49.exe" could be started before "abc.exe" or afterwards.

"argv[]" information is useless to me because I want information about "other" programs running, not my program.

Thank you, Michael

FYI: I downloaded, extracted the zip file at Link to Visual Studio Project, and tried to run it using Visual Studio 2017. It gives me the following error message:

Test ProcCmdLine Library

explorer (1772):

Unhandled Exception: System.DllNotFoundException: Unable to load DLL 'ProcCmdLine64.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

at ProcCmdLine.Win32Native.GetProcWorkingDir64W(UInt32 nProcId, StringBuilder sb, UInt32 dwSizeBuf)

at ProcCmdLine.GetWorkingDirectoryOfProcess(Process proc) in C:...\Michael789\Desktop\ProcCmdLine-master\DebugProcCmdLineNetFramework\ProcCmdLine.cs:line 113

at DebugProcCmdLineNetFramework.Program.Main(String[] args) in C:...\Michael789\Desktop\ProcCmdLine-master\DebugProcCmdLineNetFramework\Program.cs:line 23

asked on Stack Overflow Apr 1, 2021 by Michael789 • edited Apr 2, 2021 by Michael789

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0