diff --git a/PInvoke/User32/WinUser.Window.cs b/PInvoke/User32/WinUser.Window.cs index 729844a0..b162eed2 100644 --- a/PInvoke/User32/WinUser.Window.cs +++ b/PInvoke/User32/WinUser.Window.cs @@ -2129,8 +2129,9 @@ namespace Vanara.PInvoke // https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-createwindowa // void CreateWindowA( lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam ); [PInvokeData("winuser.h", MSDNShortId = "NF:winuser.CreateWindowA")] - public static void CreateWindow(string lpClassName, string lpWindowName, WindowStyles dwStyle, - int x, int y, int nWidth, int nHeight, [Optional] HWND hWndParent, [Optional] HMENU hMenu, HINSTANCE hInstance, [Optional] IntPtr lpParam) + public static void CreateWindow(string lpClassName, string lpWindowName, [Optional] WindowStyles dwStyle, + [Optional] int x, [Optional] int y, [Optional] int nWidth, [Optional] int nHeight, [Optional] HWND hWndParent, [Optional] HMENU hMenu, + [Optional] HINSTANCE hInstance, [Optional] IntPtr lpParam) => CreateWindowEx(0, lpClassName, lpWindowName, dwStyle, x, y, nWidth, nHeight, hWndParent, hMenu, hInstance, lpParam); /// @@ -2382,8 +2383,9 @@ namespace Vanara.PInvoke // HINSTANCE hInstance, LPVOID lpParam ); [DllImport(Lib.User32, SetLastError = true, CharSet = CharSet.Auto)] [PInvokeData("winuser.h", MSDNShortId = "createwindowex")] - public static extern SafeHWND CreateWindowEx(WindowStylesEx dwExStyle, string lpClassName, string lpWindowName, WindowStyles dwStyle, - int X, int Y, int nWidth, int nHeight, [Optional] HWND hWndParent, [Optional] HMENU hMenu, HINSTANCE hInstance, [Optional] IntPtr lpParam); + public static extern SafeHWND CreateWindowEx([Optional] WindowStylesEx dwExStyle, string lpClassName, string lpWindowName, [Optional] WindowStyles dwStyle, + [Optional] int X, [Optional] int Y, [Optional] int nWidth, [Optional] int nHeight, [Optional] HWND hWndParent, [Optional] HMENU hMenu, + [Optional] HINSTANCE hInstance, [Optional] IntPtr lpParam); /// /// @@ -7830,6 +7832,126 @@ namespace Vanara.PInvoke public MessageFilterInformation ExtStatus; } + /// + /// Defines the initialization parameters passed to the window procedure of an application. These members are identical to the + /// parameters of the CreateWindowEx function. + /// + /// + /// + /// Because the lpszClass member can contain a pointer to a local (and thus inaccessable) atom, do not obtain the class name + /// by using this member. Use the GetClassName function instead. + /// + /// + /// You should access the data represented by the lpCreateParams member using a pointer that has been declared using the + /// UNALIGNED type, because the pointer may not be DWORD aligned. This is demonstrated in the following example: + /// + /// + /// typedef struct tagMyData { // Define creation data here. } MYDATA; typedef struct tagMyDlgData { SHORT cbExtra; MYDATA myData; } MYDLGDATA, UNALIGNED *PMYDLGDATA; PMYDLGDATA pMyDlgdata = (PMYDLGDATA) (((LPCREATESTRUCT) lParam)->lpCreateParams); + /// + /// + // https://docs.microsoft.com/en-us/windows/win32/api/winuser/ns-winuser-createstructa typedef struct tagCREATESTRUCTA { LPVOID + // lpCreateParams; HINSTANCE hInstance; HMENU hMenu; HWND hwndParent; int cy; int cx; int y; int x; LONG style; LPCSTR lpszName; + // LPCSTR lpszClass; DWORD dwExStyle; } CREATESTRUCTA, *LPCREATESTRUCTA; + [PInvokeData("winuser.h", MSDNShortId = "NS:winuser.tagCREATESTRUCTA")] + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + public struct CREATESTRUCT + { + /// + /// Type: LPVOID + /// + /// Contains additional data which may be used to create the window. If the window is being created as a result of a call to the + /// CreateWindow or CreateWindowEx function, this member contains the value of the lpParam parameter specified in the function call. + /// + /// + /// If the window being created is a MDI client window, this member contains a pointer to a CLIENTCREATESTRUCT structure. If the + /// window being created is a MDI child window, this member contains a pointer to an MDICREATESTRUCT structure. + /// + /// + /// If the window is being created from a dialog template, this member is the address of a SHORT value that specifies the + /// size, in bytes, of the window creation data. The value is immediately followed by the creation data. For more information, + /// see the following Remarks section. + /// + /// + public IntPtr lpCreateParams; + + /// + /// Type: HINSTANCE + /// A handle to the module that owns the new window. + /// + public HINSTANCE hInstance; + + /// + /// Type: HMENU + /// A handle to the menu to be used by the new window. + /// + public HMENU hMenu; + + /// + /// Type: HWND + /// + /// A handle to the parent window, if the window is a child window. If the window is owned, this member identifies the owner + /// window. If the window is not a child or owned window, this member is NULL. + /// + /// + public HWND hwndParent; + + /// + /// Type: int + /// The height of the new window, in pixels. + /// + public int cy; + + /// + /// Type: int + /// The width of the new window, in pixels. + /// + public int cx; + + /// + /// Type: int + /// + /// The y-coordinate of the upper left corner of the new window. If the new window is a child window, coordinates are relative + /// to the parent window. Otherwise, the coordinates are relative to the screen origin. + /// + /// + public int y; + + /// + /// Type: int + /// + /// The x-coordinate of the upper left corner of the new window. If the new window is a child window, coordinates are relative + /// to the parent window. Otherwise, the coordinates are relative to the screen origin. + /// + /// + public int x; + + /// + /// Type: LONG + /// The style for the new window. For a list of possible values, see Window Styles. + /// + public WindowStyles style; + + /// + /// Type: LPCTSTR + /// The name of the new window. + /// + [MarshalAs(UnmanagedType.LPTStr)] + public string lpszName; + + /// + /// Type: LPCTSTR + /// A pointer to a null-terminated string or an atom that specifies the class name of the new window. + /// + [MarshalAs(UnmanagedType.LPTStr)] + public string lpszClass; + + /// + /// Type: DWORD + /// The extended window style for the new window. For a list of possible values, see Extended Window Styles. + /// + public WindowStylesEx dwExStyle; + } + /// Contains the flash status for a window and the number of times the system should flash the window. // https://docs.microsoft.com/en-us/windows/desktop/api/winuser/ns-winuser-flashwinfo typedef struct { UINT cbSize; HWND hwnd; DWORD // dwFlags; UINT uCount; DWORD dwTimeout; } FLASHWINFO, *PFLASHWINFO;