关于CeCreateProcess的问题!急!

ATMEGA_007   2007-7-10 23:44 楼主
现在定义如下
Public Declare Function CeCreateProcess Lib "rapi.dll"( _
  ByVal lpApplicationName As String, _
  ByVal lpCommandLine As String, _
   lpProcessAttributes as SECURITY_ATTRIBUTES, _
   lpThreadAttributes as SECURITY_ATTRIBUTES, _
  bInheritHandles as Boolean, _
  ByVal dwCreationFlags As Long, _
  lpEnvironment As Any, _
  ByVal lpCurrentDirectory as String, _
   lpStartupInfo as STARTUPINFO, _
   lpProcessInformation as PROCESS_INFORMATION _
) as Boolean
难道写错了?总是不能通过编译,这个是VB6的代码!
这个函数执行后,还有什么要注意的地方吗?

回复评论 (10)

编译错误帖上来看看!
点赞  2007-7-11 10:38
不给我编译,定义就出错!这个定义就不能通过!
点赞  2007-7-11 10:57
总有个提示吧?? 要根据提示去找错误的啊!
点赞  2007-7-11 11:26
错误信息

compile error

user-defined  type not defined
点赞  2007-7-11 13:29
BOOL CeCreateProcess(
  LPCWSTR lpApplicationName,
  LPCWSTR lpCommandLine,
  LPSECURITY_ATTRIBUTES lpProcessAttributes,
  LPSECURITY_ATTRIBUTES lpThreadAttributes,
  BOOL bInheritHandles,
  DWORD dwCreationFlags,
  LPVOID lpEnvironment,
  LPWSTR lpCurrentDirectory,
  LPSTARTUPINFO lpStartupInfo,
  LPPROCESS_INFORMATION lpProcessInformation
);
这个是本来的帮助文档里的信息
点赞  2007-7-11 15:28
Dim R As Boolean
R = CeCreateProcess("\Program Files\SetTime\SetTime.exe", "", "", False, 0, "", "", "", "", "")
Command6.Caption = R

这样执行也报错,

LPSECURITY_ATTRIBUTES lpProcessAttributes
给了默认值Null怎么会报参数类型不匹配的错误!
点赞  2007-7-11 16:09
上面的应该是Dim R As Boolean
R = CeCreateProcess("\\Program Files\\SetTime\\SetTime.exe", "", "", False, 0, "", "", "", "", "")
Command6.Caption = R
要双斜杠的吧??
点赞  2007-7-12 15:17
vb6,不是C sharp,呵呵,提示参数类型不匹配!
点赞  2007-7-12 19:22
BOOL CeCreateProcess(
LPCWSTR lpApplicationName,
LPCWSTR lpCommandLine,
LPSECURITY_ATTRIBUTES lpProcessAttributes,
LPSECURITY_ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPWSTR lpCurrentDirectory,
LPSTARTUPINFO lpStartupInfo,
LPPROCESS_INFORMATION lpProcessInformation);
仔细看下,应该是你没用Unicode的缘故! 这样改试试:
Dim R As Boolean
R = CeCreateProcess(L"\Program Files\SetTime\SetTime.exe", L"", L"", False, 0, L"", L"", L"", L"", L"")
Command6.Caption = R
如果VB下也有类似TEXT这样的宏,则用宏比较好.
点赞  2007-7-13 10:31
这个问题,我一直没有解决!看了一些文档,发现许多人都说这个方法是有问题的!
点赞  2007-8-13 10:30
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 京公网安备 11010802033920号
    写回复