如何启动用python实现的COM服务器?

2024-09-30 18:29:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用python来制作COM本地服务器。实际上,整个COM部分都是在一个dll中实现的,我的python脚本正在调用这个dll,这要归功于ctypes。当我手动运行脚本时,它可以正常工作。在

我希望看到我的服务器在COM客户端请求时自动运行。我知道可以通过将命令行作为LocalServer32注册表项的值来实现。在

不幸的是,我的python无法正常运行。我尝试过使用python和pythonw来解决类似的问题。windows似乎在命令行中添加了一个“-Embedding”标志,我想这可能是python的一个问题。在

有什么想法吗?在

有人知道如何避免命令行中的“-Embedding”标志吗?在


Tags: 命令行服务器脚本com客户端注册表标志windows
1条回答
网友
1楼 · 发布于 2024-09-30 18:29:23

“-embedding”标志是added by COM automatically,其目的是使服务器应用程序能够解析此标志,以确定它是由COM运行的。在

COM appends the "-Embedding" flag to the string, so the application that uses flags will need to parse the whole string and check for the -Embedding flag. The following code example shows the setting for this value.

您需要在服务器代码中处理此问题。在

相关问题 更多 >