1.Create new blank application.
2.Remove Form1 from project
3.Open project file for editing
4.Delete all lines. (Warning! You must proviude at less 1 unit in unit declaration)
program window;
uses
windows,messages;
var
wclass: twndclass;
inst,handle: hwnd;
msg: tmsg;
function windowproc(hwn,msg,wpr,lpr:longint):longint;stdcall; //our custom windowproc
begin
result := defwindowproc(hwn,msg,wpr,lpr); //pass msg to default windows procedure (i.e. drawing frames etc)
case msg of
wm_destroy: Halt;
end;
end;
//
// Main Procedure
//
begin
inst := getmodulehandle(nil); //get application instance
with wclass do //create class properties
begin
style := CS_CLASSDC or CS_PARENTDC;
lpfnwndproc := @windowproc; //Custom window procedure
hinstance := inst;
hbrbackground := color_btnface+1;
lpszclassname := 'RAYCLASS'; //Name of our class
hcursor := loadcursor(0,IDC_ARROW);
wclass.hbrBackground := COLOR_BTNSHADOW;
wclass.hIcon := LoadIcon(0,IDI_APPLICATION); //Loading default icon file
end;
registerclass(wclass); //this class is automatically unregistered on termination.
//create our main window
handle := createwindowex(
WS_EX_WINDOWEDGE,
'RAYCLASS',
'Ray Adams Test Programm',
WS_TILEDWINDOW+WS_VISIBLE,10,10,400,300,0,0,inst,nil);
updatewindow(handle); {draws all the windows at once avoiding that build-up look}
// getmessage loop prevents the application from pre-termination
while (getmessage(msg,handle,0,0)) do
begin
translatemessage(msg);
dispatchmessage(msg);
end;
end. |
|