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

  • Thread starter Thread starter CRGreathouse
  • Start date Start date
  • Tags Tags
    Program Turning
AI Thread Summary
To run a program with both QuickEdit enabled and set its priority to BelowNormal, the challenge arises from the behavior of shortcuts (.lnk files) which do not allow direct priority settings on the spawned process. The initial approach to start a program at BelowNormal priority is straightforward, but when using a shortcut, the priority setting applies to the shortcut itself rather than the actual process. One suggested solution is to read the contents of the .lnk file and execute the command directly, bypassing the shortcut. This method allows for the desired settings to be applied without the limitations of the shortcut. However, if the program must be launched through the shortcut for specific configurations like QuickEdit, finding the process ID (PID) after the program starts and then attaching to it is necessary. The discussion highlights the complexity of managing process settings when using shortcuts and the need for alternative methods to achieve both QuickEdit functionality and priority adjustments.
CRGreathouse
Science Advisor
Homework Helper
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?
 
Technology 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?
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top