BioImager  3.9.1
A .NET microscopy imaging library. Supports various microscopes by using imported libraries & GUI automation. Supported libraries include PriorĀ® & ZeissĀ® & all devices supported by Micromanager 2.0 and python-microscope.
Loading...
Searching...
No Matches
BioImager.Win32 Class Reference

Classes

struct  Rect
 

Public Member Functions

static short GetAsyncKeyState (System.Windows.Forms.Keys vKey)
 
static IntPtr GetForegroundWindow ()
 
static int GetWindowText (IntPtr hWnd, StringBuilder text, int count)
 
static bool SetForegroundWindow (IntPtr hWnd)
 
static void mouse_event (int dwFlags, int dx, int dy, int dwData, int dwExtraInfo)
 
static bool GetWindowRect (IntPtr hwnd, ref Rect rectangle)
 

Static Public Member Functions

static bool GetKeyState (System.Windows.Forms.Keys vKey)
 
static void MouseWheelUp ()
 "MouseWheelUp()" is a function that simulates a mouse wheel up event. More...
 
static void MouseWheelDown ()
 MouseWheelDown() simulates a mouse wheel down event. More...
 
static void SetFocus (string process)
 
static string GetActiveWindowTitle ()
 

Static Public Attributes

const int WM_KEYDOWN = 0x100
 
const int WM_KEYUP = 0x101
 
const int MOUSEEVENTF_ABSOLUTE = 0x8000
 
const int MOUSEEVENTF_LEFTDOWN = 0x0002
 
const int MOUSEEVENTF_LEFTUP = 0x0004
 
const int MOUSEEVENTF_MIDDLEDOWN = 0x0020
 
const int MOUSEEVENTF_MIDDLEUP =0x0040
 
const int MOUSEEVENTF_MOVE =0x0001
 
const int MOUSEEVENTF_RIGHTDOWN =0x0008
 
const int MOUSEEVENTF_RIGHTUP =0x0010
 
const int MOUSEEVENTF_WHEEL = 0x0800
 
const int MOUSEEVENTF_XDOWN =0x0080
 
const int MOUSEEVENTF_XUP =0x0100
 
const int MOUSEEVENTF_HWHEEL =0x01000
 

Detailed Description

Definition at line 11 of file Win32.cs.

Member Function Documentation

◆ GetActiveWindowTitle()

static string BioImager.Win32.GetActiveWindowTitle ( )
static

It gets the title of the active window

Returns
The title of the active window.

Definition at line 90 of file Win32.cs.

91 {
92 const int nChars = 256;
93 StringBuilder Buff = new StringBuilder(nChars);
94 IntPtr handle = GetForegroundWindow();
95
96 if (GetWindowText(handle, Buff, nChars) > 0)
97 {
98 return Buff.ToString();
99 }
100 return null;
101 }

◆ GetKeyState()

static bool BioImager.Win32.GetKeyState ( System.Windows.Forms.Keys  vKey)
static

It returns true if the key is pressed, and false if it isn't

Parameters
vKeyThe key you want to check.
Returns
The return value is a short integer with the high order bit set if the key is down and the low order bit set if the key was pressed after the previous call to GetAsyncKeyState.

Definition at line 24 of file Win32.cs.

25 {
26 int si = (int)GetAsyncKeyState(vKey);
27 if (si == 0)
28 return false;
29 else
30 return true;
31 }

◆ MouseWheelDown()

static void BioImager.Win32.MouseWheelDown ( )
static

MouseWheelDown() simulates a mouse wheel down event.

Definition at line 73 of file Win32.cs.

74 {
75 mouse_event(MOUSEEVENTF_WHEEL, 0, 0, -120, 0);
76 }

◆ MouseWheelUp()

static void BioImager.Win32.MouseWheelUp ( )
static

"MouseWheelUp()" is a function that simulates a mouse wheel up event.

Definition at line 68 of file Win32.cs.

69 {
70 mouse_event(MOUSEEVENTF_WHEEL, 0, 0, 120, 0);
71 }

◆ SetFocus()

static void BioImager.Win32.SetFocus ( string  process)
static

It gets the process by name, then sets the foreground window to the process's main window handle

Parameters
processThe name of the process you want to focus on.

Definition at line 81 of file Win32.cs.

82 {
83 Process pr = Process.GetProcessesByName(process)[0];
84 SetForegroundWindow(pr.MainWindowHandle);
85 }

Member Data Documentation

◆ MOUSEEVENTF_ABSOLUTE

const int BioImager.Win32.MOUSEEVENTF_ABSOLUTE = 0x8000
static

Definition at line 51 of file Win32.cs.

◆ MOUSEEVENTF_HWHEEL

const int BioImager.Win32.MOUSEEVENTF_HWHEEL =0x01000
static

Definition at line 62 of file Win32.cs.

◆ MOUSEEVENTF_LEFTDOWN

const int BioImager.Win32.MOUSEEVENTF_LEFTDOWN = 0x0002
static

Definition at line 52 of file Win32.cs.

◆ MOUSEEVENTF_LEFTUP

const int BioImager.Win32.MOUSEEVENTF_LEFTUP = 0x0004
static

Definition at line 53 of file Win32.cs.

◆ MOUSEEVENTF_MIDDLEDOWN

const int BioImager.Win32.MOUSEEVENTF_MIDDLEDOWN = 0x0020
static

Definition at line 54 of file Win32.cs.

◆ MOUSEEVENTF_MIDDLEUP

const int BioImager.Win32.MOUSEEVENTF_MIDDLEUP =0x0040
static

Definition at line 55 of file Win32.cs.

◆ MOUSEEVENTF_MOVE

const int BioImager.Win32.MOUSEEVENTF_MOVE =0x0001
static

Definition at line 56 of file Win32.cs.

◆ MOUSEEVENTF_RIGHTDOWN

const int BioImager.Win32.MOUSEEVENTF_RIGHTDOWN =0x0008
static

Definition at line 57 of file Win32.cs.

◆ MOUSEEVENTF_RIGHTUP

const int BioImager.Win32.MOUSEEVENTF_RIGHTUP =0x0010
static

Definition at line 58 of file Win32.cs.

◆ MOUSEEVENTF_WHEEL

const int BioImager.Win32.MOUSEEVENTF_WHEEL = 0x0800
static

Definition at line 59 of file Win32.cs.

◆ MOUSEEVENTF_XDOWN

const int BioImager.Win32.MOUSEEVENTF_XDOWN =0x0080
static

Definition at line 60 of file Win32.cs.

◆ MOUSEEVENTF_XUP

const int BioImager.Win32.MOUSEEVENTF_XUP =0x0100
static

Definition at line 61 of file Win32.cs.

◆ WM_KEYDOWN

const int BioImager.Win32.WM_KEYDOWN = 0x100
static

Definition at line 15 of file Win32.cs.

◆ WM_KEYUP

const int BioImager.Win32.WM_KEYUP = 0x101
static

Definition at line 16 of file Win32.cs.


The documentation for this class was generated from the following file: