如何在Delphi Prism中调用函数CreateProcess?
我写了
function CreateProcess(
lpApplicationName:String;
lpCommandLine:String;
lpProcessAttributes:IntPtr;
lpThreadAttributes:IntPtr;
bInheritHandles:Boolean;
dwCreationFlags:Int32;
lpEnvironment:IntPtr;
lpCurrentDirectory:IntPtr;
lpStartupInfo:STARTUPINFO;
lpProcessInformation:ProcessInfo):Boolean;
external 'kernel32.dll';
,但 VStudio 说“预期分号”- 在外部之后,在“kernel32.dll”之后预期“结束”; 你能帮我加载和调用一个函数吗?
I wrote
function CreateProcess(
lpApplicationName:String;
lpCommandLine:String;
lpProcessAttributes:IntPtr;
lpThreadAttributes:IntPtr;
bInheritHandles:Boolean;
dwCreationFlags:Int32;
lpEnvironment:IntPtr;
lpCurrentDirectory:IntPtr;
lpStartupInfo:STARTUPINFO;
lpProcessInformation:ProcessInfo):Boolean;
external 'kernel32.dll';
but VStudio said "Semicolon" expected - after external and " "end" expected" after 'kernel32.dll';
Can you help me to load and call a function please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
为什么不使用 .NET Process Class .. 在这种情况下使用互操作没有多大意义,因为您已经在使用 Delphi Prism ..
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx
Why don't you use the .NET Process Class .. it does not make a lot of sense to use interop in this case since you are already using Delphi Prism..
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx
@Ilya,您使用了错误的语法来调用外部函数。您需要使用
DllImport
关键字才能使 Windows 互操作正常工作。您必须重写您的函数来
检查此工作示例
检查这些链接以获取更多信息
@Ilya, you are using a wrong syntax for call an external function. You need to use the
DllImport
keyword to get Windows interop working.you must rewrite your function to
check this working sample
Check theses link for mmore info