如何抓取活动屏幕(50分)

J

jzg2002

Unregistered / Unconfirmed
GUEST, unregistred user!
使用解霸播放vcd时(非全屏),我想抓取屏幕上活动的画面,而不把桌面上的静止图标抓下来
我该如何实现,那位高手帮帮忙.
 
“解霸”本身就有抓屏的功能,在菜单里找一下。
 
同时按ALT+Print试试。
 

你可以用程序的方法实现:

首先获取该窗口的句柄。Gettopwindow();如果中是想把该窗口中
画面的部分抓取,则需要得到它的 DC ,可用getdc();得到。
然后用函数抓取就可以了。bitblt();函数可以复制窗体。
 
指定窗体句柄的话,你想抓啥就抓啥啊,
不过要抓Direct的屏幕要有显卡的支持才行,有的显卡抓出来就是一 片黑
 
我不太清楚怎么得到某个窗体的句柄,请指教
 
你自己试试看吧。

{our callback function prototype}
function EnumerateWindows(hWnd: HWND;
lParam: LPARAM): BOOL;
stdcall;
var
Form1: TForm1;

implementation

procedure TForm1.Button1Click(Sender: TObject);
begin

{empty the listbox that will hold the window names}
ListBox1.Items.Clear;

{enumerate all the top-level windows in the system}
EnumWindows(@EnumerateWindows,0);
end;


{these steps execute for every top-level window in the system}
function EnumerateWindows(hWnd: HWND;
lParam: LPARAM): BOOL;
var
TheText: Array[0..255] of char;
// this holds the window text
begin

{if the windowdo
es not have any text...}
if (GetWindowText(hWnd, TheText, 255)=0) then

{...display the window handle and a note...}
Form1.ListBox1.Items.Add(Format('%d = {This window has no text}',[hWnd]))

else

{otherwise display the window handle and the window text}
Form1.ListBox1.Items.Add(Format('%d = %s',[hWnd,TheText]));

{continue enumeration}
Result:=TRUE;
end;


procedure TForm1.Button1Click(Sender: TObject);
var
FoundWindow: HWND;
WindowText: array[0..255] of char;
begin

{find a TEdit child window}
FoundWindow:=FindWindowEx(Form1.Handle, 0, 'TEdit',nil);

{get its text...}
GetWindowText(FoundWindow, WindowText, 255);

{...and display it}
Label1.Caption:='FindWindowEx found window handle '+IntToStr(FoundWindow)+
': '+WindowText;

end;

 
用findwindow找到解霸的窗口句柄
在找个有canvas的控件
将句柄赋给canvas.handle
在用copyrect复制给有savetofile或savetostream方法的控件
 
接受答案了.
 
顶部