Process.GetCurrentProcess メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > Process.GetCurrentProcess メソッドの意味・解説 

Process.GetCurrentProcess メソッド

新しProcess コンポーネント取得し、現在アクティブプロセス関連付けます。

名前空間: System.Diagnostics
アセンブリ: System (system.dll 内)
構文構文

解説解説
使用例使用例

現在のプロセス情報ローカル コンピュータ実行しているメモ帳すべてのインスタンスコンピュータエイリアスIP アドレス指定されコンピュータ実行しているメモ帳すべてのインスタンスローカル コンピュータおよびリモート コンピュータ実行しているすべてのプロセスローカル コンピュータまたはリモート コンピュータにおいて指定されプロセス ID実行しているプロセス情報取得する例を次に示します

Imports System
Imports System.Diagnostics
Imports System.ComponentModel


Namespace MyProcessSample
    _
   '/ <summary>
   '/ Shell for the sample.
   '/ </summary>
   Class MyProcess
      
      
      
      
      Sub BindToRunningProcesses()
         ' Get the current process.
         Dim currentProcess As Process = Process.GetCurrentProcess()
         
         
         ' Get all instances of Notepad running on the local
         ' computer.
         Dim localByName As Process() = Process.GetProcessesByName("notepad")
         
         
         ' Get all instances of Notepad running on the specifiec
         ' computer.
         ' 1. Using the computer alias (do not precede with "\\").
         Dim remoteByName As Process() = Process.GetProcessesByName("notepad",
 "myComputer")
         
         ' 2. Using an IP address to specify the machineName parameter.
 
         Dim ipByName As Process() = Process.GetProcessesByName("notepad",
 "169.0.0.0")
         
         
         ' Get all processes running on the local computer.
         Dim localAll As Process() = Process.GetProcesses()
         
         
         ' Get all processes running on the remote computer.
         Dim remoteAll As Process() = Process.GetProcesses("myComputer")
         
         
         ' Get a process on the local computer, using the process id.
         Dim localById As Process = Process.GetProcessById(1234)
         
         
         ' Get a process on a remote computer, using the process id.
         Dim remoteById As Process = Process.GetProcessById(2345,
 "myComputer")
      End Sub 'BindToRunningProcesses
       
      
      
      
      Shared Sub Main()
         
         Dim myProcess As New
 MyProcess()
         
         
         myProcess.BindToRunningProcesses()
      End Sub 'Main 
   End Class 'MyProcess
End Namespace 'MyProcessSample
using System;
using System.Diagnostics;
using System.ComponentModel;

namespace MyProcessSample
{
    /// <summary>
    /// Shell for the sample.
    /// </summary>
    class MyProcess
    {
        
       
        
        void BindToRunningProcesses()
        {
            // Get the current process.
            Process currentProcess = Process.GetCurrentProcess();

            
            // Get all instances of Notepad running on the local
            // computer.
            Process [] localByName = Process.GetProcessesByName("notepad");

            
            // Get all instances of Notepad running on the specifiec
            // computer.
            // 1. Using the computer alias (do not precede with "\\").
            Process [] remoteByName = Process.GetProcessesByName("notepad",
 "myComputer");
            
            // 2. Using an IP address to specify the machineName parameter.
 
            Process [] ipByName = Process.GetProcessesByName("notepad",
 "169.0.0.0");
            
            
            // Get all processes running on the local computer.
            Process [] localAll = Process.GetProcesses();

            
            // Get all processes running on the remote computer.
            Process [] remoteAll = Process.GetProcesses("myComputer");

            
            // Get a process on the local computer, using the process
 id.
            Process localById = Process.GetProcessById(1234);

            
            // Get a process on a remote computer, using the process
 id.
            Process remoteById = Process.GetProcessById(2345, "myComputer");
            
        }
        


        static void Main()
        {
                
                   MyProcess myProcess = new MyProcess();
            

            myProcess.BindToRunningProcesses();

            }    
    }
}
#using <System.dll>

using namespace System;
using namespace System::Diagnostics;
using namespace System::ComponentModel;
int main()
{
   
   // Get the current process.
   Process^ currentProcess = Process::GetCurrentProcess();
   
   // Get all instances of Notepad running on the local
   // computer.
   array<Process^>^localByName = Process::GetProcessesByName( "notepad"
 );
   
   // Get all instances of Notepad running on the specific
   // computer.
   // 1. Using the computer alias (do not precede with "\\").
   array<Process^>^remoteByName = Process::GetProcessesByName( "notepad",
 "myComputer" );
   
   // 2. Using an IP address to specify the machineName parameter. 
   array<Process^>^ipByName = Process::GetProcessesByName( "notepad",
 "169.0.0.0" );
   
   // Get all processes running on the local computer.
   array<Process^>^localAll = Process::GetProcesses();
   
   // Get all processes running on the remote computer.
   array<Process^>^remoteAll = Process::GetProcesses( "myComputer"
 );
   
   // Get a process on the local computer, using the process id.
   Process^ localById = Process::GetProcessById( 1234 );
   
   // Get a process on a remote computer, using the process id.
   Process^ remoteById = Process::GetProcessById( 2345, "myComputer" );
}

.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


このページでは「.NET Framework クラス ライブラリ リファレンス」からProcess.GetCurrentProcess メソッドを検索した結果を表示しています。
Weblioに収録されているすべての辞書からProcess.GetCurrentProcess メソッドを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からProcess.GetCurrentProcess メソッド を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

Process.GetCurrentProcess メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Process.GetCurrentProcess メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS