500分求关于DLL中,如何动态加载JPEG图片的问题?
解决方案 »
- delphi7 + windows xp 多线程 动态创建idhttp 异常不能捕捉
- 请教delphi7 ADO问题
- sql语言没有循环语句吧?
- 菜鸟,可用分不够的来~~~
- ★Delphi的控制台程序中有没有方法直接判断按下的按键,就像是TP7.0中的readkey,而不用输入回车键?
- 大虾帮忙!如何将report报表中呈现的内容在excel中显示!
- 数据库的备份和恢复问题
- 各位认为PB和DELPHI在写数据库程序时谁更好一些
- 关于dxdbgrid的使用.
- luxi(西~西)请进来拿分!--->“急,关于报表的,无论高手低手都一律请入,分数陆续会加到600分!分数必分,决不食言!(VB转Delphi者求助!)”(little_hero)
- 请问对于图像中选中的不规则区域处理时,如何让边缘抗锯齿?
- 有关包动态加载错误
begin
BorderStyle := bsnone;
Image1.Align := alClient;
timer1.Enabled := True;
end;procedure TForm1.Timer1Timer(Sender: TObject);
begin
sleep(30000);
timer1.Enabled := False;
self.BorderStyle := bsSizeable;
end;以上是你的部分要求,至于你所谓的动态加载,似乎没有说清楚。是指图片不固定?随机加载图片?还是?
是不是在DLL中显示一个窗体,然后窗体加载一个图片,再然后不能关闭
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的也可以。