W
W
WbdT2014-10-28 17:04:55
C++ / C#
WbdT, 2014-10-28 17:04:55

How to specify path to c# dll?

Looking for a process

Process[] processesByName = Process.GetProcessesByName("somename");
            Process selectedProcess = null;
            foreach (Process t in processesByName.Where(t => t.Modules.Cast<ProcessModule>().Any(each => each.FileName.EndsWith("somedll.dll"))))
            {
                selectedProcess = t;
            }
            //Если нашли
            if (selectedProcess != null)
            {
                IntPtr processHandle = WinApis.OpenProcess(1040, false, selectedProcess.Id);

Piece of WinApis
[DllImport("kernel32.dll")]
    public static extern IntPtr OpenProcess(uint processAcces, bool bInheritHandle, int processId);

How can I immediately specify the path to the dll, and then open it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
aush, 2014-10-28
@aush

Assembly.LoadFrom ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question