直接抓到EXE檔內部ICON值 |
答題得分者是:Cooky Kid
|
HomeSound
中階會員 發表:44 回覆:178 積分:94 註冊:2002-08-31 發送簡訊給我 |
|
lcsboy
版主 發表:87 回覆:622 積分:394 註冊:2002-06-18 發送簡訊給我 |
|
HomeSound
中階會員 發表:44 回覆:178 積分:94 註冊:2002-08-31 發送簡訊給我 |
|
HomeSound
中階會員 發表:44 回覆:178 積分:94 註冊:2002-08-31 發送簡訊給我 |
|
tender
初階會員 發表:23 回覆:90 積分:37 註冊:2002-09-26 發送簡訊給我 |
引言: >http://delphi.ktop.com.tw/topic.php?TOPIC_ID=19403 >以前就有人po過了 已ok了用API TIcon *pi = new TIcon(); pi->Handle=ExtractIcon(Application->Handle,"C:\\B.exe",0); Image1->Canvas->Draw(0,0,pi); delete pi; 乎搭啦!這應該是只對哪個應用程式的Icon 而已吧!! 但如果要把那應用程式的所有內容ICON都抓出來呢!? |
HomeSound
中階會員 發表:44 回覆:178 積分:94 註冊:2002-08-31 發送簡訊給我 |
HICON ExtractIcon( //原型
HINSTANCE hInst, //Handle
LPCTSTR lpszExeFileName,//取圖的檔名
UINT nIconIndex //傳入圖示索引值,值=-1傳回圖示數目
);
pi->Handle=ExtractIcon(Application->Handle,"C:\\B.exe",n);
n可從0到ExtractIcon(Application->Handle,"C:\\B.exe",-1);
bcb的Help有題到 乎搭啦!
------
--==多看.多學.多聽==-- |
Cooky Kid
初階會員 發表:5 回覆:68 積分:44 註冊:2002-07-11 發送簡訊給我 |
HomeSound 大大:
如果滿意以下--取得指定的執行檔(*.exe)或連接檔(*.dll)中所有圖示,依序排列至ListView1中。
咬...ㄟ...要給1分喔 class="code">
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ComCtrls.hpp>
#include <ToolWin.hpp>
#include <ImgList.hpp>
#include <Dialogs.hpp>
//Shell Library Functions 皆需添加此標頭檔-----------------------------------
#include <shellapi.h>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TButton *Button1;
TListView *ListView1;
TImageList *ImageList1;
TOpenDialog *OpenDialog1;
void __fastcall Button1Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
Unit1.cpp
//--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "Unit1.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma resource "*.dfm" TForm1 *Form1; //--------------------------------------------------------------------------- __fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner) { //先清除OpenDialog1設定,再設可開啟的檔案類型 OpenDialog1->Options.Clear(); OpenDialog1->Filter = "執行檔(*.exe)|*.exe|連接檔(*.dll)|*.dll"; OpenDialog1->FilterIndex = 1; //設定ListView1與ImageList1的關聯環境 //凡是由ImageList1增減的圖示,皆可由ListView1顯示 ListView1->LargeImages = ImageList1; ListView1->ViewStyle = vsIcon; //先清除ImageList1其中圖檔,並設定圖檔統一的長寬 ImageList1->Clear(); ImageList1->Width = ::GetSystemMetrics(SM_CXICON); ImageList1->Height = ::GetSystemMetrics(SM_CYICON); } //--------------------------------------------------------------------------- //可以引進在系統目錄(System32)中的"shell32.dll",觀看此連接檔包含的圖示 void __fastcall TForm1::Button1Click(TObject *Sender) { //先清除ImageList中所有圖檔與ListView中所有項目 ImageList1->Clear(); ListView1->Items->Clear(); //再依開啟舊檔對話盒的檔案,進行擷取其中的圖示 if(OpenDialog1->Execute()) { //取得指定檔案中包含的圖示數量 int num = reinterpret_cast<int>(::ExtractIcon(HInstance, OpenDialog1->FileName.c_str(), -1)); //逐一新增ListView上的圖示 for(int i=0; i<num; i ) { TIcon *hIcon = new TIcon; //擷取序列下指定的圖示,並指派給一新圖示 hIcon->Handle = ::ExtractIcon(HInstance,OpenDialog1->FileName.c_str(), i); //在ImageList1中新增此一新圖示 int index = ImageList1->AddIcon(hIcon); //與ImageList1關聯的ListView1同時也增加一個圖示項目 TListItem *NewItem = ListView1->Items->Add(); //遞增此圖示項目的標題號碼 NewItem->Caption = "圖示_no." AnsiString(index 1); //設定此圖示項目的順序位置 NewItem->ImageIndex = index; //完成後,釋放臨時使用的圖示結構 delete hIcon; } } } //--------------------------------------------------------------------------- |
HomeSound
中階會員 發表:44 回覆:178 積分:94 註冊:2002-08-31 發送簡訊給我 |
引言: HomeSound 大大: 如果滿意以下--取得指定的執行檔(*.exe)或連接檔(*.dll)中所有圖示,依序排列至ListView1中。 咬...ㄟ...要給1分喔 >>< face="Verdana, Arial, Helvetica"> 雖然小弟早以寫好類似程式,不過您可以加入復原icon得Mask (就是ListView在vsIcon下,被選定的ICON會成為較深色網底, 多次變更螢幕顏色及解析度時,較深色網底會變亂, 如何修正此網底,小弟一定給分喲! --==多看.多學.多聽==--
------
--==多看.多學.多聽==-- |
Cooky Kid
初階會員 發表:5 回覆:68 積分:44 註冊:2002-07-11 發送簡訊給我 |
|
HomeSound
中階會員 發表:44 回覆:178 積分:94 註冊:2002-08-31 發送簡訊給我 |
|
Cooky Kid
初階會員 發表:5 回覆:68 積分:44 註冊:2002-07-11 發送簡訊給我 |
|
HomeSound
中階會員 發表:44 回覆:178 積分:94 註冊:2002-08-31 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |