|
It will give path of all running processes which u will find in task manager's process tab.But I need path of applications related to process which u will find in task manager's application tab.
I need the path of process.MainWindowTitle's .
|
|
|
|
|
|
Thank you but
I already checked above blog, its just giving the list of applications in application tab of task manager but I need even path(physical path of application on machine).
I mean application's(MainWindowTitle's) location in disk.
|
|
|
|
|
hei... think... you get the Process and use MainModule.Filename
that is the application path.
|
|
|
|
|
I don't understand what it is you want, and seems like neither do the others. So stop repeating yourself, and improve your question using more and other words, and maybe some examples.
|
|
|
|
|
Anyone know how / where to put in reg settings so an app executes on start up in Vista ??
I don't see a currentversion/run reg path ..
Thanks in advance !
|
|
|
|
|
RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run");
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I have a method that creates a new process and calls the command line. I can get standardoutput into the procResults strings for most of my calls. But for some reason when I use this method to call devenv to build a c# solution I don't get anything in standardoutput. It seems like it finishes the call because all new files are built and I can see the last modified date is the current time, but the procResults string is empty. Here is my call:
'devenv alphacetui.sln /rebuild "debug|x86"'
it seems like it finishes ok because I get a p.Exitcode = 0;
Does anyone have experience calling devenv from system.process or know why I'm not getting output?
when I run devenv alphacetui.sln /rebuild "debug|x86" from the command line it works fine and I can see the output in the command window.
public void method()
{
Process p = new Process();
p.StartInfo.FileName = "devenv";
p.StartInfo.Arguments = "alphacetui.sln /rebuild \"debug|x86\"";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.Start();
string procResults = p.StandardOutput.ReadToEnd();
p.WaitForExit();
}
|
|
|
|
|
Hello All;
I am getting an exception when trying to load my XML file with C#.
Here is my XML:
<?xml version="1.0"?>
<CADLaunch>
<LastAutoCADVersion>AutoCAD MEP 2009</LastAutoCADVersion>
<LastProfile>ShopData Old</LastProfile>
</CADLaunch>
And the code to load it:
XmlDocument test = new XmlDocument();
if (File.Exists(supportDir + "\\LaunchCAD.xml"))
{
test.LoadXml(supportDir + "\\LaunchCAD.xml");
}
The load line is giving me this exception:
An unhandled exception of type 'System.Xml.XmlException' occured in System.Xml.dll
Additional Information: Data at the root level is invalid. Line 1, position 1.
I can't tell what I am doing wrong...
Thanks in advance.
|
|
|
|
|
|
...it's always the simplest answer you overlook the most...
I will try it. But do you know if I will still be able to search for nodes by just using 'Load'?
|
|
|
|
|
Once it's loaded into an XmlDocument, use methods like SelectSingleNode.
|
|
|
|
|
You're using the wrong function.
It's not loading LaunchCAD.xml... It's trying to load "LaunchCAD.xml"
LoadXml() is for when you've already read the document into a string... What you want is the Load() function.
|
|
|
|
|
|
ok...
I thought I uderstood it but apparently not... I am new to this stuff.
test.Load(supportDir += "\\LaunchCAD.xml");
string nResult = test.SelectSingleNode("LastAutoCADVersion").InnerText.ToString();
I get an 'Object reference not set to an instance of an object.' exception on the SelectSingleNode line. I am assuming that is because I am still loading the file incorrectly. But am at a loss as to the correct method.
|
|
|
|
|
Not really, LastAutoCADVersion isn't the root and you pretended that it was, you can use "//LastAutoCADVersion" instead
|
|
|
|
|
|
Hi everyone, I am currently looking for a solution to prevent a user from opening the CD drive during a cruicial burning process. I think I'm close, like real close but the last hurdle is keeping me back.
I've found the right api for the job, but it's unmanaged in C++ and porting to C# is real tricky. So essentially that is the answer I am after.
I've figured out that at some point my solution involves: IOCTL_STORAGE_EJECT_CONTROL and PREVENT_MEDIA_REMOVAL, being used with the function DeviceIoControl()
I have these snippets which I have edited into my code.
[DllImport("Kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
public static extern bool DeviceIoControl(
IntPtr hDevice,
uint dwIoControlCode,
ref long InBuffer,
int nInBufferSize,
ref long OutBuffer,
int nOutBufferSize,
ref int pBytesReturned,
[In] ref NativeOverlapped lpOverlapped);
[DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)]
public static extern IntPtr CreateFile(
string fileName,
[MarshalAs(UnmanagedType.U4)] FileAccess fileAccess,
[MarshalAs(UnmanagedType.U4)] FileShare fileShare,
IntPtr securityAttributes,
[MarshalAs(UnmanagedType.U4)] FileMode creationDisposition,
int flags,
IntPtr template);
private void SomethingMethod()
{
IntPtr tHandle = CreateFile(@"\\.\" + destVolume, FileAccess.Read, FileShare.ReadWrite, IntPtr.Zero,
FileMode.Open, 0, IntPtr.Zero);
Bool success = DeviceIoControl(something, IOCTL_STORAGE_EJECT_CONTROL, something, something,
something, and so on);
}
I'm sure most of you will recognise that I am importing the dll libraries but the issue I am having is the Structure or Enums (I'm not quite which which is which) as I believe that IOCTL_STORAGE_EJECT_CONTROL and PREVENT_MEDIA_REMOVAL are stored as 'structs' somewhere.
So in brief, all I need to know are what parameters I need to pass to DeviceIoControl to stop the drive from ejecting.
Many Thanks.
modified on Friday, August 28, 2009 4:18 AM
|
|
|
|
|
Hi,
all I have is some comments:
1. please use PRE tags to show readable code snippets.
2. don't confuse native and managed types, they sometimes have a different length (e.g. long and char)
3. the details of IOCTL_STORAGE_EJECT_CONTROL must be available on the web; make google your friend!
4. CreateFile at the device level is bound to fail (access denied) for regular users on Windows Vista and above.
5. I'm rather convinced I can always open the optical drive, that is a hardware function, something software might trigger, but AFAIK not prevent.
|
|
|
|
|
This shouldn't be too tricky. I found this VB code[^], which should be a good start and faily easy to 'translate' to C#.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
But there's this leeeetle hole on a CD/DVD drive; if you insert an unfolded paper clip you can eject the drive no matter what.
So you're after an unachievable goal; I doubt it's worth the trouble. Just put up a "Please don't eject the disc until this process is complete" message, with a progress bar.
|
|
|
|
|
By that logic software should never do anything to prevent the user from closing it instantly while it's writing a file or the like; afterall even if you use the malware coders guide to protect your process from being killed, the user could yank the power/battery no matter what you do. Personally I want my software to ignore a close message until they finish writing any files, etc (or the attempt times out over the lan).
The latest nation. Procrastination.
|
|
|
|
|
Not at all (even were it relevent); an application can account for its own behaviour -- if it's writing it can wait until it's done, or prompt for abort.
|
|
|
|
|
While the OP hasn't stated exactly what the critical activity the CD drive is doing, during a CD-R burning session ejecting the disk and terminating an application in mid file write only differ in that the ejected CD is ruined representing a financial loss as opposed to potentially recoverable data corruption.
The latest nation. Procrastination.
|
|
|
|
|
But given that the app will handle the case where it is asked to exit during the activity, I don't see the relevence.
I believe the OP is concerned about the user pressing the eject button, ejecting from Explorer, or perhaps another app accessing the drive.
It appears that blocking those is achievable, and perhaps enough for the OP.
My point (and I do have one) is that there is at least one other method of ejecting the disc without otherwise affecting the app and OS that can't be blocked.
The OP should merely be aware that he will not have 100% ensurance that the disc can't be ejected.
|
|
|
|