ASK-如何区分鼠标单击和shell命令? [英] ASK - How to differentiate between mouse click and shell command?

查看:112
本文介绍了ASK-如何区分鼠标单击和shell命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个用VB6编码的.exe文件.第一个称为ServerFood,第二个称为ClientFood.我希望ClientFood仅从ServerFood的Shell函数运行,并在用户直接单击它时显示错误消息.如何解决我的问题?请帮忙.

I have two .exe files coded in VB6. The first called ServerFood and the second ClientFood. I want the ClientFood run only from Shell function of ServerFood and show error message when users click it directly. How to solve my problem?? Help please.

推荐答案

我可以想到2种方法,但我还没有尝试过.简单的方法是使用命令行参数从命令行管理程序启动程序,然后在程序中检查该参数.如果通过双击启动程序,则不应设置该参数.

另一种方法是做一些更底层的工作,并尝试获取程序的进程ID,然后获取其父级.如果它是从命令行管理程序启动的,则父级可能应该为cmd.exe,否则应为explorer.exe.

当然,这些都不是万无一失的,但是也许其中一个会起作用.
There are 2 ways I can think of, but I haven''t tried them. The simple way is to start the program from the Shell with a commandline parameter, then check the parameter in your program. If the program was started by double clicking, the parameter should not be set.

The other way is to do some more low level stuff and try to get the process ID of your program, then get its parent. If it was started from the Shell, the parent should likely be cmd.exe, otherwise it should be explorer.exe.

Of course neither of those is foolproof, but perhaps one will work.


这篇关于ASK-如何区分鼠标单击和shell命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆