.
In Depth Banner
Skip Navigation Links

Select your preferred language

Windows methods

 

using System;

using System.Runtime.InteropServices;

using xRay.Toolkit.Win32Defs;

 

namespace xRay.Toolkit.Utilities.Win32

{

  /// <summary>

  /// Summary description for Win32.

  /// </summary>

  public class Win32Methods

  {

 

    [DllImport("User32.dll")]

      public static extern int ReleaseDC(IntPtr hWnd, IntPtr dc);

   

      [DllImport("User32.dll")]

      public static extern IntPtr GetWindowDC(IntPtr hWnd);

   

      [DllImport("User32.dll")]

      public static extern int GetWindowRect(IntPtr hWnd, ref RECT rect);

 

    [DllImport("User32.dll")]

    public static extern int GetWindowLong(IntPtr handle, int item);

 

    [DllImport("User32.dll")]

    public static extern int SetWindowLong(IntPtr handle, int item, int style);

 

    [DllImport("User32.dll")]

    public static extern int SendMessage(System.IntPtr hWnd,

      int Msg,

      int wParam,

      System.IntPtr lParam);

 

    [DllImport("User32.dll")]

    public static extern int GetScrollInfo(IntPtr hWnd, SBDefs bar, IntPtr inf);

 

    [DllImport("User32.dll")]

    public static extern int SetScrollPos(IntPtr hWnd, SBDefs nBar, int nPos, bool bRedraw);

 

    [DllImport("User32.dll")]

    public static extern IntPtr GetDlgItem(IntPtr hWnd, int item);

 

    [DllImport("User32.dll")]

    public static extern int GetUpdateRect(IntPtr hWnd,ref RECT rc, bool bErase);

 

    [DllImport("User32.dll")]

    public static extern IntPtr BeginPaint(IntPtr p, ref PAINTSTRUCT ps);

 

    [DllImport("User32.dll")]

    public static extern int EndPaint(IntPtr p, ref PAINTSTRUCT ps);

 

    [DllImport("User32.dll")]

    public static extern int AnimateWindow(IntPtr hWnd, int time, int flags);

 

    [DllImport("User32.dll")]

    public static extern int SetLayeredWindowAttributes(IntPtr hWnd, COLORREF clrKey, byte bAlpha, int dwFlags);

 

      [DllImport("User32.dll")]

      public extern static int ShowWindow( System.IntPtr hWnd, short cmdShow);

 

      [DllImport("User32.dll")]

    public static extern int RedrawWindow(IntPtr hWnd,               // handle to window

      IntPtr rcUpd,  // update rectangle

      IntPtr hrgnUpdate,         // handle to update region

      int flags               // array of redraw flags

      );

 

      [DllImport("User32.dll")]

    public static extern int TrackMouseEvent(

      IntPtr lpEventTrack

      );

 

  }

 

  public class Win32Helper

  {

    public static int MAKELONG(int hiword, int loword)

    {

      return (hiword<<16) + loword;

    }

  }

 

}

 

Return to the article

Copyright © Bob Powell 2000-.  All rights reserved.