Discussion:
From C to Delphi...
(too old to reply)
s***@asmr.net
2007-04-07 20:49:52 UTC
Permalink
Hi,

Could somebody translate this code to Delphi please? I got it in an
answer to a problem I was having but the very helpful poster only knew
the C syntax. Can anyone help please?


MINMAXINFO *mmi;

case WM_GETMINMAXINFO:
/* get a pointer to the MINMAXINFO structure that is passed in the
'LParam' */
mmi = (MINMAXINFO *)lParam;

/* set the max size for the window */
mmi->ptMaxSize.x = 123;
mmi->ptMaxSize.y = 456;

return 0;

TIA.

Regards,
Scott
r***@gmail.com
2007-05-26 14:17:27 UTC
Permalink
Post by s***@asmr.net
Hi,
Could somebody translate this code to Delphi please? I got it in an
answer to a problem I was having but the very helpful poster only knew
the C syntax. Can anyone help please?
MINMAXINFO *mmi;
/* get a pointer to the MINMAXINFO structure that is passed in the
'LParam' */
mmi = (MINMAXINFO *)lParam;
/* set the max size for the window */
mmi->ptMaxSize.x = 123;
mmi->ptMaxSize.y = 456;
return 0;
TIA.
Regards,
Scott
var mmi : TMinMaxInfo;

//***case WM_GETMINMAXINFO:*** this is coming from a C case (Switch(x)
case 0: case 1: case n:) so this is like a messages processor.
//In delphi you can receive a specific message by doing a procedure
like this:
// procedure WMGETMINMAXINFO(var Msg : TMessage); message
WM_GETMINMAXINFO;
//
procedure WMGETMINMAXINFO(var Msg : TMessage); message
WM_GETMINMAXINFO;
begin
mmi := TMinMaxInfo(Msg.LParam);
mmi.ptMaxSize.x := 123;
mmi.ptMaxSize.y := 456;

DefWindowProc(Handle,WM_GETMINMAXINFO, Msg.WParam, Msg.LParam);
end;
//this last proc will respond to this message and set those values
then passes the message to windows for normal processing but with the
new values you just set :)

let me know if it works.

Carlos

Loading...