Ver Mensaje Individual
  #3 (permalink)  
Antiguo 19/05/2010, 07:22
Avatar de dmassive
dmassive
 
Fecha de Ingreso: febrero-2002
Ubicación: Paraná - Entre Ríos - Argentina
Mensajes: 279
Antigüedad: 22 años, 2 meses
Puntos: 7
De acuerdo Respuesta: C# Namespace Win32 Constantes WM_PAINT WM_HSCROLL WM_VSCROLL DLL user32.dl

Si, probe varios y no funciona, pero encontre una clase que importa el user32.dll e implementa esas constantes Win32.

Si a alguien le interesa dejo el codigo de la clase completa con los datos de su autor:
Código C#:
Ver original
  1. using System;
  2. using System.Runtime.InteropServices;
  3. using System.Drawing;
  4.  
  5.  
  6. /// <summary>
  7. /// Win32 support code.
  8. /// (C) 2003 Bob Bradley / [email protected]
  9. /// </summary>
  10. public class win32
  11. {
  12.      
  13.     public const int  WM_MOUSEMOVE      =              0x0200;
  14.     public const int  WM_LBUTTONDOWN     =             0x0201;
  15.     public const int  WM_LBUTTONUP       =             0x0202;
  16.     public const int  WM_RBUTTONDOWN     =             0x0204;
  17.     public const int  WM_LBUTTONDBLCLK   =             0x0203;
  18.  
  19.     public const int  WM_MOUSELEAVE      =             0x02A3;
  20.  
  21.  
  22.    
  23.     public const int WM_PAINT     =                   0x000F;
  24.     public const int WM_ERASEBKGND   =                0x0014;
  25.    
  26.     public const int WM_PRINT         =               0x0317;
  27.  
  28.     //const int EN_HSCROLL       =   0x0601;
  29.     //const int EN_VSCROLL       =   0x0602;
  30.  
  31.     public const int WM_HSCROLL       =              0x0114;
  32.     public const int WM_VSCROLL       =              0x0115;
  33.  
  34.  
  35.     public const int EM_GETSEL              = 0x00B0;
  36.     public const int EM_LINEINDEX           = 0x00BB;
  37.     public const int EM_LINEFROMCHAR        = 0x00C9;
  38.  
  39.     public const int EM_POSFROMCHAR         = 0x00D6;
  40.  
  41.  
  42.  
  43.     [DllImport("USER32.DLL", EntryPoint= "PostMessage")]
  44.     public static extern bool PostMessage(IntPtr hwnd, uint msg,
  45.         IntPtr wParam, IntPtr lParam);
  46.  
  47.     /*
  48.         BOOL PostMessage(          HWND hWnd,
  49.             UINT Msg,
  50.             WPARAM wParam,
  51.             LPARAM lParam
  52.             );
  53.     */
  54.  
  55.     // Put this declaration in your class   //IntPtr
  56.     [DllImport("USER32.DLL", EntryPoint= "SendMessage")]
  57.     public static extern int SendMessage(IntPtr hwnd, int msg, IntPtr wParam,
  58.         IntPtr lParam);
  59.  
  60.  
  61.  
  62.    
  63.     [DllImport("USER32.DLL", EntryPoint= "GetCaretBlinkTime")]
  64.     public static extern uint GetCaretBlinkTime();
  65.  
  66.  
  67.  
  68.  
  69.     const int WM_PRINTCLIENT    = 0x0318;
  70.  
  71.     const long PRF_CHECKVISIBLE=0x00000001L;
  72.     const long PRF_NONCLIENT    = 0x00000002L;
  73.     const long PRF_CLIENT       = 0x00000004L;
  74.     const long PRF_ERASEBKGND   = 0x00000008L;
  75.     const long PRF_CHILDREN = 0x00000010L;
  76.     const long PRF_OWNED        = 0x00000020L;
  77.  
  78.     /*  Will clean this up later doing something like this
  79.     enum  CaptureOptions : long
  80.     {
  81.         PRF_CHECKVISIBLE= 0x00000001L,
  82.         PRF_NONCLIENT   = 0x00000002L,
  83.         PRF_CLIENT      = 0x00000004L,
  84.         PRF_ERASEBKGND  = 0x00000008L,
  85.         PRF_CHILDREN    = 0x00000010L,
  86.         PRF_OWNED       = 0x00000020L
  87.     }
  88.     */
  89.  
  90.  
  91.     public static bool CaptureWindow(System.Windows.Forms.Control control,
  92.                             ref System.Drawing.Bitmap bitmap)
  93.     {
  94.         //This function captures the contents of a window or control
  95.  
  96.         Graphics g2 = Graphics.FromImage(bitmap);
  97.  
  98.         //PRF_CHILDREN // PRF_NONCLIENT
  99.         int meint = (int)(PRF_CLIENT | PRF_ERASEBKGND); //| PRF_OWNED ); //  );
  100.         System.IntPtr meptr = new System.IntPtr(meint);
  101.  
  102.         System.IntPtr hdc = g2.GetHdc();
  103.         win32.SendMessage(control.Handle,win32.WM_PRINT,hdc,meptr);
  104.  
  105.         g2.ReleaseHdc(hdc);
  106.         g2.Dispose();
  107.  
  108.         return true;
  109.        
  110.     }
  111. }
__________________
Blümchen... einfach die rave Prinzessin
http://www.dmassive.com.ar/