Click here to Skip to main content
15,505,667 members
Home / Discussions / C#
   

C#

 
GeneralRe: How can I dictate the position of the run prompt? Pin
turbosupramk329-Apr-14 3:35
turbosupramk329-Apr-14 3:35 
GeneralRe: How can I dictate the position of the run prompt? Pin
Alan N29-Apr-14 7:14
Alan N29-Apr-14 7:14 
GeneralRe: How can I dictate the position of the run prompt? Pin
turbosupramk329-Apr-14 10:14
turbosupramk329-Apr-14 10:14 
GeneralRe: How can I dictate the position of the run prompt? Pin
Dave Kreskowiak29-Apr-14 11:36
mveDave Kreskowiak29-Apr-14 11:36 
GeneralRe: How can I dictate the position of the run prompt? Pin
turbosupramk330-Apr-14 7:02
turbosupramk330-Apr-14 7:02 
GeneralRe: How can I dictate the position of the run prompt? Pin
Dave Kreskowiak30-Apr-14 9:16
mveDave Kreskowiak30-Apr-14 9:16 
GeneralRe: How can I dictate the position of the run prompt? Pin
turbosupramk330-Apr-14 9:49
turbosupramk330-Apr-14 9:49 
GeneralRe: How can I dictate the position of the run prompt? Pin
Alan N29-Apr-14 12:25
Alan N29-Apr-14 12:25 
OK,
The only public method in the class is FindWindows. It calls the native EnumWindows method which enumerates all top level window handles and for every window handle found a callback method is invoked. The method, which has the signature bool EnumWindowsProc(IntPtr hwnd, IntPtr state), is SelectWindowsByPID.

So some code that starts the process you are interested in and then enumerates the window handles,
C#
Process p = Process.Start(@"c:\Windows\System32\rundll32.exe",  "shell32.dll,#61");
ProcessWindowFinder finder = new ProcessWindowFinder();
finder.FindWindows(p);

On my system 267 window handles were found and SelectWindowsByPID was invoked once for each of those handles. The filtering by process ID showed that only 3 were associated with the rundll32 process.

To determine which of those 3 handles identifies the "Run" window use the native GetWindowText function. There is an example c# method on pinvoke.net http://www.pinvoke.net/default.aspx/user32/GetWindowText.html[^]. For testing insert your code inside the if block where I inserted the comment // Do something here.

Alan.
GeneralRe: How can I dictate the position of the run prompt? Pin
turbosupramk330-Apr-14 7:11
turbosupramk330-Apr-14 7:11 
GeneralRe: How can I dictate the position of the run prompt? Pin
Alan N1-May-14 4:12
Alan N1-May-14 4:12 
GeneralRe: How can I dictate the position of the run prompt? Pin
turbosupramk32-May-14 2:46
turbosupramk32-May-14 2:46 
QuestionImplementing transaction in MVC as Attribute Pin
nitin_ion28-Apr-14 1:12
nitin_ion28-Apr-14 1:12 
AnswerRe: Implementing transaction in MVC as Attribute Pin
Dave Kreskowiak28-Apr-14 4:18
mveDave Kreskowiak28-Apr-14 4:18 
GeneralRe: Implementing transaction in MVC as Attribute Pin
nitin_ion28-Apr-14 18:19
nitin_ion28-Apr-14 18:19 
GeneralRe: Implementing transaction in MVC as Attribute Pin
Dave Kreskowiak28-Apr-14 18:55
mveDave Kreskowiak28-Apr-14 18:55 
QuestionHow to use Multithreading in Async Socket Http request Pin
sbmzhcn27-Apr-14 16:22
sbmzhcn27-Apr-14 16:22 
Questionlooking for a decent book on c# for advanced programmers Pin
Nico Haegens27-Apr-14 2:10
professionalNico Haegens27-Apr-14 2:10 
AnswerRe: looking for a decent book on c# for advanced programmers Pin
Pete O'Hanlon27-Apr-14 2:59
mvaPete O'Hanlon27-Apr-14 2:59 
AnswerRe: looking for a decent book on c# for advanced programmers Pin
BillWoodruff27-Apr-14 8:08
mveBillWoodruff27-Apr-14 8:08 
AnswerRe: looking for a decent book on c# for advanced programmers Pin
jschell27-Apr-14 10:36
jschell27-Apr-14 10:36 
GeneralRe: looking for a decent book on c# for advanced programmers Pin
Ravi Bhavnani28-Apr-14 5:44
professionalRavi Bhavnani28-Apr-14 5:44 
AnswerRe: looking for a decent book on c# for advanced programmers Pin
thatraja27-Apr-14 21:59
professionalthatraja27-Apr-14 21:59 
GeneralRe: looking for a decent book on c# for advanced programmers Pin
Dnyaneshwar@Pune28-Apr-14 1:11
Dnyaneshwar@Pune28-Apr-14 1:11 
GeneralRe: looking for a decent book on c# for advanced programmers Pin
rutja_deore28-Apr-14 1:12
rutja_deore28-Apr-14 1:12 
GeneralRe: looking for a decent book on c# for advanced programmers Pin
thatraja28-Apr-14 5:29
professionalthatraja28-Apr-14 5:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.