
下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
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 = '可將選定的文件復制到任何路徑下' sregister = '注冊.' sregistertip = '注冊getreslist插件庫' sunregister = '取
7、消注冊.' sunregistertip = '取消注冊getreslist插件庫' simagepriview = '預覽文件' simagepriviewtip = '預覽文件'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;/* 按照對象,得到相關的信
10、息function imageinfotostr(graphic: tgraphic): string;begin result := foat('%d * %d', graphic.width, graphic.height); if graphic is ticon then result := result + ' 圖標' 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. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 安徽師大附中2025年高二化學第二學期期末綜合測試模擬試題含解析
- 冰雪項目培訓管理辦法
- 丹葛多酚生物轉化-洞察及研究
- 沈陽集中供暖管理辦法
- 數據驅動咨詢體系-洞察及研究
- 兒童友好型社區戶外活動空間的設計與實踐
- 決策運行體系管理辦法
- 出口廚具庫存管理辦法
- 機械設備安全運行與維護策略
- 公司投訴渠道管理辦法
- 2025-2030中國搜索引擎行業現狀供需分析及市場深度研究發展前景及規劃可行性分析研究報告
- 醫院實驗室生物安全委員會文件
- 藍莓鮮果采購合同協議
- 醫療器械網絡銷售質量管理規范宣貫培訓課件2025年
- 方劑歌訣(廣中醫版)
- 數據知識產權培訓課件
- 青年教師培養與發展指南
- 四新安全教育培訓
- 農村基礎設施建設小微權力清單流程
- 房屋建筑學(山東聯盟)知到智慧樹章節測試課后答案2024年秋山東建筑大學
- 《銀行禮儀培訓方案》課件
評論
0/150
提交評論