Conversión de código

26/08/2004 - 09:10 por Daniel Iglesias Santamaria | Informe spam
Hola, estoy intentando utilizar esta función en C#..
[ DllImport ( "user32.dll" )] public extern static int SendMessageA ( int
hWnd , int wMsg , short wParam , int lParam );

Para una de las opciones, la de abajo, necesito como último parametro el
nombre de un fichero, pero solo se me admite un int. El código siguiente es
en otro lenguaje de programación. ¿Me podría decir alguien como puedo
pasarlo a C#?

SendMessage(hWndC,
WM_CAP_SAVEDIB,
0,
longint(pchar(SaveDialog1.FileName)));

Muchas gracias:

Daniel Iglesias
 

Leer las respuestas

#1 José Miguel Torres
26/08/2004 - 09:29 | Informe spam
Buenas, prueba:
[DllImport("user32.dll", CharSet=CharSet.Auto)]
static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam,
IntPtr lParam);

y para llamar

public static String GetWindowText(IntPtr hWnd)
{
IntPtr txtLength;
IntPtr retValue;
IntPtr zeroVal = new IntPtr(0);


//Get the length of the text
retValue = SendMessage(hWnd,WM_GETTEXTLENGTH,zeroVal,zeroVal);


//Setup the size of the sb
txtLength = retValue;
StringBuilder sb = new StringBuilder(txtLength.ToInt32() + 1);


//Get the text of the window/control
retValue = SendMessage(hWnd,WM_GETTEXT,txtLength,sb);


//Return a string
return sb.ToString();
}


saludos

José Miguel Torres
jtorres_diaz~~ARROBA~~terra.es
http://jmtorres.blogspot.com

"Daniel Iglesias Santamaria" escribió en el mensaje
news:
Hola, estoy intentando utilizar esta función en C#..
[ DllImport ( "user32.dll" )] public extern static int SendMessageA ( int
hWnd , int wMsg , short wParam , int lParam );

Para una de las opciones, la de abajo, necesito como último parametro el
nombre de un fichero, pero solo se me admite un int. El código siguiente


es
en otro lenguaje de programación. ¿Me podría decir alguien como puedo
pasarlo a C#?

SendMessage(hWndC,
WM_CAP_SAVEDIB,
0,
longint(pchar(SaveDialog1.FileName)));

Muchas gracias:

Daniel Iglesias


Preguntas similares