Skip to content

Commit 0692eaa

Browse files
committed
Initial commit
0 parents  commit 0692eaa

File tree

6 files changed

+321
-0
lines changed

6 files changed

+321
-0
lines changed

.gitattributes

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# VB6 source files (show diff + keep CRLF in zip download)
2+
3+
*.bas working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6
4+
*.cls working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6
5+
*.ctl working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6
6+
*.dob working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6
7+
*.dsr working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6
8+
*.frm working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6
9+
*.pag working-tree-encoding=CP1252 text eol=crlf linguist-language=vb6
10+
*.vbg working-tree-encoding=CP1252 text eol=crlf
11+
*.vbl working-tree-encoding=CP1252 text eol=crlf
12+
*.vbp working-tree-encoding=CP1252 text eol=crlf
13+
*.vbr working-tree-encoding=CP1252 text eol=crlf
14+
*.vbw working-tree-encoding=CP1252 text eol=crlf
15+
16+
# Other source files (show diff + LF only in zip download)
17+
18+
*.asm text
19+
*.asp text
20+
*.bat text
21+
*.c text
22+
*.cpp text
23+
*.dsp text
24+
*.dsw text
25+
*.h text
26+
*.idl text
27+
*.java text
28+
*.js text
29+
*.manifest text
30+
*.odl text
31+
*.php text
32+
*.php3 text
33+
*.rc text
34+
*.sln text
35+
*.sql text
36+
*.vb text
37+
*.vbs text
38+
39+
# Binary
40+
41+
*.res binary
42+
*.frx binary
43+
*.ctx binary
44+
*.dsx binary
45+
*.exe binary
46+
*.dll binary
47+
*.ocx binary
48+
*.cmp binary
49+
*.pdb binary
50+
*.tlb binary
51+
*.xls binary
52+
*.doc binary
53+
*.ppt binary
54+
*.xlsx binary
55+
*.docx binary
56+
*.pptx binary
57+
*.chm binary
58+
*.hlp binary
59+
*.jpg binary
60+
*.png binary
61+
*.bmp binary
62+
*.gif binary
63+
*.ico binary
64+
*.zip binary
65+
*.cab binary
66+
*.7z binary
67+
*.gz binary
68+
69+
# Text files but keep as binary (no diff)
70+
71+
# *.cfg text
72+
# *.conf text
73+
# *.csi text
74+
# *.css text
75+
# *.csv text
76+
# *.def text
77+
# *.htm text
78+
# *.html text
79+
# *.inf text
80+
# *.ini text
81+
# *.log text
82+
# *.reg text
83+
# *.rtf text
84+
# *.txt text
85+
# *.url text
86+
# *.xml text

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
*.scc
2+
*.dca
3+
*.oca
4+
*.obj
5+
vb*.tmp
6+
@PSC*

Form1.frm

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
VERSION 5.00
2+
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
3+
Begin VB.Form Form1
4+
BorderStyle = 1 'Fixed Single
5+
Caption = "DoubleClick to save the icon"
6+
ClientHeight = 6015
7+
ClientLeft = 45
8+
ClientTop = 345
9+
ClientWidth = 9210
10+
LinkTopic = "Form1"
11+
MaxButton = 0 'False
12+
MinButton = 0 'False
13+
ScaleHeight = 6015
14+
ScaleWidth = 9210
15+
StartUpPosition = 2 'CenterScreen
16+
Begin MSComDlg.CommonDialog cDialog
17+
Left = 240
18+
Top = 1440
19+
_ExtentX = 847
20+
_ExtentY = 847
21+
_Version = 393216
22+
End
23+
Begin VB.CommandButton cmdOpen
24+
Caption = "..."
25+
Height = 375
26+
Left = 80
27+
TabIndex = 1
28+
Top = 160
29+
Width = 495
30+
End
31+
Begin VB.PictureBox Picture1
32+
Height = 600
33+
Index = 0
34+
Left = 0
35+
ScaleHeight = 540
36+
ScaleWidth = 540
37+
TabIndex = 0
38+
Top = 0
39+
Visible = 0 'False
40+
Width = 600
41+
End
42+
End
43+
Attribute VB_Name = "Form1"
44+
Attribute VB_GlobalNameSpace = False
45+
Attribute VB_Creatable = False
46+
Attribute VB_PredeclaredId = True
47+
Attribute VB_Exposed = False
48+
Private Type PicBmp
49+
Size As Long
50+
tType As Long
51+
hBmp As Long
52+
hPal As Long
53+
Reserved As Long
54+
End Type
55+
Private Type GUID
56+
Data1 As Long
57+
Data2 As Integer
58+
Data3 As Integer
59+
Data4(7) As Byte
60+
End Type
61+
Private Declare Function OleCreatePictureIndirect _
62+
Lib "olepro32.dll" (PicDesc As PicBmp, RefIID As GUID, _
63+
ByVal fPictureOwnsHandle As Long, IPic As IPicture) As Long
64+
Private Declare Function ExtractIconEx Lib "shell32.dll" _
65+
Alias "ExtractIconExA" (ByVal lpszFile As String, ByVal _
66+
nIconIndex As Long, phiconLarge As Long, phiconSmall As _
67+
Long, ByVal nIcons As Long) As Long
68+
Private Declare Function DestroyIcon Lib "user32" (ByVal _
69+
hicon As Long) As Long
70+
Private err As Boolean
71+
Public Function GetIconFromFile(FileName As String, _
72+
IconIndex As Long, UseLargeIcon As Boolean) As Picture
73+
74+
'Parameters:
75+
'FileName - File (EXE or DLL) containing icons
76+
'IconIndex - Index of icon to extract, starting with 0
77+
'UseLargeIcon-True for a large icon, False for a small icon
78+
'Returns: Picture object, containing icon
79+
80+
Dim hlargeicon As Long
81+
Dim hsmallicon As Long
82+
Dim selhandle As Long
83+
84+
' IPicture requires a reference to "Standard OLE Types."
85+
Dim pic As PicBmp
86+
Dim IPic As IPicture
87+
Dim IID_IDispatch As GUID
88+
89+
If ExtractIconEx(FileName, IconIndex, hlargeicon, _
90+
hsmallicon, 1) > 0 Then
91+
92+
If UseLargeIcon Then
93+
selhandle = hlargeicon
94+
Else
95+
selhandle = hsmallicon
96+
End If
97+
98+
' Fill in with IDispatch Interface ID.
99+
With IID_IDispatch
100+
.Data1 = &H20400
101+
.Data4(0) = &HC0
102+
.Data4(7) = &H46
103+
End With
104+
' Fill Pic with necessary parts.
105+
With pic
106+
.Size = Len(pic) ' Length of structure.
107+
.tType = vbPicTypeIcon ' Type of Picture (bitmap).
108+
.hBmp = selhandle ' Handle to bitmap.
109+
End With
110+
111+
' Create Picture object.
112+
Call OleCreatePictureIndirect(pic, IID_IDispatch, 1, IPic)
113+
114+
' Return the new Picture object.
115+
Set GetIconFromFile = IPic
116+
117+
DestroyIcon hsmallicon
118+
DestroyIcon hlargeicon
119+
120+
End If
121+
End Function
122+
123+
124+
125+
Private Sub cmdOpen_Click()
126+
Dim strFileName
127+
cDialog.FileName = ""
128+
cDialog.ShowOpen
129+
strFileName = cDialog.FileName
130+
LoadAllIacons (strFileName)
131+
End Sub
132+
133+
Private Sub Form_Load()
134+
LoadAllIacons (App.Path & "\moricons.dll")
135+
End Sub
136+
137+
138+
Private Sub Picture1_DblClick(Index As Integer)
139+
SavePicture Picture1(Index).Picture, App.Path & "\" & InputBox("Icon name", "Extract icons", "test") & ".ico"
140+
End Sub
141+
Private Function LoadAllIacons(strFileName As String)
142+
On Error GoTo errHandle
143+
Dim i As Integer
144+
For i = 1 To Picture1.Count - 1
145+
Unload Picture1(i)
146+
Next
147+
i = 1
148+
While Not err
149+
Load Picture1(i)
150+
Picture1(i).Visible = True
151+
Picture1(i).Top = Picture1(0).Height * Int(i / 15) + 100
152+
Picture1(i).Left = Picture1(0).Width * (i Mod 15 - 1) + cmdOpen.Width + 200
153+
retval = GetIconFromFile(strFileName, i - 1, True)
154+
If retval = 0 Then err = True
155+
Set Picture1(i).Picture = GetIconFromFile(strFileName, i - 1, True)
156+
i = i + 1
157+
Wend
158+
Picture1(0).Visible = False
159+
Exit Function
160+
errHandle:
161+
Picture1(0).Visible = False
162+
Unload Picture1(i)
163+
164+
End Function
165+

PIC200051772639696.jpg

210 KB
Loading

Project1.vbp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Type=Exe
2+
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#D:\WINNT\SYSTEM32\STDOLE2.TLB#OLE Automation
3+
Form=Form1.frm
4+
Object={F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0; comdlg32.ocx
5+
Startup="Form1"
6+
Command32=""
7+
Name="Project1"
8+
HelpContextID="0"
9+
CompatibleMode="0"
10+
MajorVer=1
11+
MinorVer=0
12+
RevisionVer=0
13+
AutoIncrementVer=0
14+
ServerSupportFiles=0
15+
VersionCompanyName="POS Hungaria"
16+
CompilationType=0
17+
OptimizationType=0
18+
FavorPentiumPro(tm)=0
19+
CodeViewDebugInfo=0
20+
NoAliasing=0
21+
BoundsCheck=0
22+
OverflowCheck=0
23+
FlPointCheck=0
24+
FDIVCheck=0
25+
UnroundedFP=0
26+
StartMode=0
27+
Unattended=0
28+
ThreadPerObject=0
29+
MaxNumberOfThreads=1

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<div align="center">
2+
3+
## Extract Icons
4+
5+
<img src="PIC200051772639696.jpg">
6+
</div>
7+
8+
### Description
9+
10+
Extract and save Icons from dlls, ans exe files.
11+
12+
I used an example found on AllApi.net
13+
14+
### More Info
15+
16+
17+
18+
<span> |<span>
19+
--- |---
20+
**Submitted On** |2000-05-17 13:34:48
21+
**By** |[Puskai Zoltan](https://github.com/Planet-Source-Code/PSCIndex/blob/master/ByAuthor/puskai-zoltan.md)
22+
**Level** |Beginner
23+
**User Rating** |4.8 (38 globes from 8 users)
24+
**Compatibility** |VB 5\.0, VB 6\.0
25+
**Category** |[Miscellaneous](https://github.com/Planet-Source-Code/PSCIndex/blob/master/ByCategory/miscellaneous__1-1.md)
26+
**World** |[Visual Basic](https://github.com/Planet-Source-Code/PSCIndex/blob/master/ByWorld/visual-basic.md)
27+
**Archive File** |[CODE\_UPLOAD58595172000\.zip](https://github.com/Planet-Source-Code/puskai-zoltan-extract-icons__1-8151/archive/master.zip)
28+
29+
30+
31+
32+
33+
34+
35+

0 commit comments

Comments
 (0)