~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/addins/WindowsPlatform/Win32.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
Import upstream version 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//  Copyright (c) 2006, Gustavo Franco
 
2
//  Email:  gustavo_franco@hotmail.com
 
3
//  All rights reserved.
 
4
 
 
5
//  Redistribution and use in source and binary forms, with or without modification, 
 
6
//  are permitted provided that the following conditions are met:
 
7
 
 
8
//  Redistributions of source code must retain the above copyright notice, 
 
9
//  this list of conditions and the following disclaimer. 
 
10
//  Redistributions in binary form must reproduce the above copyright notice, 
 
11
//  this list of conditions and the following disclaimer in the documentation 
 
12
//  and/or other materials provided with the distribution. 
 
13
 
 
14
//  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
 
15
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
 
16
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
 
17
//  PURPOSE. IT CAN BE DISTRIBUTED FREE OF CHARGE AS LONG AS THIS HEADER 
 
18
//  REMAINS UNCHANGED.
 
19
 
 
20
using System;
 
21
using System.Collections.Generic;
 
22
using System.Text;
 
23
using System.Runtime.InteropServices;
 
24
 
 
25
namespace CustomControls.OS
 
26
{
 
27
    [Author("Franco, Gustavo")]
 
28
    public static class Win32
 
29
    {
 
30
        public const uint SHGFI_ICON = 0x100;
 
31
        public const uint SHGFI_LARGEICON = 0x0; // 'Large icon
 
32
        public const uint SHGFI_SMALLICON = 0x1; // 'Small icon
 
33
        public const uint SHGFI_ICONLOCATION = 0x1000;
 
34
        public const uint SHGFI_TYPENAME = 0x400;
 
35
 
 
36
        #region Delegates
 
37
        public delegate bool EnumWindowsCallBack(IntPtr hWnd, int lParam);
 
38
        #endregion
 
39
 
 
40
        #region USER32
 
41
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
 
42
        public static extern IntPtr GetParent(IntPtr hWnd);
 
43
        [DllImport("User32.Dll")]
 
44
        public static extern int GetDlgCtrlID(IntPtr hWndCtl);
 
45
        [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
 
46
        public static extern int MapWindowPoints(IntPtr hWnd, IntPtr hWndTo, ref POINT pt, int cPoints);
 
47
        [DllImport("user32.dll", SetLastError = true)]
 
48
        public static extern bool GetWindowInfo(IntPtr hwnd, out WINDOWINFO pwi);
 
49
        [DllImport("User32.Dll")]
 
50
        public static extern void GetWindowText(IntPtr hWnd, StringBuilder param, int length);
 
51
        [DllImport("User32.Dll")]
 
52
        public static extern void GetClassName(IntPtr hWnd, StringBuilder param, int length);
 
53
        [DllImport("user32.Dll")]
 
54
        public static extern bool EnumChildWindows(IntPtr hWndParent, EnumWindowsCallBack lpEnumFunc, int lParam);
 
55
        [DllImport("user32.Dll")]
 
56
        public static extern bool EnumWindows(EnumWindowsCallBack lpEnumFunc, int lParam);
 
57
        [DllImport("User32.dll", CharSet = CharSet.Auto)]
 
58
        public static extern bool ReleaseCapture();
 
59
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
 
60
        public static extern IntPtr SetCapture(IntPtr hWnd);
 
61
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
 
62
        public static extern IntPtr ChildWindowFromPointEx(IntPtr hParent, POINT pt, ChildFromPointFlags flags);
 
63
        [DllImport("user32.dll", EntryPoint = "FindWindowExA", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)]
 
64
        public static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
 
65
        [DllImport("user32.dll")]
 
66
        public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
 
67
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
 
68
        public static extern int PostMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
 
69
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
 
70
        public static extern int PostMessage(IntPtr hWnd, int msg, int wParam, int lParam);
 
71
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
 
72
        public static extern int SendMessage(IntPtr hWnd, uint msg, IntPtr wParam, IntPtr lParam);
 
73
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
 
74
        public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);
 
75
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
 
76
        public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, StringBuilder param);
 
77
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
 
78
        public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, char[] chars);
 
79
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
 
80
        public static extern IntPtr BeginDeferWindowPos(int nNumWindows);
 
81
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
 
82
        public static extern IntPtr DeferWindowPos(IntPtr hWinPosInfo, IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int Width, int Height, SetWindowPosFlags flags);
 
83
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
 
84
        public static extern bool EndDeferWindowPos(IntPtr hWinPosInfo);
 
85
        [DllImport("user32.dll", CharSet = CharSet.Auto)]
 
86
        public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int Width, int Height, SetWindowPosFlags flags);
 
87
        [DllImport("user32.dll")]
 
88
        public static extern bool GetWindowRect(IntPtr hwnd, ref RECT rect);
 
89
        [DllImport("user32.dll")]
 
90
        public static extern bool GetClientRect(IntPtr hwnd, ref RECT rect);
 
91
        [DllImport("shell32.dll")]
 
92
        public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags);
 
93
        #endregion
 
94
    }
 
95
}