0
jambo's Avatar
Light Poster
ah and.. sure I read all msdn however I'm not native english speaker and I sometimes can't understand especially with things I never dealt with before So if u can tke some of ur time and explain to me you would save my life

note :I'm on VBNet
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by jambo View Post
a) a file has more than one icon ?
Actually yes. There are many Icons and even if you see one there are of many sizes like 16x16, 32x32 and so on. So its always more than one Icon.
Quote:
Originally Posted by jambo View Post
b) FindResource checks resource one by one??
Yes it does it one by one based on the Id ( Integer ) you provide and tells you if its a valid resource of the type specified.
Quote:
Originally Posted by jambo View Post
..a string... an integer..or even a humain if it wants to, my problem is how to know what it is, I don't care it's type. I have no idea what to fill in this parameter and I don't understand what's the '#' for.
If you know how the resources are stored in the RC file this would be easy. When you add any resource it gets assigned an Integer in the Resource.h file and so its always integer
Quote:
Originally Posted by jambo View Post
What is MAKEINTID(1) ? some function I need to declare ??
Its already defined and you do not need to do anything extra to declare it but just use it.

I hope I have cleared some of your queries
0
jambo's Avatar
Light Poster
hmm thx for replies Jabbir but I can't succeed in writing this in VB
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by jambo View Post
hmm thx for replies Jabbir but I can't succeed in writing this in VB
I am not a VB Expert
0
zzo's Avatar, Join Date: Jun 2009
zzo
Newbie Member
Hi,

I've found this code, and topic googleing, looking for a good example that will explain how to do the exact thing your example does

I am using Visual Basic, and code is not working for me.

I'm having problems with this function FindResource, as it wont find the resource.

I opened my source EXE file with a tool and i've seen that my icon names are 30003, 30004, and 30005, so i used "#30004" to find icon.

Code:
hRes = FindResource(hSrc, "#30002", RT_ICON)
It always returns 0. I tried all possibilities. I tried another EXE with Icon names 1,2,3...8. Function also failed.

Have two questions:
- What could be the cause for function failiure?
- Is there any other way to do this?
0
zzo's Avatar, Join Date: Jun 2009
zzo
Newbie Member
I didn't mention that examples are not working for me. I compiled the example with source code too.
Neither is working. :/
0
zzo's Avatar, Join Date: Jun 2009
zzo
Newbie Member
Quote:
Originally Posted by jambo View Post
hmm thx for replies Jabbir but I can't succeed in writing this in VB
I have also tried to rewrite the code in VB and made everything correct but some function fail. I guess that this FindResource is not compatible with VB, or the declarations are not correct, maybe for this RT_ICON. I have started writing this code in c++ console application and it works now for me. But this example that is in MFC does not work. I dont understand why.

This is my VB code with declarations:


//Those are examples where i know my icon name is #1, but it can be #20000 also so you shold loop from 1 to ... 65536 maybe. Just guessing.

Code:
This is C++ code:
hRes = FindResource(hSrc, MAKEINTRESOURCE(1), RT_ICON); //Works!
Code:
LPCTSTR lpName;
lpName = "#1" 
hRes = FindResource(hSrc, lpName, RT_ICON); //Works
And this is Visual Basic code that doesn work:
Code:
Private Declare Function FindResource Lib "kernel32.dll" Alias "FindResourceA" ( _
     ByVal hInstance As Long, _
     ByVal lpName As String, _
     ByVal lpType As String) As Long
     
Private Const RT_ICON As Long = 3&
Code:
Dim hRes as Long
hRes = FindResource(hSrc, "#1", RT_ICON)
0
athidi's Avatar, Join Date: Sep 2009
Newbie Member
I can't open the two .zip files given at the end please help

in my computer the file extension is changed to .php after downloading and even if the change the extension to .zip or .rar I can't open it......

what could be the possiible error..........
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Dont know why but I checked it once again now and it did download as zip
0
VijayLaxmi's Avatar, Join Date: Feb 2010
Light Poster
I also want to do this,i m already taking help of this thread but its not working.
t think you done it so please provide me sample to change icon to exe.
thanks.