可能說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