重要なお知らせ

「教えて! goo」は2025年9月17日(水)をもちまして、サービスを終了いたします。詳細はこちら>

電子書籍の厳選無料作品が豊富!

VB6です。
どのようなAPIを使っていけばよいなど、教えてもらえたらありがたいです。

A 回答 (1件)

どうも。



この辺りのものが使える関数一覧で、
http://www.winapi-database.com/Program/Process/i …

だいたいこんな感じになると思います(未検証です)

Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpszClassName As String, ByVal lpszWindowName As String) As Long
Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hWnd As Long, ByRef lpdwProcessId As Long) As Long

Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long

Const PROCESS_VM_READ As Long = &H10

Function GetWindowProcess(ByVal Title As String) As Long
'ウインドウ名からプロセスハンドルを取得する
Dim hWnd As Long
Dim PID As Long
Dim hProcess
hWnd = FindWindow(Title, vbNullString)
If hWnd = 0 Then Exit Function

'ウィンドウハンドルからプロセスハンドルを取得
Call GetWindowThreadProcessId(hWnd, PID)
hProcess = OpenProcess(PROCESS_VM_READ, 0, PID)

GetWindowProcess = hProcess

End Function
    • good
    • 0
この回答へのお礼

ありがとうございます!出来そうです!

お礼日時:2007/03/22 15:01

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!