Similar Threads
1. How to find hWnd handle from enumerated process?
Hi i need to work with windows of processes that are running on my pc
from a certain programme. I've figured out how to build an array of
processes that contain just the processes i'm interested in by checking
what the process name starts with.
How do i find out the hWnd for the processes i've returned, because the
function i need to run wants me to pass it the hWnd of the processes.
Here's what I have so far, using notepad as my example : -
static void EnumerateWindows()
{
System.Diagnostics.Process[] processes;
processes =
System.Diagnostics.Process.GetProcessesByName("notepad");
foreach (System.Diagnostics.Process instance in processes)
{
MessageBox.Show(instance.Handle.ToString());
}
}
}
Thankyou experts,
Gary.
2. How to enumerate opened files? - CSharp/C#
3. How to enumerate open files using DirectoryServices
I am looking for a way to convert the following vbs script to c#
Const ADS_SECURE_AUTHENTICATION = 1
strADMIN = "adminaccount"
strPASSWORD = "password"
strUSER = "useraccount"
Set dso = GetObject("WinNT:")
Set srv = DSO.OpenDSObject("WinNT://servername/LanmanServer", strADMIN,
strPASSWORD, ADS_SECURE_AUTHENTICATION)
Set colResources = srv.Resources
For Each objResource in colResources
If objResource.User = strUSER Then objResource.remove(objResource.Name)
Next
I have seen various c# code using DirectoryServices with the winnt:
provider to enumerate users, groups, shares, etc
But I cant seem to find out how to gather open file or session information.
I know that he below code would show me shares on a file server,
but how do I get it to show me open files and sessions ?
using System;
using System.DirectoryServices;
namespace NetAcademia.Samples
{
class App
{
static void Main()
{
DirectoryEntry root = new DirectoryEntry
("WinNT://servername/lanmanserver");
foreach(DirectoryEntry child in root.Children)
{
Console.WriteLine(child.Name);
}
}
}
}
Thanks for any insight or help with this problem
Rich
4. Opening a a a file handle as a file pointer
5. Open previously opened serialized file != new open serialize file
Doing some testing of my reworked serialize code this morning (thanks for the
help Sigurd and Headache - it fixed the pointer problems) and ran into
something I don't understand.
If I open a previously unopened (in the session) serialized file everything
works fine. But if I close the file and reopen it, some of the pointers are
undefined and the session crashes. Looking in the debugger, it does go
through the ::Serialize code the second time, but clearly isn't actually
reading it from disk since the pointer values have changed (from reasonable
to cdcdcdcd). I assume the session is storing some pointers to speed the
reopen process, but clearly not everything. How do I force it to reread the
data from disk rather than it's local cache or where ever it is getting it
from? I sort of expected a Close equivalent of
CWinApp::OpenDocumentFile(path) or a flush buffer command or a open flag that
says "reread from disk, don't use your local data". but I don't find any of
them.
Thanks
6. Most efficient way to process thousands of files using multiple threads (dealing with thread handling) - CSharp/C#
7. Handling external ressource (aka How can I find a process' executable file)
8. How to open a printer as a file handle in c sharp - CSharp/C#