How can I get a DLL's Parent Window Title? OR How can I get the PID of the process that loaded my DLL?

I need this so I can make a file for each process that loads my DLL but the file has to contain some sort of identifier. Something like File.PID.

I decided to use Process ID because I want to do this in a portable way. Is there any portable ways to get the PID that loaded my dll?

Also is there a way I can program for linux on windows? Basically I want to see if a linux system will run my dll (even though I didn't have any ifdef __linux). I'd like to make my DLL run on both windows and linux.

Attempting to do it a "portable" way is useless becuse *nix doesn't support DLLs, instead it has shared libraries with *.so exension.

Also is there a way I can program for linux on windows?

Only if you run *nix in a virtual machine window and use a compiler for *nix such as gcc and/or g++. Have you looked at any of boost cross-platform libraries to see if there is something you can use?

How can I get a DLL's Parent Window Title?

GetModuleFileName() will return the fully qualified path to the processes that loaded your DLL.

Yeah but it's not the path to the process I want. It's the process ID. I can compile my code into a .so? How do I get this shared library thing?

The reason I want the PID is because if one application has many instances, the paths will all be the same. The PID is the only way I can think of to distinguish which one ran it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.