Menu

[38707f]: / ClassWin32.cs  Maximize  Restore  History

Download this file

57 lines (45 with data), 2.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Text;
using System.Runtime.InteropServices;
namespace GitForce
{
/// <summary>
/// Class containing NativeMethods interoperbility helper functions
/// </summary>
static class NativeMethods
{
public const int SB_BOTTOM = 0x0007;
public const int WM_CLOSE = 0x0010;
public const int WM_PAINT = 0x000F;
public const int WM_VSCROLL = 0x0115;
public const int HWND_BROADCAST = 0xffff;
public const int WM_COMMAND = 0x0111;
public const int TCM_ADJUSTRECT = 0x1328;
public static readonly uint WmShowme = RegisterWindowMessage("WM_SHOWME");
[DllImport("user32")]
public static extern bool PostMessage(IntPtr hwnd, uint msg, IntPtr wparam, IntPtr lparam);
[DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
static extern uint RegisterWindowMessage(string lpString);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll")]
public static extern IntPtr SendMessage(IntPtr hWnd, uint msg, int wParam, int lParam);
[DllImport("kernel32.dll")]
static extern bool AttachConsole(int dwProcessId);
private const int ATTACH_PARENT_PROCESS = -1;
[DllImport("kernel32.dll")]
public static extern bool FreeConsole();
[DllImport("kernel32")]
public static extern int GetShortPathName(string lpszLongPath, StringBuilder lpszShortPath,int bufSize);
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
/// <summary>
/// Attaches a console so we can use Console class to print.
/// This is needed only on Windows implementation where WinForms app detaches from its console.
/// </summary>
public static void AttachConsole()
{
AttachConsole(ATTACH_PARENT_PROCESS);
}
}
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.