Mega Code Archive

 
Categories / Delphi / System
 

How to make a Wnd with RAW API

Title: How to make a Wnd with RAW API Question: How to make a Wnd with RAW API Answer: { WndCreator written by Simone Di Cicco - Italy mail: simone.dicicco@tin.it site: http://www.devresource.net with the RAW API, you can develop applications without the VCL, this idea is also called XCL } const AppName = 'WndApp'; function WndProc(HWnd: HWND; Msg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; begin case Msg of WM_DESTROY: begin PostQuitMessage(0); Result := 0; end else Result := DefWindowProc(HWnd,Msg,WParam,LParam); end; end; var WndClass: TWndClass; Handle: HWND; Msg: TMsg; Result: Integer; begin with WndClass do begin style := CS_VREDRAW or CS_HREDRAW; lpfnWndProc := @WndProc; cbClsExtra := 0; cbWndExtra := 0; hInstance := SysInit.HInstance; hIcon := LoadIcon(HInstance,IDI_APPLICATION); hCursor := LoadCursor(HInstance,IDC_ARROW); hbrBackground := GetStockObject(LTGRAY_BRUSH); lpszMenuName := nil; lpszClassName:= AppName; end; RegisterClass(WndClass); Handle := CreateWindow(AppName,'RAW API WND, Smile :)', WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,CW_USEDEFAULT, CW_USEDEFAULT,CW_USEDEFAULT, 0,0,HInstance,nil); ShowWindow(Handle,SW_NORMAL); UpdateWindow(Handle); while GetMessage(Msg,0,0,0) do begin TranslateMessage(Msg); DispatchMessage(Msg); end; end.