| 关键字 | |
|
小弟前段时间曾做过保证要公开该问题的code(vc,bcb,dephi),刚开始小弟用拷屏的方法可抓下来总是黑呼呼的一片,后来在几位大虾的提示下用vc+directshow实现那该功能。 可这样一来,就必须用directshow来实现播放与初衷不合.从此我就钻进那死胡同,总是想将 directshow与activemove组件,directshow与mediaplay组件结合起来,利用ibasicvideo interface来达到目标。可读遍那与此相关的directsdk的头文件,都没有找那结合的办法(那位大虾实现那,请指点小弟,小弟先谢那!)。一直苦无进展,市面上有关的书都翻遍那。无用!(可见那些所谓的“高级编程技巧”都是狗屁,难度大一点的问题都回避,全是乱抄,tmd骗子),有一天小弟重读the ibasicvideo interface supports the video properties of a generic video window. generally, this is a video renderer that draws video into a window on the display. (msdn),忽然记起在读dephihelp是有一段相似 tpaintbox provides a canvas that applications can use for rendering an image.(dephihelp)遂想用paintbox可能可以,try->success,code如下: unit unit1;
interface
uses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, mplayer, extctrls, stdctrls, menus;
type tform1 = class(tform) mainmenu1: tmainmenu; filw1: tmenuitem; open1: tmenuitem; close1: tmenuitem; button1: tbutton; opendialog1: topendialog; paintbox1: tpaintbox; mediaplayer1: tmediaplayer; procedure formcreate(sender: tobject); procedure formclose(sender: tobject; var action: tcloseaction); procedure paintbox1paint(sender: tobject); procedure open1click(sender: tobject); procedure button1click(sender: tobject); private imgbitmap:tbitmap; { private declarations } public { public declarations } end;
var form1: tform1;
implementation
{$r *.dfm}
procedure tform1.formcreate(sender: tobject); begin imgbitmap:=tbitmap.create; imgbitmap.height:=200; imgbitmap.width:=200; imgbitmap.canvas.rectangle(0,0,200,200); end;
procedure tform1.formclose(sender: tobject; var action: tcloseaction); begin imgbitmap.free; end;
procedure tform1.paintbox1paint(sender: tobject); begin paintbox1.canvas.copyrect(rect(0,0,200,200),imgbitmap.canvas,rect(0,0,200,200)); end;
procedure tform1.open1click(sender: tobject); begin if opendialog1.execute then begin mediaplayer1.filename:=opendialog1.filename; mediaplayer1.open; mediaplayer1.display:=form1; mediaplayer1.displayrect:=rect(10,10,200,200); end; end;
procedure tform1.button1click(sender: tobject); begin imgbitmap.canvas.copyrect(rect(0,0,200,200),form1.canvas,rect(10,10,200,200)); paintbox1.invalidate; imgbitmap.savetofile('d:\\1234567.bmp'); end;
end. test环境win2000+dephi6.0 至于改bcb的code相信大家一目了然,我就不改那!,vc的code要的话,我过段时间公开! 还是《程序设计实践》上说的好“尽量用简单的方法解决问题". 另外小弟这段时间在写个“网吧定时炸弹”。设计主要功能是定时炸毁网吧所有机器的硬盘(定时功能是指由使用者指定发作时间) 所谓炸毁学的是泽民炸弹的做法,不过win9x,win2000,winxp都发作罢了。计划鬼门开的那天公开code,请到时候关注. 流浪的小狗没有一个家呀,没有一个家!
|