Hi everyone !

My aim is to train myself with resources (exactly here : icons).
I adapted in HLA one sample program I found in the MSDN library, about changing the icon of an *.exe (calc) by copying it from another one (winmine).

I think my code is rather accurate now, except that I have trouble with the following topics :

the functions FindResource and UpdateResource use MACRO's named :
1' - MAKEINTRESOURCE which returns a lpStr ;
2' - MAKELANGID which returns a word specifying a language ID ;

My questions are :
1 - how is it to use properly the macro-call (MAKEINTRESOURCE or MAKELANGID) inside a HLA function-call (FindResource or UpdateResource) AND how do I know the value to pass to that macro ;
2 - if need, how can I eventually bypass that macro-call, replacing it by the number or the name of the resource I'm trying to locate (that is : how to locate the Icon resource in the *.exe (winmine) ;

Here is my code :

program Icons;


#include( "stdlib.hhf" )
#include( "fileio.hhf" )
#include( "w.hhf" )

static
hFich1: dword;
hRessource1: dword;
hResLoad: dword;
lpResLock: dword;
hUpdateRes: dword;
dwSizeRes: dword;
bE_U_R: dword;
bFreeLib: dword;
bresult: dword;
endstatic;

begin Icons;

// STEP 1 - load *.exe from which find the resource (WINMINE.EXE)

w.LoadLibrary("C:\WINNT\system32\winmine.exe");
mov(eax,hFich1);
stdout.put(nl," hFich1 ",hFich1);


// STEP 2 - find resource into *.exe (ICON)

w.FindResource
(
hFich1,
#1, //MAKEINTRESOURCE(?), [color=red]<-- what is here to pass as a param. value ?[/color] "RT_ICON"
);
mov(eax,hRessource1);
stdout.put(nl," hRessource1 ",hRessource1);


// STEP 3 - load resource from *.exe

w.LoadResource(hFich1,hRessource1);
mov(eax,hResLoad);
stdout.put(nl," hResLoad ",hResLoad);


// STEP 4 - lock resource

w.LockResource(hResLoad);
mov(eax,lpResLock);
stdout.put(nl," lpResLock ",lpResLock);


// STEP 5 - open file to which add the resource (CALC_COPY.EXE)

w.BeginUpdateResource("C:\WINNT\system32\calc_copy.exe",false);
mov(eax,hUpdateRes);
stdout.put(nl," hUpdateRes ",hUpdateRes);

// pre-STEP 6 - size of resource
w.SizeofResource(hFich1,hRessource1);
mov(eax,dwSizeRes);
stdout.put(nl," dwSizeRes ",dwSizeRes);

// STEP 6 - add resource to the updatelist

w.UpdateResource
(
hUpdateRes,
"RT_ICON",
#1,
1, //MAKELANGID [color=red]<-- what is here to pass as a param. value ?[/color] (LANG_NEUTRAL,SUBLANG_NEUTRAL),
lpResLock,
dwSizeRes
);
mov(eax,bresult);
stdout.put(nl," bresult ",bresult);


// STEP 7 - write changes to updated file (CALC.EXE)

w.EndUpdateResource(hUpdateRes, false);
mov(eax,bE_U_R);
stdout.put(nl," bE_U_R ",bE_U_R);


// STEP 8 - clean up

w.FreeLibrary(hFich1);
mov(eax,bFreeLib);
stdout.put(nl," bFreeLib ",bFreeLib);

end Icons;


Who can help me finding what is wrong here ?
(I hope I was clear enough, in other case, I give more explanations :oops: )

Thanks a lot for answering or eventually redirecting me to another more appropriate forum...

Juan,
Belgium.
Posted on 2004-12-08 05:02:47 by Juan
Hi Juan,

You should write


...
const
RT_GROUP_ICON := w.RT_ICON + 11;
...
w.FindResource
(
hFich1,
val IDI_ICON, // numeric identifier
val RT_GROUP_ICON
);
...
w.UpdateResource
(
hUpdateRes,
val RT_GROUP_ICON,
val IDI_ICON,
0, // LANG_NEUTRAL = 0, SUBLANG_NEUTRAL = 0
lpResLock,
dwSizeRes
);
...


The macro MAKELANGID and different language IDs are defined like this



// from WinNT.h
...
#define LANG_NEUTRAL 0x00
...
#define SUBLANG_NEUTRAL 0x00 // language neutral
#define SUBLANG_DEFAULT 0x01 // user default
#define SUBLANG_SYS_DEFAULT 0x02 // system default
...
#define MAKELANGID(p, s) ((((WORD )(s)) << 10) | (WORD )(p))
...


I hope that helps you

Regards
Posted on 2004-12-09 18:24:31 by arlequin
I wrote


...
val IDI_ICON, // numeric identifier
val RT_GROUP_ICON // because I've multiple sizes icon
);
...


Obviously, you can replace RT_GROUP_ICON by RT_ICON if your icon resource contains only one size icon.

Regards
Posted on 2004-12-10 02:03:28 by arlequin
Hi everyone again !

OK, I understood Arlequin's explanations (thanks a lot !) and made corrections to my code.
But now, though it doesn't generate errors at compile-time, my program still has a bug :

If I use the RT_ICON value (=3) for the lptype parameter and IDI_ICON_winmine =1 , IDI_ICON_calc = 1 (FindResource and UpdateResource), the step 5 does not work properly, although it produces actually changes to calc.exe (seems to modify the icon #1 into some WIN standard or default icon, but not into the icon from winmine as required :? ).
I can check this using a resource editor.

I suppose the error in my code must hide in the use of the RT_ICON/RT_GROUP_ICON values for the lptype parameter.

My first question is :
Should I use RT_ICON (=3 as set in w.hhf) or RT_GROUP_ICON (=14) as a value for the lptype parameter, knowing that both calc and winmine have two icons :
- winmine icon #1 : 744 bytes
- winmine icon #2 : 304 bytes
- calc icon #1 : 744 bytes
- calc icon #2 :296 bytes
?and that my aim is (at first) to replace calc icon #1 by winmine icon #1 ?


If I use the RT_GROUP_ICON value for lptype and IDI_ICON_winmine = 1,
then my program simply cannot locate the icon #1?

so, my second question is :
How can I determine securely the # of an icon, when I have to use the RT_GROUP_ICON value for lptype.

My third question is :
(the explanation of Arlequin was not quite clear to me :( ).
In case I cannot use MAKELANGID in HLA, how can I know the result of its calculation for any combination of usPrimaryLanguage and usSubLanguage, to be able to input any value for wLanguage. (that is : what is the algorithm of that function ?, where can I find it ?)
I noticed that all icons above have LANG_FRENCH and SUBLANG_FRENCH values.
Is it the reason for my fail, as I was forced to use 0 for wLanguage until now ?

Well... enough for now, but I? be pleased someone to try my prog and give the explanations?

Thanks a lot again, especially to Arlequino?

my code modified :

don't look at pre-STEP 5 for now as I wanted to check and draw the icon, but until now I have no result with this part of code... it will come later... :-D

program Icons;


// ce programme tente de substituer l'ic?ne de winmine ? calc
// (8 ?tapes)
//

#include( "stdlib.hhf" )
#include( "fileio.hhf" )
#include( "w.hhf" )

const
IDI_ICON_winmine:= 1;
IDI_ICON_calc:= 1;
RT_ICON:= w.RT_ICON;
RT_GROUP_ICON:= w.RT_ICON + 11;
endconst;

static
hDC: dword;
hFich1: dword;
hRessource1: dword;
hResLoad: dword;
lpResLock: dword;
bDrawRes: dword;
hUpdateRes: dword;
dwSizeRes: dword;
bE_U_R: dword;
bFreeLib: dword;
bresult: dword;
endstatic;

begin Icons;

// STEP 1 - load *.exe (WINMINE.EXE) from which find the resource (ICON)

w.LoadLibrary("C:\hla\essais\icons\winmine.exe");
mov(eax,hFich1);
stdout.put(nl," hFich1 ",hFich1);


// STEP 2 - find resource (ICON) into *.exe (WINMINE.EXE)
w.FindResource
(
hFich1,
val IDI_ICON_winmine, //#1, //MAKEINTRESOURCE(?),
val RT_GROUP_ICON
);
mov(eax,hRessource1);
stdout.put(nl," hRessource1 ",hRessource1);


// STEP 3 - load resource (ICON) from *.exe (WINMINE.EXE)

w.LoadResource(hFich1,hRessource1);
mov(eax,hResLoad);
stdout.put(nl," hResLoad ",hResLoad);


// STEP 4 - lock resource

w.LockResource(hResLoad);
mov(eax,lpResLock);
stdout.put(nl," lpResLock ",lpResLock);


//pre-STEP 5 - draw the icon

w.CreateDC
(
"DISPLAY",
NULL,
NULL,
NULL
);
mov(eax,hDC);
stdout.put(nl," hDC ",hDC);

w.DrawIcon
(
hDC,
10,
20,
hRessource1
);
mov(eax,bDrawRes);
stdout.put(nl," bDrawRes ",bDrawRes);


// STEP 5 - open file to which add the resource (CALC.EXE)

w.BeginUpdateResource("C:\hla\essais\icons\calc.exe",false);
mov(eax,hUpdateRes);
stdout.put(nl," hUpdateRes ",hUpdateRes);

// pre-STEP 6 - size of resource
w.SizeofResource(hFich1,hRessource1);
mov(eax,dwSizeRes);
stdout.put(nl," dwSizeRes ",dwSizeRes);

// STEP 6 - add resource to the updatelist

w.UpdateResource
(
hUpdateRes,
val RT_GROUP_ICON,
val IDI_ICON_calc, //#1,
0, // LANG_NEUTRAL = 0, SUBLANG_NEUTRAL = 0 //MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),
lpResLock,
dwSizeRes
);
mov(eax,bresult);
stdout.put(nl," bresult ",bresult);


// STEP 7 - write changes to updated file (CALC.EXE)

w.EndUpdateResource(hUpdateRes, false);
mov(eax,bE_U_R);
stdout.put(nl," bE_U_R ",bE_U_R);


// STEP 8 - clean up

w.FreeLibrary(hFich1);
mov(eax,bFreeLib);
stdout.put(nl," bFreeLib ",bFreeLib);

end Icons;
Posted on 2004-12-15 07:10:38 by Juan
Hi Juan,

1&2. Yes, you should use RT_ICON as value for lpType parameter. The problem is to know what icon id to choose. If you look at into the resources of winmine.exe and calc.exe, you'll notice that these two progs contains the same icon number in their RT_GROUP_ICON. In this case, you've not to modify the resource structure, you can simply change one icon by another. As I said, the problem is how to choose the right one. While I was looking for informations, I found Icons in Win32. A little bit outdated, but still usable. Read also Introduction to Resources

3. MAKELANGID is a macro defined in winNT.h as I wrote in my last post. The following is the HLA version:


#if( ! @defined( winnt_hhf ))
?winnt_hhf := true;

namespace nt; @fast;

#macro MAKELANGID(p, s);

(((type word s) << 10) | (type word p))

#endmacro;

const
LANG_SYSTEM_DEFAULT :text := "nt.MAKELANGID(nt.LANG_NEUTRAL, nt.SUBLANG_SYS_DEFAULT)";
LANG_USER_DEFAULT :text := "nt.MAKELANGID(nt.LANG_NEUTRAL, nt.SUBLANG_DEFAULT)";

//
// Language IDs.
//
// The following two combinations of primary language ID and
// sublanguage ID have special semantics:
//
// Primary Language ID Sublanguage ID Result
// ------------------- --------------- ------------------------
// LANG_NEUTRAL SUBLANG_NEUTRAL Language neutral
// LANG_NEUTRAL SUBLANG_DEFAULT User default language
// LANG_NEUTRAL SUBLANG_SYS_DEFAULT System default language
// LANG_INVARIANT SUBLANG_NEUTRAL Invariant locale
//

//
// Primary language IDs.
//

const
LANG_NEUTRAL := $00;
LANG_INVARIANT := $7f;

LANG_ENGLISH := $09;
LANG_FRENCH := $0c;
// more const here and above

//
// Sublanguage IDs.
//
// The name immediately following SUBLANG_ dictates which primary
// language ID that sublanguage ID can be combined with to form a
// valid language ID.
//

const
SUBLANG_NEUTRAL := $00; // language neutral
SUBLANG_DEFAULT := $01; // user default
SUBLANG_SYS_DEFAULT := $02; // system default

SUBLANG_ENGLISH_US := $01; // English (USA)
SUBLANG_ENGLISH_UK := $02; // English (UK)
SUBLANG_ENGLISH_AUS := $03; // English (Australian)
SUBLANG_ENGLISH_CAN := $04; // English (Canadian)
SUBLANG_ENGLISH_NZ := $05; // English (New Zealand)
SUBLANG_ENGLISH_EIRE := $06; // English (Irish)
SUBLANG_ENGLISH_SOUTH_AFRICA := $07; // English (South Africa)
SUBLANG_ENGLISH_JAMAICA := $08; // English (Jamaica)
SUBLANG_ENGLISH_CARIBBEAN := $09; // English (Caribbean)
SUBLANG_ENGLISH_BELIZE := $0a; // English (Belize)
SUBLANG_ENGLISH_TRINIDAD := $0b; // English (Trinidad)
SUBLANG_ENGLISH_ZIMBABWE := $0c; // English (Zimbabwe)
SUBLANG_ENGLISH_PHILIPPINES := $0d; // English (Philippines)
SUBLANG_FRENCH := $01; // French
SUBLANG_FRENCH_BELGIAN := $02; // French (Belgian)
SUBLANG_FRENCH_CANADIAN := $03; // French (Canadian)
SUBLANG_FRENCH_SWISS := $04; // French (Swiss)
SUBLANG_FRENCH_LUXEMBOURG := $05; // French (Luxembourg)
SUBLANG_FRENCH_MONACO := $06; // French (Monaco)

end nt;

#endif

and now, the sample code for changing the calc.exe icon


program Icons;

// ce programme tente de substituer l'ic?ne de winmine ? calc
// (8 ?tapes)
//
// ce programme va r?ellement substituer l'ic?ne de winmine ? calc
// (1 ?tape) :)

#include( "stdlib.hhf" )
#include( "fileio.hhf" )
#include( "w.hhf" )

#include( "langid.hhf" )

static
LookupIconIdFromDirectoryEx: procedure
(
var presbits: byte;
fIcon: dword;
cxDesired: dword;
cyDesired: dword;
Flags: dword
);
@stdcall;
@returns( "eax" );
@external( "__imp__LookupIconIdFromDirectoryEx@20" );

const
TRUE := 1;
CXICON := 16;
CYICON := 16;
IDI_GROUP_ICON := 100; // WinMine.exe group icon
IDI_ICON := 5; // icon to change in calc.exe
RT_ICON := w.RT_ICON;
RT_GROUP_ICON := w.RT_ICON + 11;

static
hFich1 :dword;
hRessource1 :dword;
pEntry :dword;
nID :dword;

hUpdateRes :dword;
dwSizeRes :dword;
bE_U_R :dword;
bFreeLib :dword;
bresult :dword;

begin Icons;

w.LoadLibrary(".\winmine.exe");
mov( eax, hFich1 );
stdout.put(nl,"LoadLibrary - hFich1 ", hFich1 );

w.FindResource( hFich1, val IDI_GROUP_ICON, val RT_GROUP_ICON );
stdout.put( nl,"FindResource - hRessource1 ", (type dword eax) );

w.LoadResource( hFich1, eax );
stdout.put(nl,"LoadResource - hResLoad ", (type dword eax) );

w.LockResource( eax );
stdout.put(nl,"LockResource - lpResLock ", (type dword eax) );

LookupIconIdFromDirectoryEx(
(type byte [eax]), TRUE, CXICON, CYICON, w.LR_DEFAULTCOLOR );
mov( eax, nID );
stdout.put(nl,"LookupIconIdFromDirectoryEx - nID ", nID);

//-----------------------------------------------------------------//

w.FindResource( hFich1, nID, val RT_ICON );
mov( eax, hRessource1 );
stdout.put( nl,"FindResource - hRessource1 ", hRessource1 );

w.SizeofResource( hFich1, hRessource1 );
mov( eax, dwSizeRes );
stdout.put(nl,"SizeofResource - dwSizeRes ", dwSizeRes);

w.LoadResource( hFich1, hRessource1 );
stdout.put(nl,"LoadResource - hResLoad ", (type dword eax) );

w.LockResource( eax );
mov( eax, pEntry );
stdout.put(nl,"LockResource - lpResLock ", pEntry);

w.BeginUpdateResource( ".\calc.exe", false );
mov( eax, hUpdateRes);
stdout.put(nl,"BeginUpdateResource - hUpdateRes ", hUpdateRes);

mov( pEntry, eax );

w.UpdateResource
(
hUpdateRes,
val RT_ICON,
val IDI_ICON,
nt.MAKELANGID( nt.LANG_FRENCH, nt.SUBLANG_FRENCH ),
[eax],
dwSizeRes
);
mov(eax,bresult);
stdout.put(nl,"UpdateResource - bresult ", bresult);

w.EndUpdateResource(hUpdateRes, false);
mov(eax,bE_U_R);
stdout.put(nl,"EndUpdateResource - bE_U_R ",bE_U_R);


// STEP 8 - clean up

w.FreeLibrary(hFich1);
mov(eax,bFreeLib);
stdout.put(nl,"FreeLibrary - bFreeLib ",bFreeLib);

end Icons;


J'esp?re que ?a t'aidera un peu
a+
Posted on 2004-12-16 20:50:16 by arlequin
Je vois ? l'instant ta r?ponse... :shock:

Je vais tenter de comprendre tout ?a... :wink:

Merci beaucoup.

MP : tu es francophone ? sinon, 'chapeau' pour le Fran?ais...:alright:

? bient?t,
Juan...
Posted on 2004-12-20 03:17:58 by Juan
hem... :?

Langid.hhf ?

Where does this one come out ?
I don't have it in my includes ?

I suppose that it contains the HLA-def. of MAKELANGID ?
Can you tell me about that file ? Where can I download it from ?

sorry for being so silly sometimes... :oops:

But... thanks to you, I can feel I reach the solution, little by little... :idea:

? bient?t,
Juan.
Posted on 2004-12-20 05:06:50 by Juan
Hi Juan,

Oops :roll: , I'm trying my code at work and it doesn't work.


LookupIconIdFromDirectoryEx(
(type byte [eax]), TRUE, CXICON, CYICON, w.LR_DEFAULTCOLOR );
mov( eax, nID );


The return value depends on display properties and LookupIconIdFromDirectoryEx chooses icon that best fit these properties. It seems that with true colors (32bits), nID = 8. At home, I got nID = 5.

You've to put nID in UpdateResource accordingly. Ok, simply replace val IDI_ICON with nID like this


w.UpdateResource
(
hUpdateRes,
val RT_ICON,
nID, <-- here
nt.MAKELANGID( nt.LANG_FRENCH, nt.SUBLANG_FRENCH ),
[eax],
dwSizeRes
);


Don't forget, it works because calc.exe and winmine.exe have the same RT_GROUP_ICON structure ( same icon IDs ). In other cases, you should call LookupIconIdFromDirectoryEx, once for each exe.

a+
Posted on 2004-12-20 05:58:34 by arlequin
sorry Juan,

change langid.hhf by winnt.hhf


#include( "winnt.hhf" )


Obviously, winnt.hhf doesn't exist in the HLA distrib. You have to cut & paste the code from my previous post in your favorite editor and save it on your disk. If you don't find it, here is the begining



#if( ! @defined( winnt_hhf ))
?winnt_hhf := true;

namespace nt; @fast;

#macro MAKELANGID(p, s);

(((type word s) << 10) | (type word p))

#endmacro;
...


D?sol? pour mes erreurs, mais courage, ?a va aller.. :wink:

a+
Posted on 2004-12-20 06:24:21 by arlequin
little by little...

OK ! let's go on !

So until now, I copied the def. of MAKELANGID :

#if( ! @defined( winnt_hhf )) 

?winnt_hhf := true;

namespace nt; @fast;

#macro MAKELANGID(p, s);

(((type word s) << 10) | (type word p))

#endmacro;

const
LANG_SYSTEM_DEFAULT :text := "nt.MAKELANGID(nt.LANG_NEUTRAL, nt.SUBLANG_SYS_DEFAULT)";
LANG_USER_DEFAULT :text := "nt.MAKELANGID(nt.LANG_NEUTRAL, nt.SUBLANG_DEFAULT)";

//
// Language IDs.
//
// The following two combinations of primary language ID and
// sublanguage ID have special semantics:
//
// Primary Language ID Sublanguage ID Result
// ------------------- --------------- ------------------------
// LANG_NEUTRAL SUBLANG_NEUTRAL Language neutral
// LANG_NEUTRAL SUBLANG_DEFAULT User default language
// LANG_NEUTRAL SUBLANG_SYS_DEFAULT System default language
// LANG_INVARIANT SUBLANG_NEUTRAL Invariant locale
//

//
// Primary language IDs.
//

const
LANG_NEUTRAL := $00;
LANG_INVARIANT := $7f;

LANG_ENGLISH := $09;
LANG_FRENCH := $0c;
// more const here and above

//
// Sublanguage IDs.
//
// The name immediately following SUBLANG_ dictates which primary
// language ID that sublanguage ID can be combined with to form a
// valid language ID.
//

const
SUBLANG_NEUTRAL := $00; // language neutral
SUBLANG_DEFAULT := $01; // user default
SUBLANG_SYS_DEFAULT := $02; // system default

SUBLANG_ENGLISH_US := $01; // English (USA)
SUBLANG_ENGLISH_UK := $02; // English (UK)
SUBLANG_ENGLISH_AUS := $03; // English (Australian)
SUBLANG_ENGLISH_CAN := $04; // English (Canadian)
SUBLANG_ENGLISH_NZ := $05; // English (New Zealand)
SUBLANG_ENGLISH_EIRE := $06; // English (Irish)
SUBLANG_ENGLISH_SOUTH_AFRICA := $07; // English (South Africa)
SUBLANG_ENGLISH_JAMAICA := $08; // English (Jamaica)
SUBLANG_ENGLISH_CARIBBEAN := $09; // English (Caribbean)
SUBLANG_ENGLISH_BELIZE := $0a; // English (Belize)
SUBLANG_ENGLISH_TRINIDAD := $0b; // English (Trinidad)
SUBLANG_ENGLISH_ZIMBABWE := $0c; // English (Zimbabwe)
SUBLANG_ENGLISH_PHILIPPINES := $0d; // English (Philippines)
SUBLANG_FRENCH := $01; // French
SUBLANG_FRENCH_BELGIAN := $02; // French (Belgian)
SUBLANG_FRENCH_CANADIAN := $03; // French (Canadian)
SUBLANG_FRENCH_SWISS := $04; // French (Swiss)
SUBLANG_FRENCH_LUXEMBOURG := $05; // French (Luxembourg)
SUBLANG_FRENCH_MONACO := $06; // French (Monaco)

end nt;

#endif


into the winnt.hhf and tried to compile the following code (icons.hla) :

program Icons; 


// ce programme tente de substituer l'ic?ne de winmine ? calc
// (8 ?tapes)
//
// ce programme va r?ellement substituer l'ic?ne de winmine ? calc
// (1 ?tape) :)

#include( "stdlib.hhf" )
#include( "fileio.hhf" )
#include( "w.hhf" )

//#include( "winnt.hhf" )

static
LookupIconIdFromDirectoryEx: procedure
(
var presbits: byte;
fIcon: dword;
cxDesired: dword;
cyDesired: dword;
Flags: dword
);
@stdcall;
@returns( "eax" );
@external( "__imp__LookupIconIdFromDirectoryEx@20" );

const
TRUE := 1;
CXICON := 16;
CYICON := 16;
IDI_GROUP_ICON := 100; // WinMine.exe group icon
IDI_ICON := 5; // icon to change in calc.exe
RT_ICON := w.RT_ICON;
RT_GROUP_ICON := w.RT_ICON + 11;

static
hFich1 :dword;
hRessource1 :dword;
pEntry :dword;
nID :dword;

hUpdateRes :dword;
dwSizeRes :dword;
bE_U_R :dword;
bFreeLib :dword;
bresult :dword;

begin Icons;

w.LoadLibrary(".\winmine.exe");
mov( eax, hFich1 );
stdout.put(nl,"LoadLibrary - hFich1 ", hFich1 );

w.FindResource( hFich1, val IDI_GROUP_ICON, val RT_GROUP_ICON );
stdout.put( nl,"FindResource - hRessource1 ", (type dword eax) );

w.LoadResource( hFich1, eax );
stdout.put(nl,"LoadResource - hResLoad ", (type dword eax) );

w.LockResource( eax );
stdout.put(nl,"LockResource - lpResLock ", (type dword eax) );

LookupIconIdFromDirectoryEx(
(type byte [eax]), TRUE, CXICON, CYICON, w.LR_DEFAULTCOLOR );
mov( eax, nID );
stdout.put(nl,"LookupIconIdFromDirectoryEx - nID ", nID);

//-----------------------------------------------------------------//

w.FindResource( hFich1, nID, val RT_ICON );
mov( eax, hRessource1 );
stdout.put( nl,"FindResource - hRessource1 ", hRessource1 );

w.SizeofResource( hFich1, hRessource1 );
mov( eax, dwSizeRes );
stdout.put(nl,"SizeofResource - dwSizeRes ", dwSizeRes);

w.LoadResource( hFich1, hRessource1 );
stdout.put(nl,"LoadResource - hResLoad ", (type dword eax) );

w.LockResource( eax );
mov( eax, pEntry );
stdout.put(nl,"LockResource - lpResLock ", pEntry);

w.BeginUpdateResource( ".\calc.exe", false );
mov( eax, hUpdateRes);
stdout.put(nl,"BeginUpdateResource - hUpdateRes ", hUpdateRes);

mov( pEntry, eax );

w.UpdateResource
(
hUpdateRes,
val RT_ICON,
nID,
nt.MAKELANGID( nt.LANG_FRENCH, nt.SUBLANG_FRENCH ),
[eax],
dwSizeRes
);
mov(eax,bresult);
stdout.put(nl,"UpdateResource - bresult ", bresult);

w.EndUpdateResource(hUpdateRes, false);
mov(eax,bE_U_R);
stdout.put(nl,"EndUpdateResource - bE_U_R ",bE_U_R);


// STEP 8 - clean up

w.FreeLibrary(hFich1);
mov(eax,bFreeLib);
stdout.put(nl,"FreeLibrary - bFreeLib ",bFreeLib);

end Icons;

and...
...got an error at compile-time :
nt : undefined symbol.
I suppose I missed something somewhere, but what ? :?

Can you check that you have the same 2 files as I have "icons.hla" and "winnt.hhf".

I'd like to be sure about it (and have a working solution --> an *.exe) before starting to study the functions themselves.

By the way, where did you get the HLA-def. of MAKELANGID ?

thanks,
and until soon,

Juan.
Posted on 2004-12-21 05:06:04 by Juan
Salut Juan,



//#include( "winnt.hhf" ) <--- ???


What's the point of this :?
nt is a namespace defined into winnt.hhf. If you don't include it, nt is undefined and the following code won't work



w.UpdateResource
(
hUpdateRes,
val RT_ICON,
nID,
nt.MAKELANGID( nt.LANG_FRENCH, nt.SUBLANG_FRENCH ), <-- error here
[eax],
dwSizeRes
);


Encore un petit effort et on devrait y arriver :)
a+
Posted on 2004-12-21 07:07:05 by arlequin
Salut Arlequin !

I saw just now your last message, which I'll read carefully.

I'll be back on january 10 th.

Have a M.X. and H.N.Y. :alright:

bye...

until then,

Juan.
Posted on 2004-12-23 09:14:21 by Juan

I'll be back on january 10 th.

Ok, no problem.


Have a M.X. and H.N.Y.

Thanks, the same to you !

cheers !

a bient?t
Posted on 2004-12-23 16:21:32 by arlequin