سلام بر تمامی برنامه نویسان عزیز 😉 در این مطلب کد فراخوانی تابع محلی ویندوز با یک Structure Parameter در سی شارپ #C را آماده کردم. انشاالله که این آموزش برای شما مفید باشد.
خروجی کد به این صورت می باشد :
min, max, normal:
(-32000, -32000)
(-60, -8)
(-1, -1)
(1273, 728)
(-32000, -32000)
(-60, -8)
(-1, -1)
(1273, 728)
کد فراخوانی تابع محلی ویندوز با یک Structure Parameter در سی شارپ #C :
// Code from
// A Programmer''// copyright 2000 Eric Gunnerson
using System;
using System.Runtime.InteropServices;
struct Point
{
public int x;
public int y;
public override string ToString()
{
return(String.Format("({0}, {1})", x, y));
}
}
struct Rect
{
public int left;
public int top;
public int right;
public int bottom;
public override string ToString()
{
return(String.Format("({0}, {1})\n ({2}, {3})", left, top, right, bottom));
}
}
struct WindowPlacement
{
public uint length;
public uint flags;
public uint showCmd;
public Point minPosition;
public Point maxPosition;
public Rect normalPosition;
public override string ToString()
{
return(String.Format("min, max, normal:\n{0}\n{1}\n{2}",
minPosition, maxPosition, normalPosition));
}
}
class MainClass
{
[DllImport("user32")]
static extern IntPtr GetForegroundWindow();
[DllImport("user32")]
static extern bool GetWindowPlacement(IntPtr handle, ref WindowPlacement wp);
public static void Main()
{
// A Programmer''// copyright 2000 Eric Gunnerson
using System;
using System.Runtime.InteropServices;
struct Point
{
public int x;
public int y;
public override string ToString()
{
return(String.Format("({0}, {1})", x, y));
}
}
struct Rect
{
public int left;
public int top;
public int right;
public int bottom;
public override string ToString()
{
return(String.Format("({0}, {1})\n ({2}, {3})", left, top, right, bottom));
}
}
struct WindowPlacement
{
public uint length;
public uint flags;
public uint showCmd;
public Point minPosition;
public Point maxPosition;
public Rect normalPosition;
public override string ToString()
{
return(String.Format("min, max, normal:\n{0}\n{1}\n{2}",
minPosition, maxPosition, normalPosition));
}
}
class MainClass
{
[DllImport("user32")]
static extern IntPtr GetForegroundWindow();
[DllImport("user32")]
static extern bool GetWindowPlacement(IntPtr handle, ref WindowPlacement wp);
public static void Main()
{