Skip to content

Instantly share code, notes, and snippets.

@vabock
Created March 29, 2011 12:28
Show Gist options
  • Save vabock/892273 to your computer and use it in GitHub Desktop.
Save vabock/892273 to your computer and use it in GitHub Desktop.
BooでP/Invokeテスト
namespace getwr
import System
import System.Runtime.InteropServices
[StructLayout(LayoutKind.Sequential)]
struct RECT:
public Left as int
public Top as int
public Right as int
public Bottom as int
[DllImport("user32.dll")]
def GetWindowRect(hwnd as IntPtr, ref lpRect as RECT) [MarshalAs(UnmanagedType.Bool)] as bool:
pass
[DllImport("user32.dll")]
def GetDesktopWindow() as IntPtr:
pass
print "Hello, World!"
w = GetDesktopWindow()
r = RECT()
print GetWindowRect(w, r) // refはいらない
print r.Left, r.Top, r.Right, r.Bottom
// TODO: Implement Functionality Here
print "Press any key to continue . . . "
Console.ReadKey(true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment