欢迎光临
我们一直在努力

在.NET中使用API的方法-.NET教程,Windows开发

建站超值云服务器,限时71元/月

在.net中使用api的方法
www.yescnet.com cnet中文网

可能说vb.net是一个令人恨又令爱的编程软件,新版的.net不像vb6那样多的支持api调用,好不容易在msdn中找到的使用api的方法,代码如下:
[visual basic]
setlasterror := true, charset := charset.unicode, _
exactspelling := true, _
callingconvention := callingconvention.stdcall)> _
public shared function movefile(src as string, dst as string) as boolean
leave function empty – dllimport attribute forces calls to movefile to
be forwarded to movefilew in kernel32.dll
end function
这是调用kernel中的movefile函数,在dllimport中必须声明要调用的函数库明,如kernel32,user32,gdi32等,entrypoint为要调用函数名.
下面是调用showwindow函数的实例:
setlasterror:=true, charset:=charset.unicode, _
exactspelling:=true, _
callingconvention:=callingconvention.stdcall)> _
public shared function showwindow(byval hwne as integer,_
byval ncmdshow as integer) as integer

end function
顺便说一句,在.net中使用从前vb6中hwnd属性的方法是:
me.handle.toint32

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 在.NET中使用API的方法-.NET教程,Windows开发
分享到: 更多 (0)

相关推荐

  • 暂无文章