Hack Forums
[C#] CLOSED CLOSED CLOSED CLOSED - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] CLOSED CLOSED CLOSED CLOSED (/showthread.php?tid=5926379)



CLOSED CLOSED CLOSED CLOSED - _CASP3R_ - Jan 5, 2019

This thread is closed. ✌ ✌ ✌ ✌ ✌


RE: [HELP] Hide proccess window (mstsc) - NYANxCAT - Jan 5, 2019

(Jan 5, 2019 11:16 AM)_CASP3R_ Wrote:  Hello, I just thought id ask a question and see if anybody knows because ive been trying all day.

Basicly What i want to do is  launch a remote desktop connection and immediately hide it.
What i can already do to some extent. Basicly it hides the connecting window instead of the window when it connected.  I know its possible to do because i tested it with a button. but i wanna do it automatically.


Here is my code.

Code
private const int SW_HIDE = 0;
[DllImport("User32")]
private static extern int ShowWindow(int hwnd, int nCmdShow);


Process rdcProcess = new Process();
rdcProcess.StartInfo.FileName =
Environment.ExpandEnvironmentVariables(@"%SystemRoot%\system32\mstsc.exe");
rdcProcess.StartInfo.Arguments = "/v " + ""; //
rdcProcess.Start();

foreach (Process process in array)
{
  if (process.ProcessName == "mstsc")
  {
      int hWnd;
      hWnd = proccess.MainWindowHandle.ToInt32();
      ShowWindow(hWnd, 0);
  }
}


PHP Code

<?php 
Dim RDP 
As New ProcessStartInfo With {
        .
FileName = "mstsc",
        .
Arguments = "/v: 127.0.0.1",
        .
WindowStyle = ProcessWindowStyle.Hidden
        
}

        
Process.Start(RDP) 

EDIT : sorry I thought it was VB section.

PHP Code

<?php 
ProcessStartInfo RDP 
= new ProcessStartInfo()
    {
        
FileName = "mstsc",
        
Arguments = "/v: 127.0.0.1",
        
WindowStyle = ProcessWindowStyle.Hidden
    
};

    
Process.Start(RDP); 



RE: [HELP] Hide proccess window (mstsc) - _CASP3R_ - Jan 5, 2019

(Jan 5, 2019 11:37 AM)˗ˏˋ NYAN CAT ˎˊ˗ Wrote:  
PHP Code

<?php 
       Dim RDP 
As New ProcessStartInfo With {
 
       .FileName = "mstsc",
 
       .Arguments = "/v: 127.0.0.1",
 
       .WindowStyle = ProcessWindowStyle.Hidden
        
}

 
       Process.Start(RDP) 

EDIT : sorry I thought it was VB section.

PHP Code

<?php 
   ProcessStartInfo RDP 
= new ProcessStartInfo()
 
   {
 
       FileName = "mstsc",
 
       Arguments = "/v: 127.0.0.1",
 
       WindowStyle = ProcessWindowStyle.Hidden
    
};

 
   Process.Start(RDP); 

Bro. I fucking love you. Thank you so much. You dont understand what this means. TY

(Jan 5, 2019 11:37 AM)˗ˏˋ NYAN CAT ˎˊ˗ Wrote:  
PHP Code

<?php 
       Dim RDP 
As New ProcessStartInfo With {
 
       .FileName = "mstsc",
 
       .Arguments = "/v: 127.0.0.1",
 
       .WindowStyle = ProcessWindowStyle.Hidden
        
}

 
       Process.Start(RDP) 

EDIT : sorry I thought it was VB section.

PHP Code

<?php 
   ProcessStartInfo RDP 
= new ProcessStartInfo()
 
   {
 
       FileName = "mstsc",
 
       Arguments = "/v: 127.0.0.1",
 
       WindowStyle = ProcessWindowStyle.Hidden
    
};

 
   Process.Start(RDP); 

Hey man... Just tried the code. The window still appears.


RE: CLOSED CLOSED CLOSED CLOSED - Abruptum - Jan 5, 2019

(Jan 5, 2019 11:41 AM)_CASP3R_ Wrote:  Bro. I fucking love you. Thank you so much. You dont understand what this means. TY


Hey man... Just tried the code. The window still appears.

Guys pleas don't delete the questions this is just dumb, without ˗ˏˋ NYAN CAT ˎˊ we wouldn't have know later on what the question for that solution was.
So pleas don't remove the question or change the title...
There is a reason why there is a option to close a thread.


RE: CLOSED CLOSED CLOSED CLOSED - _CASP3R_ - Jan 5, 2019

(Jan 5, 2019 11:49 AM)Abruptum Wrote:  Guys pleas don't delete the questions this is just dumb, without ˗ˏˋ NYAN CAT ˎˊ we wouldn't have know later on what the question for that solution was.
So pleas don't remove the question or change the title...
There is a reason why there is a option to close a thread.

Im sorry, I just didnt want other people still thinking ive not solved it and them trying to help. Ill remember next time.


RE: [HELP] Hide proccess window (mstsc) - NYANxCAT - Jan 5, 2019

(Jan 5, 2019 11:41 AM)_CASP3R_ Wrote:  Hey man... Just tried the code. The window still appears.

I tried it, the dialog is hidden.

(Jan 5, 2019 11:49 AM)Abruptum Wrote:  Guys pleas don't delete the questions this is just dumb, without ˗ˏˋ NYAN CAT ˎˊ we wouldn't have know later on what the question for that solution was.
So pleas don't remove the question or change the title...
There is a reason why there is a option to close a thread.

Yup I agree with you.


RE: [HELP] Hide proccess window (mstsc) - Nick (Name) - Jan 5, 2019

This is honestly my preferred way of launching other program's with the Process class:

Code
if (new Process
{
   StartInfo =
   {
       FileName = "mstsc",
       Arguments = "/v: 127.0.0.1",
       WindowStyle = ProcessWindowStyle.Hidden
   }
}.Start())
{
   //Process has started
}



RE: [HELP] Hide proccess window (mstsc) - _CASP3R_ - Jan 5, 2019

(Jan 5, 2019 11:54 AM)˗ˏˋ NYAN CAT ˎˊ˗ Wrote:  I tried it, the dialog is hidden.


Yup I agree with you.

I mean the rdp window, I want that hidden not just the connecting window its still appearing on mine. Thanks again for helping.

(Jan 5, 2019 11:58 AM)Nick (Name) Wrote:  This is honestly my preferred way of launching other program's with the Process class:

Code
if (new Process
{
   StartInfo =
   {
       FileName = "mstsc",
       Arguments = "/v: 127.0.0.1",
       WindowStyle = ProcessWindowStyle.Hidden
   }
}.Start())
{
   //Process has started
}

I mean the rdp window, I want that hidden not just the connecting window its still appearing on mine. Thanks for helping.


RE: [HELP] Hide proccess window (mstsc) - Nick (Name) - Jan 5, 2019

(Jan 5, 2019 11:58 AM)_CASP3R_ Wrote:  I mean the rdp window,  I want that hidden not just the connecting window its still appearing on mine. Thanks again for helping.


I mean the rdp window, I want that hidden not just the connecting window its still appearing on mine. Thanks for helping.

Check out the ProcessStartInfo class documentation https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo


RE: [HELP] Hide proccess window (mstsc) - _CASP3R_ - Jan 5, 2019

(Jan 5, 2019 12:03 PM)Nick (Name) Wrote:  Check out the ProcessStartInfo class documentation https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo

Okay man Will do!