
下載本文檔
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、shell extensionunit ugetreslist;$warn symbol_platform offinterfaceuses windows, activex, classes, syti, messages, comobj, shellapi, shlobj, math, graphics, jpeg, regisy;type tgetreslist = class(tcomobject, ishellextinit, iconttmenu, icontextmenu3) private ffilelist: tstrings; fgraphic: tgraphic; pro
2、tect /ishellextinit fution ishellextinit.initialize = seinitialize; function seinitialize(plfolder: pitemidlist; obj: idataobject; hkeyprogid: hkey): hresult; stdcall; /icontextmenu function querycontextmenu(menu: hmenu; indexmenu, idcmdfirst, idcmdlast, uflags: uint): hresult; stdcall;/before popup
3、 function invokecommand(var lpici: tcminvokecommandinfo): hresult; stdcall;/onclick function getcommandstring(idcmd, utype: uint; pwreserved: puint; pszname: lpstr; cchmax: uint): hresult; stdcall;/hint when move over /icontextmenu2 function handlemenumsg(umsg: uint; wparam, lparam: integer): hresul
4、t; stdcall; /icontextmenu3 function handlemenumsg2(umsg: uint; wparam, lparam: integer; var lpresult: integer): hresult; stdcall; public procere initialize; override; destructor destroy; override; end; tgetreslistfactory = class(tcomobjectfactory) public procedure upregistry(register: boolean); over
5、ride; end;const class_getreslist: tguid = 'aae1817e-34ea-4892-b6a7-8d5738ba3074' /menu type mfstring = mf_string or mf_byposition; mfownerdraw = mf_ownerdraw or mf_byposition; mfspearator = mf_separator or mf_byposition; /menu id idcopyanywhere = 0;/copy(move) idregister = 5; /registeractive
6、x idunregister = 6; /unregisteractivex idimagepreview = 10;/preview picture idmenurange = 90; /resourcestring /menu item name scopyanywhere = 'copy any where.' scopyanywheretip = '可將選定的文件復(fù)制到任何路徑下' sregister = '注冊(cè).' sregistertip = '注冊(cè)getreslist插件庫(kù)' sunregister = '取
7、消注冊(cè).' sunregistertip = '取消注冊(cè)getreslist插件庫(kù)' simagepriview = '預(yù)覽文件' simagepriviewtip = '預(yù)覽文件'function getfilelistfromdataobject(lpdobj: idataobject; sl: tstrings): hresult;function isactivelib(const filename: string): boolean;procedure registeractivelib(wnd: hwnd; const fil
8、ename: string);procedure unregisteractivelib(wnd: hwnd; const filename: string);procedure reportwin32error(wnd: hwnd; const prefix: string; dwerror: dword);function isimagefile(const filename: string): boolean;function imagefromfile(const filename: string): tgraphic;function exeefile(wnd: hwnd; cons
9、t filename: string): thandle;procedure drawgraphic(adc: hdc; rc: trect; state: integer; graphic: tgraphic);function imageinfotostr(graphic: tgraphic): string;function make_hresult(sev, fac, code: word): dword;procedure docopyanywhere(wnd: hwnd; sl: tstrings);implementationuses comserv;/* 按照對(duì)象,得到相關(guān)的信
10、息function imageinfotostr(graphic: tgraphic): string;begin result := foat('%d * %d', graphic.width, graphic.height); if graphic is ticon then result := result + ' 圖標(biāo)' if graphic is tbitmap then begin case tbitmap(graphic).pixelformat of pfdevice: result := result + ' ddb' pf1b
11、it: result := result + ' 2色' pf4bit: result := result + ' 16色' pf8bit: result := result + '256色' pf15bit, pf16bit: result := result + ' 16位色' pf24bit: result := result + ' 24位色' pf32bit: result := result + ' 32位色' pfcustom: result := result + ' 自定義
12、色' end; result := result + '位圖' end; if graphic is tmeta then begin result := result + format('(%d*%d) 元文件', tmetafile(graphic).mmwidth div 100, tmetafile(graphic).mmheight div 100); end; if graphic is tjpegimage then begin case tjpegimage(graphic).pixelformat of jf24bit: result
13、:= result + ' 24位色 jpeg' jf8bit: result := result + ' 8位色 jpeg' end; end;end;/* 畫圖像procedure drawgraphic(adc: hdc; rc: trect; state: integer; graphic: tgraphic);var rcimage, rctext, rcstretch: trect; canvas: tcanvas; nsavedc: integer; x, y: integer; xscale, yscale, scale: double; xst
14、retch, ystretch: integer;begin rcimage.left := rc.left + 10; rcimage.right := rc.right - 10; rcimage.top := rc.top + 10; rcimage.bottom := rc.bottom - 30; rctext.left := rc.left + 10; rctext.right := rc.right - 10; rctext.top := rc.bottom - 20; rctext.bottom := rc.bottom; canvas := tcanvas.create; n
15、savedc := 0; try nsavedc := savedc(adc); canvas.handle := adc; if not assigned(graphic) then begin canvas.rectangle(rcimage); canvas.moveto(rcimage.left, rcimage.top); canvas.lineto(rcimage.right, rcimage.bottom); canvas.moveto(rcimage.right, rcimage.top); canvas.lineto(rcimage.left, rcimage.bottom)
16、; drawtext(canvas.handle, '未知圖像', -1, rcimage, dt_singleline or dt_center or dt_vcenter); end else begin if (graphic.width rcimage.right - rcimage.left) and (graphic.height rcimage.bottom - rcimage.top) then begin x := rcimage.left + (rcimage.right - rcimage.left - graphic.width) div 2; y :=
17、 rcimage.top + (rcimage.bottom - rcimage.top - graphic.height) div 2; canvas.draw(x, y, graphic); end else begin xscale := graphic.width / (rcimage.right - rcimage.left); yscale := graphic.height / (rcimage.bottom - rcimage.top); scale := max(xscale, yscale); xstretch := trunc(graphic.width / scale)
18、; ystretch := trunc(graphic.height / scale); x := rcimage.left + (rcimage.right - rcimage.left - xstretch) div 2; y := rcimage.top + (rcimage.bottom - rcimage.top - ystretch) div 2; rcstretch := rect(x, y, x + xstretch, y + ystretch); canvas.stretchdraw(rcstretch, graphic); end; windows.fillrect(canvas.handle, rctext, getsyscolorbrush(color_menu); settextcolor(canvas.handle, getsyscolor(color_menutext); setbkcolor(canvas.handle, getsyscolor(color_menu); drawtext(canvas.handle, pchar(imageinfotostr(graphic), -1, rctext, dt_singleline or dt_center or dt_vcenter); end; finally canva
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 稅務(wù)籌劃項(xiàng)目經(jīng)理崗位面試問(wèn)題及答案
- 數(shù)據(jù)治理工程師崗位面試問(wèn)題及答案
- 上海市松江區(qū)統(tǒng)考2025年化學(xué)高二下期末經(jīng)典模擬試題含解析
- 安徽師大附中2025年高二化學(xué)第二學(xué)期期末綜合測(cè)試模擬試題含解析
- 冰雪項(xiàng)目培訓(xùn)管理辦法
- 丹葛多酚生物轉(zhuǎn)化-洞察及研究
- 沈陽(yáng)集中供暖管理辦法
- 數(shù)據(jù)驅(qū)動(dòng)咨詢體系-洞察及研究
- 兒童友好型社區(qū)戶外活動(dòng)空間的設(shè)計(jì)與實(shí)踐
- 決策運(yùn)行體系管理辦法
- 商戶安全生產(chǎn)培訓(xùn)課件
- 電信防詐騙培訓(xùn)課件
- SL631水利水電工程單元工程施工質(zhì)量驗(yàn)收標(biāo)準(zhǔn)第1部分:土石方工程
- 健康教育與健康促進(jìn)試題及參考答案
- 安全風(fēng)險(xiǎn)分級(jí)管控和隱患排查治理雙重預(yù)防機(jī)制實(shí)施細(xì)則
- -06-領(lǐng)軍人才選拔試題答案
- 交通導(dǎo)行方案樣稿
- 學(xué)校中層干部選拔考試教育教學(xué)管理知識(shí)試題題庫(kù)(包含:名詞解釋、簡(jiǎn)答題、論述題、案例分析)
- 消防安裝工程監(jiān)理細(xì)則樣本
- GA/T 966-2011物證的封裝要求
- FZ/T 64078-2019熔噴法非織造布
評(píng)論
0/150
提交評(píng)論