积极答复者
有关CreateProcess函数在64位系统下的问题。

问题
-
我用CreateProcess、WaitForSingleObject等API函数在VB里面实现了启动一个进程并等待其结束的功能。
这个功能一直都很正常,但这个程序其实是被另外一个程序去使用的,而最近这个程序升级为64位,结果再使用这个启动进程的功能时,就直接导致崩溃!?
请问,这个和CreateProcess有关吗?CreateProcess有64位的版本吗?
补充,我是这样在VB声明这个API函数的:
Declare Function CreateProcess Lib "kernel32" Alias "CreateProcessA" (Byval lpApplicationName As Long, Byval lpCommandLine As String, lpProcessAttributes As SECURITY_ATTRIBUTES, lpThreadAttributes As SECURITY_ATTRIBUTES, Byval bInheritHandles As Long, Byval dwCreationFlags As Long, lpEnvironment As Any, Byval lpCurrentDriectory As String, lpStartupInfo As STARTUPINFO, lpProcessInformation As PROCESS_INFORMATION) As Long Declare Function WaitForSingleObject Lib "kernel32" (Byval hHandle As Long, Byval dwMilliseconds As Long) As Long
da jia hao!
答案
-
在64位 windows中,句柄和指针是64位的, 而LONG是32位的,中间转换的时候会截断,导致错误.
需要把相关的地方都改成64位的,比如把LONG改成LONGLONG,就是64位的啦
- 已建议为答案 Elegentin XieModerator 2012年12月25日 6:04
- 已标记为答案 Elegentin XieModerator 2012年12月27日 8:12
-
你好,
我看了下您的代码应该是VB6的,已经不再支持。具体请参见这个链接:http://blogs.technet.com/b/lifecycle/archive/2008/04/16/end-of-support-for-visual-basic-6-0.aspx
另外这里是C++的论坛,如果您有更多关于VB的问题,请您去这里提问:http://social.microsoft.com/Forums/zh-CN/vbasiczhchs/threads
此致
Elegentin Xie
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- 已标记为答案 Elegentin XieModerator 2012年12月27日 8:12
全部回复
-
在64位 windows中,句柄和指针是64位的, 而LONG是32位的,中间转换的时候会截断,导致错误.
需要把相关的地方都改成64位的,比如把LONG改成LONGLONG,就是64位的啦
- 已建议为答案 Elegentin XieModerator 2012年12月25日 6:04
- 已标记为答案 Elegentin XieModerator 2012年12月27日 8:12
-
你好,
我看了下您的代码应该是VB6的,已经不再支持。具体请参见这个链接:http://blogs.technet.com/b/lifecycle/archive/2008/04/16/end-of-support-for-visual-basic-6-0.aspx
另外这里是C++的论坛,如果您有更多关于VB的问题,请您去这里提问:http://social.microsoft.com/Forums/zh-CN/vbasiczhchs/threads
此致
Elegentin Xie
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- 已标记为答案 Elegentin XieModerator 2012年12月27日 8:12
-
你好,
我把sichuanlu的回复标记为了答案。
如果您有什么不同意的地方请取消标记。
此致Elegentin Xie
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help. -
你好,
我把自己回复标记为了答案。
如果您有什么不同意的地方请取消标记。
此致Elegentin Xie
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.