本文整理汇总了C#中Win32类的典型用法代码示例。如果您正苦于以下问题:C# Win32类的具体用法?C# Win32怎么用?C# Win32使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Win32类属于命名空间,在下文中一共展示了Win32类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CaptureWindow
private Tree CaptureWindow(IntPtr hwnd, Win32.WINDOWINFO windowinfo, bool usePrintWindow, bool fixedSize = false)
{
BoundingBox windowRect = new BoundingBox(windowinfo.rcWindow.left, windowinfo.rcWindow.top,
windowinfo.rcWindow.right - windowinfo.rcWindow.left + 1, windowinfo.rcWindow.bottom - windowinfo.rcWindow.top + 1);
var attributes = GetWindowAttributes(hwnd, windowinfo);
if (windowRect.Width > 0 && windowRect.Height > 0)
{
System.Drawing.Bitmap bmp;
int width = windowRect.Width;
int height = windowRect.Height;
if(fixedSize)
{
width = (int)System.Windows.SystemParameters.VirtualScreenWidth;
height = (int)System.Windows.SystemParameters.VirtualScreenHeight;
}
if (!usePrintWindow)
bmp = GetBitmapFromScreen(hwnd, null, width, height);
else
bmp = GetBitmapFromPrintWindow(hwnd, null, width, height);
Tree window = _bitmapToTree.GetScreenshotAndCreateTree(windowRect.Width, windowRect.Height, bmp, attributes);
//_pool.ReturnInstance(bmp);
return window;
}
return null;
}
开发者ID:prefab,项目名称:code,代码行数:31,代码来源:WindowCapture.cs
示例2: ColorOperation
// Methods
public ColorOperation()
{
this.mouseAreaControl = null;
this.translatePath = new GraphicsPath();
this.scalePath = new GraphicsPath();
this.rotatePath = new GraphicsPath();
this.equalPath = new GraphicsPath();
this.skewxPath = new GraphicsPath();
this.skewyPath = new GraphicsPath();
this.anglescalePath = new GraphicsPath();
this.vscalPath = new GraphicsPath();
this.controlPoints = null;
this.reversePath = new GraphicsPath();
this.startPoint = PointF.Empty;
this.win32 = new Win32();
this.ratiomatrix = new Matrix();
this.graphMatrix = new Matrix();
this.selectMatrix = new Matrix();
this.gradientMatrix = new Matrix();
this.gradientPath = new GraphicsPath();
this.gradientheight = 1f;
this.centerPoint = PointF.Empty;
this.gradientstr = string.Empty;
this.colorpickerstr = string.Empty;
this.gradientstr = DrawAreaConfig.GetLabelForName("gradienttransform").Trim();
this.colorpickerstr = DrawAreaConfig.GetLabelForName("colorpicker").Trim();
}
开发者ID:EdgarEDT,项目名称:myitoppsp,代码行数:28,代码来源:ColorOperation.cs
示例3: Monitor
public Monitor(Win32.DISPLAY_DEVICE device, Win32.DEVMODE currentDisplaySettings, List<Win32.DEVMODE> availableDisplaySettings)
{
Device = device;
AvailableDisplaySettings = availableDisplaySettings;
CurrentDisplaySettings = currentDisplaySettings;
IsPrimary = CurrentDisplaySettings.dmPositionX == 0 && CurrentDisplaySettings.dmPositionY == 0;
}
开发者ID:bossaia,项目名称:multi-monitor-dock-util,代码行数:7,代码来源:Display.cs
示例4: GetPreferences
bool GetPreferences(string section, out Win32.RECT rect, out long style, out long exStyle)
{
rect = new Win32.RECT();
style = 0;
exStyle = 0;
if (!Preferences.HasSection(section))
{
return false;
}
string[] keys = { "rectLeft", "rectTop", "rectRight", "rectBottom", "style", "exStyle" };
foreach (string key in keys)
{
if (!Preferences[section].HasKey(key))
{
return false;
}
}
if (!int.TryParse(Preferences[section]["rectLeft"].Value, out rect.Left)) { return false; }
if (!int.TryParse(Preferences[section]["rectTop"].Value, out rect.Top)) { return false; }
if (!int.TryParse(Preferences[section]["rectRight"].Value, out rect.Right)) { return false; }
if (!int.TryParse(Preferences[section]["rectBottom"].Value, out rect.Bottom)) { return false; }
if (!long.TryParse(Preferences[section]["style"].Value, out style)) { return false; }
if (!long.TryParse(Preferences[section]["exStyle"].Value, out exStyle)) { return false; }
return true;
}
开发者ID:na4153,项目名称:cm3d2_plugins_okiba,代码行数:26,代码来源:ConsistentWindowPositionPlugin.cs
示例5: GetImageSource
/// <summary>
/// Gets the icon as an <see cref="ImageSource"/> for the specified path.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="info">The shell file info.</param>
/// <returns>The icon as an <see cref="ImageSource"/> for the specified path.</returns>
public static ImageSource GetImageSource(string path, out Win32.SHFILEINFO info)
{
info = new Win32.SHFILEINFO();
int attr;
if (Directory.Exists(path))
attr = (int)Win32.FILE_ATTRIBUTE_DIRECTORY;
else if (File.Exists(path))
attr = (int)Win32.FILE_ATTRIBUTE_NORMAL;
else if (path.Length == 3) // drive not ready
attr = (int)Win32.FILE_ATTRIBUTE_DIRECTORY;
else
return null;
Win32.SHGetFileInfo(path, attr, out info, (uint)Marshal.SizeOf(typeof(Win32.SHFILEINFO)), Win32.SHGFI_DISPLAYNAME | Win32.SHGFI_ICON | Win32.SHGFI_TYPENAME | Win32.SHGFI_SMALLICON | Win32.SHGFI_USEFILEATTRIBUTES);
ImageSource img = null;
if (info.hIcon != IntPtr.Zero)
{
using (Icon icon = Icon.FromHandle(info.hIcon))
{
img = Imaging.CreateBitmapSourceFromHIcon(icon.Handle, new Int32Rect(0, 0, icon.Width, icon.Height), BitmapSizeOptions.FromEmptyOptions());
}
Win32.DestroyIcon(info.hIcon);
}
return img;
}
开发者ID:judwhite,项目名称:CD-Tag,代码行数:35,代码来源:IconHelper.cs
示例6: ViewOperation
// Methods
public ViewOperation()
{
this.mouseAreaControl = null;
this.startPoint = Point.Empty;
this.oldleft = 0f;
this.oldtop = 0f;
this.reversePath =new GraphicsPath();
this.win32 = new Win32();
}
开发者ID:EdgarEDT,项目名称:myitoppsp,代码行数:10,代码来源:ViewOperation.cs
示例7: Click
public static bool Click(Win32.Point point)
{
if (bshandle == IntPtr.Zero)
bshandle = GetBlueStackWindowHandle();
if (bshandle == IntPtr.Zero)
return false;
MouseHelper.ClickOnPoint(bshandle, point);
return true;
}
开发者ID:hasantemel,项目名称:Coc-bot-Csharp,代码行数:9,代码来源:BlueStackHelper.cs
示例8: HandleCtrl
static bool HandleCtrl(Win32.CtrlTypes type)
{
var name = Enum.GetName(type.GetType(), type);
Console.WriteLine("\nExiting due to {0} event from system!\n", name);
if (f != null)
f.TerminateBots();
return true;
}
开发者ID:weedindeed,项目名称:EndlessClient,代码行数:9,代码来源:Program.cs
示例9: SetPreferences
bool SetPreferences(string section, Win32.RECT rect, long style, long exStyle)
{
Preferences[section]["rectLeft"].Value = rect.Left.ToString();
Preferences[section]["rectTop"].Value = rect.Top.ToString();
Preferences[section]["rectRight"].Value = rect.Right.ToString();
Preferences[section]["rectBottom"].Value = rect.Bottom.ToString();
Preferences[section]["style"].Value = style.ToString();
Preferences[section]["exStyle"].Value = exStyle.ToString();
return true;
}
开发者ID:na4153,项目名称:cm3d2_plugins_okiba,代码行数:10,代码来源:ConsistentWindowPositionPlugin.cs
示例10: DwmExtendFrameIntoClientArea
public static int DwmExtendFrameIntoClientArea(IntPtr hwnd, ref Win32.MARGINS margins)
{
IntPtr hModule = Win32.LoadLibrary("dwmapi");
if (hModule == IntPtr.Zero)
return 0;
IntPtr procAddress = Win32.GetProcAddress(hModule, "DwmExtendFrameIntoClientArea");
if (procAddress == IntPtr.Zero)
return 0;
else
return ((Win32.DwmExtendFrameIntoClientAreaDelegate) Marshal.GetDelegateForFunctionPointer(procAddress, typeof (Win32.DwmExtendFrameIntoClientAreaDelegate)))(hwnd, ref margins);
}
开发者ID:unbearab1e,项目名称:FlattyTweet,代码行数:11,代码来源:Win32.cs
示例11: EnumWindowByName
private IntPtr EnumWindowByName(Win32.EnumWindowsProc filter)
{
IntPtr WindowHwnd = IntPtr.Zero;
Win32.EnumWindows(delegate(IntPtr hwnd, IntPtr lparam)
{
if (filter(hwnd, lparam))
{
WindowHwnd = hwnd;
return false;
}
return true;
}, IntPtr.Zero);
return WindowHwnd;
}
开发者ID:xyzaabb11,项目名称:SyncPerformanceData_net,代码行数:14,代码来源:MainWindow.xaml.cs
示例12: EnumChildWindowByName
private IntPtr EnumChildWindowByName(IntPtr parent, Win32.EnumWindowsProc filter)
{
IntPtr WindowHwnd = IntPtr.Zero;
Win32.EnumChildWindows(parent, delegate(IntPtr hwnd, IntPtr lparam)
{
if (filter(hwnd, lparam))
{
WindowHwnd = hwnd;
return false;
}
else
{
EnumChildWindowByName(hwnd, filter);
}
return true;
}, IntPtr.Zero);
return WindowHwnd;
}
开发者ID:xyzaabb11,项目名称:SyncPerformanceData_net,代码行数:19,代码来源:MainWindow.xaml.cs
示例13: SelectOperation
// Methods
public SelectOperation()
{
this.mouseAreaControl = null;
this.toBeSelectedGraph = null;
this.toBeSelectedPath = null;
this.currentMousePoint = MousePoint.None;
this.reversePath = new GraphicsPath();
this.oriPath = new GraphicsPath();
this.startpoint = PointF.Empty;
this.movePoint = PointF.Empty;
this.selectMatrix = new Matrix();
this.totalmatrix = new Matrix();
this.controlPoint = PointF.Empty;
this.selectAreaPath = new GraphicsPath();
this.win32 = new Win32();
this.AreaPoints = new ArrayList(0x10);
this.ps = new PointF[8];
this.rotateindex = 0;
this.selectCollection = new SvgElementCollection();
this.tooltips = new Hashtable(0x10);
this.rotatepath = new GraphicsPath();
}
开发者ID:EdgarEDT,项目名称:myitoppsp,代码行数:23,代码来源:SelectOperation.cs
示例14: GetWindowAttributes
private Dictionary<string, object> GetWindowAttributes(IntPtr hwnd, Win32.WINDOWINFO windowinfo)
{
Dictionary<string, object> attributes = new Dictionary<string, object>();
attributes["handle"] = hwnd;
ExpensiveWindowInfo expensiveInfo;
if (!_windowInfo.TryGetValue(hwnd, out expensiveInfo))
{
expensiveInfo = new ExpensiveWindowInfo(Win32.GetClassName(hwnd), Win32.GetWindowText(hwnd), Win32.GetProcessPathFromWindowHandle(hwnd));
_windowInfo.Add(hwnd, expensiveInfo);
}
attributes["processfilename"] = expensiveInfo.ProcessFilePath;
attributes["title"] = expensiveInfo.Title;
attributes["classname"] = expensiveInfo.ClassName;
attributes["style"] = windowinfo.dwStyle;
attributes["exstyle"] = windowinfo.dwExStyle;
return attributes;
}
开发者ID:nunb,项目名称:io,代码行数:23,代码来源:WindowCapture.cs
示例15: Hooked
int Hooked(int code, IntPtr wparam, ref Win32.CWPSTRUCT cwp)
{
switch(code) {
case 0:
switch(cwp.message) {
case Win32.WM_CREATE:
string s = string.Empty;
char[] className = new char[10];
int length = Win32.GetClassName( cwp.hwnd, className, 9 );
for( int i = 0; i < length; i++ )
s += className[i];
if( s == "#32768" ) { // System class for menu
defaultWndProc = Win32.SetWindowLong( cwp.hwnd, (-4), subWndProc );
//int old = Win32.GetWindowLong( cwp.hwnd, (-20) );
//Win32.SetWindowLong2( cwp.hwnd, (-20)/*GWL_EXSTYLE=(-20)*/, 0x20/*WS_EX_TRANSPARENT=0x20*/ );
}
break;
}
break;
}
return Win32.CallNextHookEx(hookHandle,code,wparam, ref cwp);
}
开发者ID:inspirer,项目名称:uml-designer,代码行数:23,代码来源:FlatMenu.cs
示例16: addHook
internal IntPtr addHook(Win32.HookingIDs hID, WinAPI.LowLevelMouseProc callback)
{
if (ModuleHandle == IntPtr.Zero) {
using (var curProcess = Process.GetCurrentProcess())
using (var curModule = curProcess.MainModule) {
IntPtr ret = WinAPI.SetWindowsHookEx((int)hID, callback, WinAPI.GetModuleHandle(curModule.ModuleName), 0);
HookInfo info = new HookInfo();
info.hookID = ret;
info.callback = callback;
info.hID = hID;
hookIDs.Add(info);
return ret;
}
} else {
IntPtr ret = WinAPI.SetWindowsHookEx((int)hID, callback, ModuleHandle, 0);
HookInfo info = new HookInfo();
info.hookID = ret;
info.callback = callback;
info.hID = hID;
hookIDs.Add(info);
hookIDs.Add(info);
return ret;
}
}
开发者ID:FireFlyForLife,项目名称:RSMacroProject,代码行数:24,代码来源:HookingManager.cs
示例17: HookProc
/// <summary>
/// The callback for the Keyboard hook
/// </summary>
/// <param name="code"></param>
/// <param name="wParam"></param>
/// <param name="lParam"></param>
/// <returns></returns>
private int HookProc(int code, int wParam, ref Win32.KBDLLHOOKSTRUCT lParam)
{
if (code >= 0)
{
Key key = System.Windows.Input.KeyInterop.KeyFromVirtualKey(lParam.vkCode);
//if (HookedKeys.Contains(key))
{
KeyboardHookEventArgs kea = new KeyboardHookEventArgs(key, true);
if ((wParam == (int)Win32.WindowsMessages.WM_KEYDOWN || wParam == (int)Win32.WindowsMessages.WM_SYSKEYDOWN) && (KeyDown != null))
{
KeyDown(this, kea);
}
else if ((wParam == (int)Win32.WindowsMessages.WM_KEYUP || wParam == (int)Win32.WindowsMessages.WM_SYSKEYUP) && (KeyUp != null))
{
kea.IsDown = false;
KeyUp(this, kea);
}
if (kea.Handled)
return 1;
}
}
return Win32.CallNextHookEx(m_hHook, code, wParam, ref lParam);
}
开发者ID:benneeh,项目名称:wScreenshot,代码行数:31,代码来源:KeyboardHook.cs
示例18: TranslateMouseButtons
/// ------------------------------------------------------------------------------------
/// <summary>
/// Translate mouse buttons received from a Win API mouse message to .NET mouse buttons
/// </summary>
/// <param name="winMouseButtons">Windows mouse buttons</param>
/// <returns>.NET mouse buttons</returns>
/// ------------------------------------------------------------------------------------
public static MouseButtons TranslateMouseButtons(Win32.MouseButtons winMouseButtons)
{
MouseButtons mouseButton = MouseButtons.None;
if ((winMouseButtons & Win32.MouseButtons.MK_LBUTTON) == Win32.MouseButtons.MK_LBUTTON)
mouseButton |= MouseButtons.Left;
if ((winMouseButtons & Win32.MouseButtons.MK_RBUTTON) == Win32.MouseButtons.MK_RBUTTON)
mouseButton |= MouseButtons.Right;
if ((winMouseButtons & Win32.MouseButtons.MK_MBUTTON) == Win32.MouseButtons.MK_MBUTTON)
mouseButton |= MouseButtons.Middle;
if ((winMouseButtons & Win32.MouseButtons.MK_XBUTTON1) == Win32.MouseButtons.MK_XBUTTON1)
mouseButton |= MouseButtons.XButton1;
if ((winMouseButtons & Win32.MouseButtons.MK_XBUTTON2) == Win32.MouseButtons.MK_XBUTTON2)
mouseButton |= MouseButtons.XButton2;
return mouseButton;
}
开发者ID:sillsdev,项目名称:CarlaLegacy,代码行数:23,代码来源:Utils.cs
示例19: ConsoleCtrlHandler
private static bool ConsoleCtrlHandler(Win32.CtrlType ctrlType)
{
const bool ignore = true;
return ignore;
}
开发者ID:slavagu,项目名称:ConsoleAppLauncher,代码行数:5,代码来源:ConsoleApp.cs
示例20: SetScrollPos
/// <summary>
/// Sends a win32 message to set scrollbars position.
/// </summary>
/// <param name="point">a POINT conatining H/Vscrollbar scrollpos.</param>
private unsafe void SetScrollPos(Win32.POINT point)
{
IntPtr ptr = new IntPtr(&point);
Win32.SendMessage(richTextBox1.Handle, Win32.EM_SETSCROLLPOS, 0, ptr);
}
开发者ID:mattn,项目名称:MarkDownSharpEditor,代码行数:9,代码来源:Form1.cs
注:本文中的Win32类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论