🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.windows.ms
Article #7512

Re: Getting Icons from DLL

#7512
From: Bill Turner
Date: Tue, 11 Dec 1990 17:59
33 lines
1566 bytes
>>Now that I can load icons I was wondering if there was a way to retrieve
>>icons from a DLL file so that I may use them one at a time instead of having
>>to go through all of the icons in the file?
>
>Speaking of which: is there a way to combine all those 
>.ico files (can never remember what they're called!) 
>into a .DLL file?

Yes, and Yes.

First, to put icons into a DLL you specify them in the .RC file for the DLL.
(The only way to put them into a DLL is to use RC to stuff 'em in.)  The
process is just the same as for puting resources into an .EXE file.

Second, to use them, you can use the following:  (*warning, this is Windows
2.0 code, since I don't do 3.0 dev I don't know if these have changed
slightly or not...)

    hLib = LoadLibrary(lpLibFileName);
/* 
 *  or
 * 
 *  hLib = GetModuleHandle(lpLibFileName);
 *
 *  if the library is already loaded
 */
    hIcon = LoadIcon(hLib, lpIconName);

Be aware that keeping the icon handle after the library is unloaded can
cause problems....

--Bill Turner (bturner@hp-pcd.cv.hp.com)
HP Interface Technology Operation
Technical Details
Message-ID: <106580090@hpcvlx.cv.hp.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!sdd.hp.com!hp-pcd!hpcvlx!bturner
References: <1990Dec7.192958.5023@uvm.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!sdd.hp.com!hp-pcd!hpcvlx!bturner
From: bturner@hpcvlx.cv.hp.com (Bill Turner)
Newsgroups: comp.windows.ms
Subject: Re: Getting Icons from DLL
Message-ID: <106580090@hpcvlx.cv.hp.com>
Date: 11 Dec 90 17:59:20 GMT
References: <1990Dec7.192958.5023@uvm.edu>
Organization: Hewlett-Packard Co., Corvallis, OR, USA
Lines: 33