PDA

Ver la Versión Completa : [SOLUCIONADO] MessageBoxTimeout No me muestra los mensajes completos


Soa Pelaez
02-08-2017, 18:42:40
Encontré el siguiente código en los foros y quice implementarlo en mi proyecto para tener un mensaje que se cierre durante un lapso de tiempo.
Al ejecutarlo el mensaje y el título de la ventan solo me muestra la primer letra y el resto de mensaje no, podrían ayudarme a que se muestre todo el texto del título del mensaje y su contenido.
Muchas gracias.

El código es el siguiente.


private
{ Private declarations }
public
{ Public declarations }
end;

const
MB_TIMEDOUT = 32000;

function MessageBoxTimeOut(hWnd: HWND; lpText: PChar; lpCaption: PChar;
uType: UINT; wLanguageId: WORD; dwMilliseconds: DWORD): Integer; stdcall;

function MessageBoxTimeOutA(hWnd: HWND; lpText: PChar; lpCaption: PChar;
uType: UINT; wLanguageId: WORD; dwMilliseconds: DWORD): Integer; stdcall;

function MessageBoxTimeOutW(hWnd: HWND; lpText: PWideChar; lpCaption: PWideChar;
uType: UINT; wLanguageId: WORD; dwMilliseconds: DWORD): Integer; stdcall;

var
Form1: TForm1;

implementation

{$R *.dfm}

function MessageBoxTimeOut; external user32 name 'MessageBoxTimeoutA';
function MessageBoxTimeOutA; external user32 name 'MessageBoxTimeoutA';
function MessageBoxTimeOutW; external user32 name 'MessageBoxTimeoutW';


procedure TForm1.Button1Click(Sender: TObject);
begin
case MessageBoxTimeout(Handle,
'This box will close after 5 seconds.',
'Testing',
MB_SETFOREGROUND OR MB_SYSTEMMODAL OR
MB_ICONINFORMATION OR MB_OKCANCEL,
0,
5000) of
IDOK : ShowMessage('Ok');
IDCANCEL : ShowMessage('Canceled');
MB_TIMEDOUT: ShowMessage('TimedOut');
end;
end

Soa Pelaez
02-08-2017, 18:45:03
Encontré el siguiente código en los foros y quice implementarlo en mi proyecto para tener un mensaje que se cierre durante un lapso de tiempo.
Al ejecutarlo el mensaje y el título de la ventan solo me muestra la primer letra y el resto de mensaje no, podrían ayudarme a que se muestre todo el texto del título del mensaje y su contenido.
Muchas gracias.

El código es el siguiente.


private
{ Private declarations }
public
{ Public declarations }
end;

const
MB_TIMEDOUT = 32000;

function MessageBoxTimeOut(hWnd: HWND; lpText: PChar; lpCaption: PChar;
uType: UINT; wLanguageId: WORD; dwMilliseconds: DWORD): Integer; stdcall;

function MessageBoxTimeOutA(hWnd: HWND; lpText: PChar; lpCaption: PChar;
uType: UINT; wLanguageId: WORD; dwMilliseconds: DWORD): Integer; stdcall;

function MessageBoxTimeOutW(hWnd: HWND; lpText: PWideChar; lpCaption: PWideChar;
uType: UINT; wLanguageId: WORD; dwMilliseconds: DWORD): Integer; stdcall;

var
Form1: TForm1;

implementation

{$R *.dfm}

function MessageBoxTimeOut; external user32 name 'MessageBoxTimeoutA';
function MessageBoxTimeOutA; external user32 name 'MessageBoxTimeoutA';
function MessageBoxTimeOutW; external user32 name 'MessageBoxTimeoutW';


procedure TForm1.Button1Click(Sender: TObject);
begin
case MessageBoxTimeout(Handle,
'This box will close after 5 seconds.',
'Testing',
MB_SETFOREGROUND OR MB_SYSTEMMODAL OR
MB_ICONINFORMATION OR MB_OKCANCEL,
0,
5000) of
IDOK : ShowMessage('Ok');
IDCANCEL : ShowMessage('Canceled');
MB_TIMEDOUT: ShowMessage('TimedOut');
end;
end


Ya encontre el problema en el click del botón debo usar MessageBoxTimeoutW igual ahi queda por si alguien lo necesita muchas gracias.

MAXIUM
02-08-2017, 19:11:12
Gracias por el aporte. Es importante dar la solución si es encontrada por si mismo si no se logra responder la pregunta.