Turning on QuickEdit from a program (CLI/C#)

  • Context: C# 
  • Thread starter Thread starter CRGreathouse
  • Start date Start date
  • Tags Tags
    Program Turning
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 2K views
Messages
2,832
Reaction score
0
I'm trying to run a program, turn on QuickEdit (click-and-drag to copy, right-click to paste), and set the priority to BelowNormal.

The following will start a program at BelowNormal priority:
Code:
Process pr = new Process();
pr.StartInfo.FileName = "blah.exe";
pr.Start();
pr.PriorityClass = ProcessPriorityClass.BelowNormal;

The following will start a program with QuickEdit, assuming the shortcut is set up appropriately:
Code:
Process pr = new Process();
pr.StartInfo.FileName = "blah.lnk";
pr.Start();

But I can't find a way to do both. If I set the priority on the second, it sets it for the shortcut -- not the spawned process. (Not that I'm quick enough to grab it before it disappears, usually.)

Thoughts?
 
Physics news on Phys.org
My guess is that running the link just causes explorer to run the program and then return - so the process you are getting back is the explorer instance.
Can you read the contents of the .lnk and run the command yourself ?
Otherwise you are going to have to find the PID of the process once it has started and then attach to it

There used to be a similair problem running command line apps with system() - they would inherit the environment of the calling program so sometimes you had to run them with system("cmd appname.exe")
 
mgb_phys said:
Can you read the contents of the .lnk and run the command yourself ?

I would be setting up the .lnk file for the purpose of the program, so that's not an issue. .lnk files let me choose settings like display types and QuickEdit, which are useful to me here.

The program I'm working on just spawns a bunch of windows with different settings. In this case, (say) 8 instances of Pari running a program over similar settings. But I'd like to turn on QuickEdit since I may end up using some of the windows manually.

mgb_phys said:
Otherwise you are going to have to find the PID of the process once it has started and then attach to it

Yeah, I guess so. But once I do, how can I change the setting?