Delphi PureAPIWindow program
program PureAPIWindow;
uses
SysUtils,
Windows,
Messages;
const
WinClassName = 'DvsClass';
StrOut = 'Davis TextOut';
//窗口回调函数
function MyWinProc(
hWindow: HWND;
aMessage: UINT;
WParam: WPARAM;
LParam: LPARAM): LRESULT; stdcall; export;
var
dc: HDC;
ps: TPaintStruct;
rect: TRect;
begin
MyWinProc := 0;
case aMessage of
WM_PAINT:
begin
dc := BeginPaint(hWindow,ps);
GetClientRect(hWindow,rect);
DrawText(dc,StrOut,Length(StrOut),rect,DT_SINGLELINE or DT_CENTER or DT_VCENTER);
//TextOut(dc,0,0,StrOut,Length(StrOut));
EndPaint(hWindow,ps);
end;
WM_LBUTTONDOWN:
begin
dc := GetDC(hWindow);//GetDC(0);
TextOut(dc,0,0,'Left Button Down',Length('Left Button Down'));
ReleaseDC(hWindow,dc);
//ReleaseDC(0,dc);
end;
WM_CLOSE:
if ID_YES = MessageBox(0,'Are you sure exit ?','Propmt info',MB_YESNO) then
begin
DestroyWindow(hWindow);
end;
WM_DESTROY:
begin
PostQuitMessage(0);
end;
else
Result := DefWindowProc(hWindow,aMessage,WParam,LParam);
end;
end;
function WinRegister: Boolean;
var
wndClass: TWndClass;
hInstance: Cardinal;
begin
hInstance := GetModuleHandle(0);
//
wndClass.style := CS_VREDRAW or CS_HREDRAW;
wndClass.lpfnWndProc := TFNWndProc(@MyWinProc); //Callback function
wndClass.cbClsExtra := 0;
wndClass.cbWndExtra := 0;
wndClass.hInstance := hInstance;//Same as System.MainInstance; //实例句柄
wndClass.hIcon := LoadIcon(0,IDI_INFORMATION);
wndClass.hCursor := LoadCursor(0,IDC_CROSS);
wndClass.hbrBackground := HBRUSH(GetStockObject(BLACK_BRUSH));
wndClass.lpszMenuName := nil;
wndClass.lpszClassName := WinClassName;
//
Result := Windows.RegisterClass(wndClass) <> 0;
end;
function WinCreate: HWND;
var
hWindow: HWND;
hInstance: Cardinal;
begin
hInstance := GetModuleHandle(0);
hWindow := C
相关文档:
下面三个delphi函数实现了bmp类型图片和jpg(jpeg)类型图片的转换和改变位图图片的大小。
jpg转换为bmp:
{********************************************
作者/日期
描述: 实现jpg(jpeg)图片向bmp图片的转换
参数介绍
FileName:要转换的jpg(jpeg)图片的名称(包括路径)
SaveFileName:转换后的bmp图片的存储位置。
......
unit Servicescontrol;
interface
uses Windows,Messages,SysUtils,Winsvc,Dialogs;
function StartServices(Const SvrName:String):Boolean;
function StopServices(Const SvrName:String):Boolean;
function QueryServiceStatu(Const SvrName:  ......
procedure TForm_BaseMDI.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
Key := #0;
SendMessage(Handle, 48384, 9, 0);
end;
end; ......
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, DB, ADODB,comobj, OleServer,
ExcelXP;
type
TForm1 = class(TForm)
ADOConn: TADOConnection;
& ......
关于IntraWeb程序在编译时出现错误的解决方法
错误提示:[Error] IWLicenseKey.pas(12): Undeclared identifier: 'SetLicenseKey'
处理方法:进入菜单Tools->Environment Options,选择‘Library’,将'Library path'参数中有关intraweb的目录放在前面即可。
使用&n ......