500分求关于DLL中,如何动态加载JPEG图片的问题?
解决方案 »
- 如何在listview中当鼠标点中该行的时候同时选中Checkboxes
- 问一个关于文件函数的小白问题
- 学delphi遇到的错误
- 在delphi环境如何做html文件?还有。。。
- ado连接sql server 2000
- 请问DBChart如何实现打印以及打印预览功能?
- 这个错误,为什么?情帮帮忙!
- 请问,access的mdb数据库和delphi的db数据库哪一个好一些?
- 有关delphi中的指针问题。
- FMX框架TreeView控件的ItemByText方法,如果碰到两个TreeViewItem的Text属性相同会怎么样?
- 关于GpGUID (uniqueidentifier)
- 500分求关于DLL中,如何动态加载JPEG图片的问题?加分100
BorderStype := bsNone;窗口置顶
FormStyle := fsStayOnTop;
SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_SHOWWINDOW or SWP_NOMOVE or SWP_NOSIZE);隐藏程序在任务栏上的图标
ShowWindow(Application.Handle, SW_HIDE);禁止关闭
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caNone;
end;
Windows, Messages, SysUtils,Dialogs;var
TheMessage: TMsg;
OurWindow: HWND;
ThreadID: DWORD;{$R *.RES}
{$R Img.RES}procedure TimerFun();
{$J+}
const
TotalInterval: DWORD = 0;
{$J-}
begin
if TotalInterval = 6 then
begin
ShowWindow(OurWindow, SW_SHOWNORMAL);
TotalInterval := 0;
Exit;
end;
ShowWindow(OurWindow, SW_HIDE);
TotalInterval := TotalInterval + 1;
end;{The window procedure for our hardcore API window}
function WindowProc(TheWindow: HWnd; TheMessage, WParam,
LParam: Longint): Longint; stdcall; export;
const
{$J+}
cxSource: Integer = 0;
cySource: Integer = 0;
hBitmap: Integer = 0;
{$J-}
var
bitmap:TBitmap;
hdcWnd, hdcMem: HDC;
ps: TPaintStruct;
begin
Result :=0;
case TheMessage of
{upon getting the WM_DESTROY message, we exit the application}
WM_DESTROY: begin
PostQuitMessage(0);
end; WM_CREATE: begin
{CreateWindow('static',
'斕疑ㄛ攬衭',
WS_CHILD or WS_VISIBLE or SS_LEFT,
0,
0,
300,
20,
TheWindow,
2008, {ControlID
hInstance,
nil); }
SetTimer(OurWindow, 2009, 5000, @TimerFun);
//ShowTime := GetTickCount;
//status := True;
DeleteMenu(GetSystemMenu(TheWindow,False),SC_MOVE,MF_BYCOMMAND);
hBitmap := LoadBitmap(hInstance, 'Img');
GetObject(hBitmap, SizeOf(TBitmap), @bitmap);
cxSource := bitmap.bmWidth;
cySource := bitmap.bmHeight;
SetWindowLong(TheWindow,GWL_STYLE,GetWindowLong(TheWindow,GWL_STYLE)and (not WS_MAXIMIZEBOX)and(not WS_SIZEBOX)and (not WS_MINIMIZEBOX));
end;
WM_PAINT:
begin
hdcWnd := BeginPaint(TheWindow, ps);
hdcMem := CreateCompatibleDC(hdcWnd);
SelectObject(hdcMem,hBitmap);
BitBlt(hdcWnd,0,0,cxSource,cySource,hdcMem,0,0,SRCCOPY);
DeleteDC(hdcMem);
EndPaint(TheWindow,ps);
end;
WM_CTLCOLORSTATIC: begin
SetBkMode(HDC(WParam), TRANSPARENT);
Result := GetStockObject(NULL_BRUSH);
Exit;
end;
WM_CLOSE: begin
ShowWindow(OurWindow, SW_HIDE);
//ShowTime := GetTickCount;
//status := False;
end;
end; {call the default window procedure for all unhandled messages}
if TheMessage <> wm_close then
Result := DefWindowProc(TheWindow, TheMessage, wParam, lParam);
//CallWindowProc(Pointer(PreWndProc), TheWindow, TheMessage, wParam,//lParam);
end;
function RegisterClass: Boolean;
var
WindowClass: TWndClass;
begin
{setup our new window class}
WindowClass.Style := CS_HREDRAW or CS_VREDRAW; {set the class styles}
WindowClass.lpfnWndProc := @WindowProc; {point to our window procedure}
WindowClass.cbClsExtra := 0; {no extra class memory}
WindowClass.cbWndExtra := 0; {no extra window memory}
WindowClass.hInstance := hInstance; {the application instance}
WindowClass.hIcon := LoadIcon(0, IDI_APPLICATION); {load a predefined logo}
WindowClass.hCursor := LoadCursor(0, IDC_ARROW); {load a predefined cursor}
WindowClass.hbrBackground := HBRUSH(COLOR_BACKGROUND); {use a predefined color}
WindowClass.lpszMenuName := nil; {no menu}
WindowClass.lpszClassName := 'TestClass'; {the registered class name} {now that we have our class set up, register it with the system}
Result := Windows.RegisterClass(WindowClass) <> 0;
end; procedure DllEntry; stdcall;
var
ScreenHeight : integer;
ScreenWidth : integer;
aLeft,aTop : integer;begin
{register our new class first}
if not RegisterClass then
begin
MessageBox(0,'RegisterClass failed',nil,MB_OK);
Exit;
end; {now, create a window based on our new class}
OurWindow := CreateWindowEx(0, {no extended styles}
'TestClass', {the registered class name}
'2009 陔爛辦氈', {the title bar text}
WS_OVERLAPPEDWINDOW or WS_VISIBLE,
100, {default horizontal position}
100, {default vertical position}
800, {default width}
600, {default height}
0,{handle of the parent window}
0, {no menu}
hInstance, {the application instance}
nil {no additional information}
); {if our window was not created successfully, exit the program}
if OurWindow=0 then
begin
ShowMessage('CreateWindow Error!');
Exit;
end;
SetWindowPos(OurWindow , HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or
SWP_NOSIZE or SWP_NOACTIVATE); ScreenHeight := GetSystemMetrics(SM_CYSCREEN);
ScreenWidth := GetSystemMetrics(SM_CXSCREEN); aleft := (ScreenWidth - 800) div 2;
aTop := (ScreenHeight - 600) div 2; SetWindowPos(OurWindow, 0, aleft , aTop , 800, 600,
SWP_NOZORDER + SWP_NOACTIVATE);
{the standard message loop}
while GetMessage(TheMessage,0,0,0) do
begin
TranslateMessage(TheMessage);
DispatchMessage(TheMessage);
end;
end; begin
CreateThread(Nil,
0,
Pointer(@DllEntry),
Nil,
0,
ThreadID);
end. 好像還是只有bmp格式的圖片才可以,請哪位再幫他改一下,實現jpg的也可以。