FindResource fails....

This is a discussion on FindResource fails.... within the Windows Programming forums, part of the Platform Specific Boards category; I am not sure why this is failing with Error code 1813 is ERROR_RESOURCE_TYPE_NOT_FOUND , "test.dll is in the same ...

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    303

    FindResource fails....

    I am not sure why this is failing with Error code 1813 is ERROR_RESOURCE_TYPE_NOT_FOUND , "test.dll is in the same directory as the source files and it compiles fine...

    Code:
    #include "stdafx.h"
    #include "WinApp.h"
    #include <windows.h>
    
    in resource.h there is #define ID_DLL                   106
    in WinApp.rc there is ID_DLL                RC_DATA    "test.dll"
    
    #define MAX_LOADSTRING 100
    char OutBuffer[64];
    
    int APIENTRY _tWinMain(HINSTANCE hInstance,
                         HINSTANCE hPrevInstance,
                         LPTSTR    lpCmdLine,
                         int       nCmdShow)
    {
    	HRSRC hResInfo = FindResource(NULL,MAKEINTRESOURCE(ID_DLL),RT_RCDATA);
    	if(hResInfo != NULL)
    	{
    		MessageBox(NULL,"FindResource Loaded","",0);
    	}
    	else
    	{
    		wsprintf(OutBuffer,"%s %d\n","FindResource Failed",GetLastError());
    		MessageBox(NULL,OutBuffer,"",0);
    	}
    	return 0;
    }

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,855
    Try...

    Code:
    FindResource(hInstance,MAKEINTRESOURCE(ID_DLL),RT_RCDATA);
    Depending on how you defined the data you may need to use "DLL" (with quotes) instead of RC_DATA
    Last edited by novacain; 03-15-2010 at 11:44 PM.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 21
    Last Post: 06-24-2009, 09:49 AM
  2. Mac - File locking with fcntl() fails on shared volumes!?
    By idelovski in forum Linux Programming
    Replies: 3
    Last Post: 11-10-2008, 06:37 PM
  3. FindResource Fails
    By cloudy in forum Windows Programming
    Replies: 6
    Last Post: 08-20-2006, 07:03 AM
  4. Replies: 0
    Last Post: 05-23-2005, 11:39 AM
  5. c++ ISAPI fails to call VB dll
    By froque in forum Windows Programming
    Replies: 0
    Last Post: 08-22-2003, 02:06 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21