Archived

This topic is now archived and is closed to further replies.

RQuinn

Resources in DLLs

Recommended Posts

I've been trying to implement the code from lesson 38 into a DLL of my mine. I believe all my resources are nice and proper, but hBMP=(HBITMAP)LoadImage(GetModuleHandle(NULL),MAKEINTRESOURCE(Texture[loop]), IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION); fails everytime, and GetLastError() reports #183 "Cannot create a file when that file already exists" (ERROR_ALREADY_EXISTS). Sadly I have no understanding of why it is giving this error. Might anyone be able to lend some insight? [edited by - RQuinn on July 17, 2002 10:30:56 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
HMODULE GetModuleHandle(
LPCTSTR lpModuleName // module name
);
Parameters
lpModuleName
[in] Pointer to a null-terminated string that contains the name of the module (either a .dll or .exe file). If the file name extension is omitted, the default library extension .dll is appended. The file name string can include a trailing point character (.) to indicate that the module name has no extension. The string does not have to specify a path. When specifying a path, be sure to use backslashes (\), not forward slashes (/). The name is compared (case independently) to the names of modules currently mapped into the address space of the calling process.
If this parameter is NULL, GetModuleHandle returns a handle to the file used to create the calling process.

HANDLE LoadImage(
, // handle to instance
LPCTSTR lpszName, // image to load
UINT uType, // image type
int cxDesired, // desired width
int cyDesired, // desired height
UINT fuLoad // load options
);

HINSTANCE hinst [in] Handle to an instance of the module that contains the image to be loaded. To load an OEM image, set this parameter to zero.

////////////////////////Comments

HINSTANCE and HMODULE, same difference, right? If you need the HINSTANCE of your app, use AfxGetApp()->m_hInstance;

Why are you using the MAKEINTRESOURCE macro? That macro is incase you don''t have the string name of the resource you are trying to open, only the ordinal.

Share this post


Link to post
Share on other sites