DC2343A  FW 1.0.2 / GUI 1.0.10
LTC3335 Nanopower Buck-Boost DC/DC with Integrated Coulomb Counter
 All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
declares.vb
Go to the documentation of this file.
1 /**
2  * @file declares.vb
3  * <summary>example file demonstrating Windows API Declares</summary>
4  * <remarks>The original unfiltered source of this file: <A HREF="http://trac.sevo.org/projects/doxyvb/browser/trunk/samples/DotNET/declares.vb">declares.vb</A></remarks>
5  */
6 using System.IO;
7 using System.Threading;
8 using System.Runtime.Serialization;
9 namespace DotNET {
10  /**
11  * <summary>
12  * simple class with Windows API functions
13  * </summary>
14  * <remarks>implements some windows api functions</remarks>
15  */
16  public class WinAPIClass
17  {
18  /**
19  * <summary>
20  * Places (posts) a message in the message queue associated with the thread.
21  * </summary>
22  * <param name="hWnd">A handle to the window whose window procedure is to receive the message.</param>
23  * <param name="uMsg">The message to be posted.</param>
24  * <param name="wParam">Additional message-specific information.</param>
25  * <param name="lParam">Additional message-specific information.</param>
26  * <returns>If the function succeeds, the return value is nonzero.</returns>
27  */
28  /** Is imported from extern library: user32.dll (Alias: PostMessageA) */
29  private extern bool PostMessage (int hWnd, int uMsg, int wParam, int lParam) ;
30  /**
31  * <summary>
32  * Brings the thread that created the specified window into the foreground and activates the window
33  * </summary>
34  * <param name="handle">A handle to the window that should be activated and brought to the foreground.</param>
35  * <returns>If the window was brought to the foreground, the return value is nonzero.</returns>
36  */
37  /** Is imported from extern library: user32.dll */
38  private extern bool SetForegroundWindow (IntPtr handle) ;
39  /**
40  * <summary>
41  * Sets the specified window's show state.
42  * </summary>
43  * <param name="hWnd">A handle to the window.</param>
44  * <param name="nCmdShow">Controls how the window is to be shown</param>
45  * <returns>If the window was previously visible, the return value is nonzero</returns>
46  */
47  /** Is imported from extern library: user32.dll */
48  private extern bool ShowWindow (IntPtr hWnd, SHOW_WINDOW nCmdShow) ;
49  /**
50  * <summary>
51  * Retrieves the show state and the restored, minimized, and maximized positions of the specified window.
52  * </summary>
53  * <param name="hwnd">A handle to the window. </param>
54  * <param name="lpwndpl">A pointer to the WINDOWPLACEMENT structure that receives the show state and position information.</param>
55  * <returns>If the function succeeds, the return value is nonzero.</returns>
56  * <remarks></remarks>
57  */
58  /** Is imported from extern library: user32 */
59  private extern int GetWindowPlacement (IntPtr hwnd, ref WINDOWPLACEMENT lpwndpl) ;
60  /**
61  * <summary>
62  * Contains information about the placement of a window on the screen.
63  * </summary>
64  */
65  private struct WINDOWPLACEMENT
66  {
67  public int Length;
68  public int flags;
69  /**
70  * <summary>
71  * The current show state of the window
72  * </summary>
73  */
74  public int showCmd;
75  public POINTAPI ptMinPosition;
76  public POINTAPI ptMaxPosition;
77  public RECT rcNormalPosition;
78  }
79  /**
80  * <summary>
81  * The POINT structure defines the x- and y- coordinates of a point
82  * </summary>
83  */
84  private struct POINTAPI
85  {
86  public int x;
87  public int y;
88  }
89  /**
90  * <summary>
91  * The RECT structure defines the coordinates of the upper-left and lower-right corners of a rectangle.
92  * </summary>
93  */
94  private struct RECT
95  {
96  public int Left;
97  public int Top;
98  public int Right;
99  public int Bottom;
100  }
101  /**
102  * <summary>
103  * default windows message code for communication between applications
104  * </summary>
105  * <remarks>WM_USER is outdated and should not be used</remarks>
106  */
107  private const WM_APP = &H8000;
108  /**
109  * <summary>
110  * system command windows message
111  * </summary>
112  * <remarks>is used to send system events to a window</remarks>
113  */
114  private const WM_SYSCOMMAND = &H112;
115  /**
116  * <summary>
117  * cloase parameter for system command windows message
118  * </summary>
119  * <remarks>is used to send a close event to a window</remarks>
120  */
121  private const SC_CLOSE = &HF060&;
122  /**
123  * <summary>
124  * Enumeration of window status codes
125  * </summary>
126  */
127  private enum SHOW_WINDOW
128  {
129  SW_HIDE = 0,
130  SW_SHOWNORMAL = 1,
131  SW_NORMAL = 1,
132  SW_SHOWMINIMIZED = 2,
133  SW_SHOWMAXIMIZED = 3,
134  SW_MAXIMIZE = 3,
135  SW_SHOWNOACTIVATE = 4,
136  SW_SHOW = 5,
137  SW_MINIMIZE = 6,
138  SW_SHOWMINNOACTIVE = 7,
139  SW_SHOWNA = 8,
140  SW_RESTORE = 9,
141  SW_SHOWDEFAULT = 10,
142  SW_FORCEMINIMIZE = 11,
143  SW_MAX = 11
144  }
145  /**
146  * <summary>
147  * Retrieves the length, in characters, of the specified window's title bar text
148  * </summary>
149  * <param name="hwnd">A handle to the window or control.</param>
150  * <returns>If the function succeeds, the return value is the length, in characters, of the text.</returns>
151  */
152  /** Is imported from extern library: user32.dll (Alias: GetWindowTextLengthA) */
153  private extern int GetWindowTextLength (int hwnd) ;
154  /**
155  * <summary>
156  * Copies the text of the specified window's title bar (if it has one) into a buffer
157  * </summary>
158  * <param name="hwnd">A handle to the window or control containing the text.</param>
159  * <param name="lpString">The buffer that will receive the text.</param>
160  * <param name="cch">The maximum number of characters to copy to the buffer, including the null character.</param>
161  * <returns>If the function succeeds, the return value is the length, in characters, of the copied string, not including the terminating null character.</returns>
162  */
163  /** Is imported from extern library: user32 (Alias: GetWindowTextA) */
164  private extern int GetWindowText (int hwnd, string lpString, int cch) ;
165  /**
166  * <summary>
167  * Retrieves the identifier of the thread that created the specified window
168  * </summary>
169  * <param name="hwnd">A handle to the window.</param>
170  * <param name="lpdwProcessId">A pointer to a variable that receives the process identifier.</param>
171  * <returns>The return value is the identifier of the thread that created the window. </returns>
172  */
173  /** Is imported from extern library: user32 */
174  public extern Auto int GetWindowThreadProcessId (int hwnd, ref int lpdwProcessId) ;
175  /**
176  * <summary>
177  * Enumerates all top-level windows on the screen by passing the handle to each window, in turn, to an application-defined callback function.
178  * </summary>
179  * <param name="lpEnumFunc">A pointer to an application-defined callback function.</param>
180  * <param name="lParam">An application-defined value to be passed to the callback function.</param>
181  * <returns>If the function succeeds, the return value is nonzero.</returns>
182  */
183  /** Is imported from extern library: user32 */
184  private extern int EnumWindows (EnumWindowsCallBack lpEnumFunc, int lParam) ;
185  }
186 }
simple class with Windows API functions
Definition: declares.vb:16
Auto int GetWindowThreadProcessId(int hwnd, ref int lpdwProcessId)
Retrieves the identifier of the thread that created the specified window