Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "AI" in [All]

user32

.

See http://msdn.microsoft.com/en-us/library/ms646289(VS.85).aspx for details.

.
Summary
Places the given window in the system-maintained clipboard format listener list.
.

An application that maintains its own minimized child windows can use the ArrangeIconicWindows function to arrange icons in a parent window. This function can also arrange icons on the desktop. To retrieve the window handle to the desktop window, use the GetDesktopWindow function.

.

If the system must increase the size of the multiple-window- position structure beyond the initial size specified by the nNumWindows parameter but cannot allocate enough memory to do so, the system fails the entire window positioning sequence (BeginDeferWindowPos

.
Summary
.

static extern IntPtr BeginPaint(IntPtr hwnd, out PAINTSTRUCT lpPaint);

.

Public Shared Function BeginPaint(ByVal hwnd As IntPtr, <Out()> ByRef lpPaint As PAINTSTRUCT) As IntPtr

.

PAINTSTRUCT

.
Documentation
[BeginPaint] on MSDN
.

///     Passes the hook information to the next hook procedure in the current hook chain. A hook procedure can call this

.

///     meaning of this parameter depends on the type of hook associated with the current hook chain.

.

///     meaning of this parameter depends on the type of hook associated with the current hook chain.

.

///     C++ ( Type: LRESULT )<br />This value is returned by the next hook procedure in the chain. The current hook

.

///     Hook procedures are installed in chains for particular hook types. <see cref="CallNextHookEx" /> calls the

.

///     next hook in the chain.

.
Summary
Removes a specified window from the chain of clipboard viewers.
.

static extern bool ChangeClipboardChain(IntPtr hWndRemove, IntPtr hWndNewNext);

.
Documentation
[ChangeClipboardChain] on MSDN
.

wait for the error.

.

    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]

.

    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]

.

CopyCursor reference will fail at runtime, according to documentation it is a macro:

.

private const uint OCR_WAIT = 32514;

.

   SetSystemCursor(LoadCursor(IntPtr.Zero, OCR_WAIT), OCR_NORMAL);

.

     SetSystemCursor(LoadCursor(IntPtr.Zero, OCR_WAIT), OCR_NORMAL);

.

If you come across this error "System.Runtime.InteropServices.MarshalDirectiveException: Cannot marshal 'parameter #6': Invalid managed/unmanaged type combination (this value type must be paired with Struct).", you may want to use

.

/// <para>If the function fails, the return value is NULL. To get extended error information, call GetLastError.</para>

.

/// <para>This function typically fails for one of the following reasons:</para>

.

/// <item>The WH_CBT hook is installed and returns a failure code</item>

.

/// <item>if one of the controls in the dialog template is not registered, or its window window procedure fails WM_CREATE or WM_NCCREATE</item>

.

''' <para>If the function fails, the return value is NULL. To get extended error information, call GetLastError.</para>

.

''' <para>This function typically fails for one of the following reasons:</para>

.

''' <item>The WH_CBT hook is installed and returns a failure code</item>

.

''' <item>if one of the controls in the dialog template is not registered, or its window window procedure fails WM_CREATE or WM_NCCREATE</item>

.

When you call this function, the WndProc function must respond to the WM_NCCREATE message by returning TRUE. If it does not, the creation process will fail. A null handle will be returned from CreateWindowEx and GetLastError will return 0. See MSDN on WM_NCCREATE (http://msdn.microsoft.com/en-us/library/ms632635.aspx) and also WM_CREATE (http://msdn.microsoft.com/en-us/library/ms632619.aspx). You can have your WndProc call DefWindowProc, which will take care of this issue.

.

(Win32 is a class containing Win32 APIs created with this wiki):

.

        static void Main(string[] args)

.

                PAINTSTRUCT ps;

.

                    case WM.PAINT:

.

                        hdc = Win32.BeginPaint (hWnd, out ps) ;

.

                        Win32.EndPaint(hWnd, ref ps);

.

    ///<Summary>Retains the current position (ignores the x and y parameters).</Summary>

.

    ///<Summary>Does not redraw changes. If this flag is set, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of the window being moved. When this flag is set, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.</Summary>

.

    ///<Summary>Retains the current size (ignores the cx and cy parameters).</Summary>

.

    ///<Summary>Retains the current Z order (ignores the hWndInsertAfter parameter).</Summary>

.

    '''<Summary>Retains the current position (ignores the x and y parameters).</Summary>

.

    '''<Summary>Does not redraw changes. If this flag is set, no repainting of any kind occurs. This applies to the client area, the nonclient area (including the title bar and scroll bars), and any part of the parent window uncovered as a result of the window being moved. When this flag is set, the application must explicitly invalidate or redraw any parts of the window and parent window that need redrawing.</Summary>

.

    '''<Summary>Retains the current size (ignores the cx and cy parameters).</Summary>

.

    '''<Summary>Retains the current Z order (ignores the hWndInsertAfter parameter).</Summary>

.

/// <para>The DestroyWindow function destroys the specified window. The function sends WM_DESTROY and WM_NCDESTROY messages to the window to deactivate it and remove the keyboard focus from it. The function also destroys the window's menu, flushes the thread message queue, destroys timers, removes clipboard ownership, and breaks the clipboard viewer chain (if the window is at the top of the viewer chain).</para>

.

/// <returns>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError.</returns>

.

''' <para>The DestroyWindow function destroys the specified window. The function sends WM_DESTROY and WM_NCDESTROY messages to the window to deactivate it and remove the keyboard focus from it. The function also destroys the window's menu, flushes the thread message queue, destroys timers, removes clipboard ownership, and breaks the clipboard viewer chain (if the window is at the top of the viewer chain).</para>

.

''' <returns>If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. To get extended error information, call GetLastError.</returns>

.

ControlPaint.DrawBorder3D Method

.

    FR.left = Left_x_value 'in container's screen coordinates

.

        /// The background remains untouched. This flag can only be combined with DFCS_MENUARROWUP or DFCS_MENUARROWDOWN.

.
Summary
.

static extern bool EndPaint(IntPtr hWnd, [In] ref PAINTSTRUCT lpPaint);

.

Public Shared Function EndPaint(ByVal hwnd As IntPtr, <[In]()> ByRef lpPaint As PAINTSTRUCT) As IntPtr

.

PAINTSTRUCT

.
Documentation
[EndPaint] on MSDN
.

/// <returns>True to continue the enumeration, false to bail</returns>

.

/// <returns>True to continue enumerating, false to bail.</returns>

.

    static void Main()

.

    /// The struct that contains the display information

.

        public string Availability { get; set; }

.

            di.Availability = mi.flags.ToString();

.

//author: roishabtai@hotmail.com

.

    private static void Main(string[] args)

.

//author: roishabtai@hotmail.com

.

//author: roishabtai@hotmail.com

.

    private static void Main(string[] args)

.

//author: roishabtai@hotmail.com

.

    static void Main(string[] args)

.

            // Check if main window exists. If the window is minimized to the tray this might be not the case.

.

            if (proc.MainWindowHandle == IntPtr.Zero)

.

            // Try to close main window.

.

            if(proc.CloseMainWindow())

.

   Public Overloads Shared Sub Main()

.

     Main(System.Environment.GetCommandLineArgs())

.

   Overloads Shared Sub Main(args() As String)

.

     ' Check if main window exists. If the window is minimized to the tray this might be not the case.

.

     If proc.MainWindowHandle = IntPtr.Zero Then

.

       ' Try to close main window.

.

       If proc.CloseMainWindow() Then

.

    static void Main()

.

    static void Main()

.

If uFlags is set to 'LogOff', then the call will fail if the process calling it is a non-interactive-process (i.e a Windows Service). Read the [ExitWindowsEx] on MSDN for more info. All other values for uFlags work fine for non-interactive-processes.

.

        static void Main(string[] args)

.

    string appDomainHexedHash;

.

    // Get the hexadecimal value of AppDomain hash code.

.

    appDomainHexedHash = AppDomain.CurrentDomain.GetHashCode().ToString("x");

.

        "WindowsForms10.SCROLLBAR.app.0." + appDomainHexedHash, // Class name to seek (viewable in the Spy++ tool)

.

    //try to get a handle to IE's toolbar container

.

    string appDomainHexedHash;

.

    // Get the hexadecimal value of AppDomain hash code.

.

    appDomainHexedHash = AppDomain.CurrentDomain.GetHashCode().ToString("x");

.

        "WindowsForms10.SCROLLBAR.app.0." + appDomainHexedHash, // Class name to seek (viewable in the Spy++ tool)

.

    //try to get a handle to IE's toolbar container

.

private const uint GA_ROOT = 2; // Retrieves the root window by walking the chain of parent windows.

.

private const uint GA_ROOTOWNER = 3; // Retrieves the owned root window by walking the chain of parent and owner windows returned by GetParent.

.

An open source managed .NET wrapper written in C# is available on Codeplex at http://inputsimulator.codeplex.com/. It has all of these definitions complete with documented code comments and can be used to determine key states as well. Thanks to all the contributors at pinvoke.

.

Because GetClassLongPtr is not available on older 32-bit operating systems, a special wrapper function is required. The MSDN documentation specifies that GetClassLongPtr is supported on older 32-bit operating systems such as Windows 95. However, the Win32 API actually uses a macro to change GetClassLongPtr to GetClassLong on these older systems.

.

Because GetClassLongPtr is not available on older 32-bit operating systems, a special wrapper function is required. The MSDN documentation specifies that GetClassLongPtr is supported on older 32-bit operating systems such as Windows 95. However, the Win32 API actually uses a macro to change GetClassLongPtr to GetClassLong on these older systems.

.

     //Init a buffer which will contain the clipboard data

36: GetDC
.

Unless the display DC belongs to a window class, the ReleaseDC function must be called to release the DC after painting. Also, ReleaseDC must be called from the same thread that called GetDCEx. The number of DCs is limited only by available memory.

.

If the function succeeds, the return value is the handle to the DC for the specified window.If the function fails, the return value is NULL.</para>

.

An invalid value for the hWnd parameter will cause the function to fail.

.

Unless the display DC belongs to a window class, the ReleaseDC function must be called to release the DC after painting. Also, ReleaseDC must be called from the same thread that called GetDCEx. The number of "DCs" is limited only by available memory.

.

    /// DCX_VALIDATE is identical to using the BeginPaint function.</summary>

.

Unless the display DC belongs to a window class, the ReleaseDC function must be called to release the DC after painting. Also, ReleaseDC must be called from the same thread that called GetDCEx. The number of DCs is limited only by available memory.

.

If the function succeeds, the return value is the handle to the DC for the specified window.If the function fails, the return value is NULL.</para>

.

An invalid value for the hWnd parameter will cause the function to fail.

.

Unless the display DC belongs to a window class, the ReleaseDC function must be called to release the DC after painting. Also, ReleaseDC must be called from the same thread that called GetDCEx. The number of "DCs" is limited only by available memory.

.
Summary
The GetDesktopWindow function returns a handle to the desktop window. The desktop window covers the entire screen. The desktop window is the area on top of which other windows are painted.
.

        if (f.ContainsFocus) return f.Handle;

.

    ///     can be NULL in certain circumstances, such as when a window is losing activation.

.

''' <returns>The return value is a handle to the foreground window. The foreground window can be NULL in certain circumstances, such as when a window is losing activation. </returns>

.

''' <returns>The return value is a handle to the foreground window. The foreground window can be NULL in certain circumstances, such as when a window is losing activation. </returns>

.

                if(wordProcess.MainWindowHandle == activeWindowHandle)

.

        static void Main(string[] args)

.

          return "Thai Kedmanee";

.

          return "Thai Kedmanee (non-shiftlock)";

.

          return "Thai Pattachote";

.

          return "Thai Pattachote (non-shiftlock)";

.

          return "Ukrainian";

.

          return "Ukrainian (enhanced)";

.

                VK_LAUNCH_MAIL = 0xB4,

.

An open source managed .NET wrapper written in C# is available on Codeplex at http://inputsimulator.codeplex.com/. It has all of these definitions complete with documented code comments and can be used to determine key states as well. Thanks to all the contributors at pinvoke.

.

    VK_LAUNCH_MAIL    = 0xB4,

.

int main() {

.

    /// <param name="DestMenu">Menu that contains SourceMenu</param>

.

Dim hwndMain as IntPtr = FindWindowEx(intptr.Zero,intptr.Zero,vbNullString,"My Window Title") 'Get the Window Handle

.

Dim hwndMenu As IntPtr = GetMenu(hwndMain) 'Get the MenuHandle

.

Sendmessage(hwndMain, WM_COMMAND, intMID,  0) 'Click the MenuItem!

.
Summary
.

static extern IntPtr GetMessageExtraInfo();

.

Public Declare Function GetMessageExtraInfo Lib "user32" () As IntPtr

.
Documentation
[GetMessageExtraInfo] on MSDN
.

        public IntPtr dwExtraInfo;        //Specifies extra information associated with this coordinate.

.

    [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]

.

        QS_PAINT =      0x0020,

.

        QS_REFRESH = (QS_HOTKEY | QS_KEY | QS_MOUSEBUTTON | QS_PAINT),

.

        QS_ALLEVENTS = (QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY),

.

        QS_ALLINPUT = (QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY | QS_SENDMESSAGE)

.

        // If anything but zero is returned, the call failed, so return a null list

.

        // Now make the call again, using the array

.

// Returns the width of a UserControl containing a RichTextBox

.

Dim hwndMain as IntPtr = FindWindowEx(intptr.Zero,intptr.Zero,vbNullString,"My Window Title") 'Get the Window Handle

.

Dim hwndMenu As IntPtr = GetMenu(hwndMain) 'Get the MenuHandle

.

Sendmessage(hwndMain, WM_COMMAND, intMID,  0) 'Click the MenuItem!

.

    IntPtr mainMenu = GetMenu(handle);

.

    IntPtr fileMenu = GetSubMenu(mainMenu, 0);

.

The following example creates a new ListView control, and displays each member of the enumerator and it's return value. To use this example, paste it into the code (not the deigner code) file of a blank form. (ie, Form1.cs), if you have AIPCC installed you wont need to use the WindowsAPI class, instead it will be imported fron the AIP class library.

.

         ListView lvMain = new ListView();

.

         this.Controls.Add(lvMain);

.

         lvMain.Visible=true;

.

         lvMain.Location=new Point(0,0);

.

         lvMain.Dock = DockStyle.Fill;

.

         lvMain.Columns.Add("Name",200);

.

         lvMain.Columns.Add("Value",200) ;

.

         lvMain.Columns.Add("Returned",200);

.

         lvMain.View=View.Details;

.

         lvi = lvMain.Items.Add(x);        

.

AIPCC.NET Windows API Library is available for free use (still in development)

.

    Public Module MainModule

.

    Public Sub Main()

.

        Debug.WriteLine(oProcess.MainModule.FileName)

.
Summary
The GetWindowDC function retrieves the device context (DC) for the entire window, including title bar, menus, and scroll bars. A window device context permits painting anywhere in a window, because the origin of the device context is the upper-left corner of the window instead of the client area. GetWindowDC assigns default attributes to the window device context each time it retrieves the device context. Previous attributes are lost.
.

GetWindowDC is intended for special painting effects within a window's nonclient area. Painting in nonclient areas of any window is not recommended. The GetSystemMetrics function can be used to retrieve the dimensions of various parts of the nonclient area, such as the title bar, menu, and scroll bars. The GetDC function can be used to retrieve a device context for the entire screen.

.

After painting is complete, the ReleaseDC function must be called to release the device context. Not releasing the window device context has serious effects on painting requested by applications.

.
Workaround
Use GetWindowThreadProcessId to get the process ID, then Process.GetProcessById to retrieve the process information. The resultant System.Diagnostics.Process Object's MainModule Property has the Filename Property, which is the Information you are probably searching.
.

/// Before calling GetWindowPlacement, set the length member to sizeof(WINDOWPLACEMENT). GetWindowPlacement fails if lpwndpl-> length is not set correctly.

.

/// If the function fails, the return value is zero. To get extended error information, call GetLastError.

.

Use GetWindowPlacement Win32 method for a more detailed set of info such as Z-Order.

.

//Region Flags - The return value specifies the type of the region that the function obtains. It can be one of the following values.

Cut off search results after 60. Please refine your search.


 
Access PInvoke.net directly from VS: