如何让某个EXE可执行程序 只能通过另一个程序打开,而不能通过鼠标点击运行 (已解决)
本帖最后由 haopp1 于 2014-3-11 12:45 编辑如何让某个EXE可执行程序 只能通过另一个程序打开,而不是直接双击就能运行 给他设置一个参数 看 cmdline 本帖最后由 gto250 于 2014-2-27 20:02 编辑
不解释,自己看
If GetParentProcessName(GetParentProcess())="explorer.exe" Then MsgBox(0,"","禁止双击打开")
Func GetParentProcessName($PID)
Local $list = ProcessList()
For $i = 1 To $list
If $list[$i]=$PID Then Return $list[$i]
Next
Return 0
EndFunc
Func GetParentProcess($PID = 0)
$tagPROCESSENTRY32="dword Size;dword Usage;dword ProcessID;ulong_ptr DefaultHeapID;dword ModuleID;dword Threads;dword ParentProcessID;long PriClassBase;dword Flags;wchar ExeFile"
If Not $PID Then $PID = @AutoItPID
Local $hSnapshot = DllCall('kernel32.dll', 'handle', 'CreateToolhelp32Snapshot', 'dword', 0x00000002, 'dword', 0)
If @error Or Not $hSnapshot Then Return SetError(@error + 10, @extended, 0)
Local $tPROCESSENTRY32 = DllStructCreate($tagPROCESSENTRY32)
Local $Result = 0
$hSnapshot = $hSnapshot
DllStructSetData($tPROCESSENTRY32, 'Size', DllStructGetSize($tPROCESSENTRY32))
Local $Ret = DllCall('kernel32.dll', 'bool', 'Process32FirstW', 'handle', $hSnapshot, 'struct*', $tPROCESSENTRY32)
Local $iError = @error
While (Not @error) And ($Ret)
If DllStructGetData($tPROCESSENTRY32, 'ProcessID') = $PID Then
$Result = DllStructGetData($tPROCESSENTRY32, 'ParentProcessID')
ExitLoop
EndIf
$Ret = DllCall('kernel32.dll', 'bool', 'Process32NextW', 'handle', $hSnapshot, 'struct*', $tPROCESSENTRY32)
$iError = @error
WEnd
DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hSnapshot)
If Not $Result Then Return SetError($iError, 0, 0)
Return $Result
EndFunc 编译以后试 回复 3# gto250
这也行,真是没有做不到的 回复 2# 绿色风
谢谢 谢谢 回复 4# gto250
好的待我测试一下。。。。谢谢 学习了。。。。谢谢 回复 3# gto250
请问如何使用呢,不知道如何使用呢。求教。可以举个例子么 回复 2# 绿色风
请问如何使用呢 高人啊,学习+收藏了。 回复 10# haopp1
应该是放在你不能直接打开的程序代码中。第一行的if应该放在最前面,因为这句应该是是否判断双击打开。后面的两个func随便放哪都可以,这是两个自定义函数,第一句的if中会调用。 回复 12# imlzr
我试过了 ,发现不行呢 回复 12# imlzr
我试过了 ,发现不行呢 回复 14# haopp1
我试了,可以呢,应该是你那里没搞对吧。
页:
[1]
2