如何知道由vb6或c#调用我的程序的程序?

时间:2018-10-05 05:43:19

标签: c# api vb6

我编写了一个程序(A),该程序从另一个程序(B)中读取信息。当B打电话给A时,如何找出B的财产? 用vb6或c#编写的A。我可以使用API​​或其他方式吗?

非常感谢

1 个答案:

答案 0 :(得分:1)

程序B调用A时发送自己的进程ID怎么样?

Option Explicit

Private Declare Function GetCurrentProcessId Lib "kernel32" () As Long

    Sub execute()

        Dim pid As Integer
        pid = GetCurrentProcessId()

        'Call Program A Pass pid to your Program

    End Sub

这是一个获取Excel进程ID的示例,您现在可以调用程序并将其作为参数发送。现在可以识别该程序。