• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About tlg

  • Rank
  1. It works now. I haven't changed anything, I haven't messed around with the source code, I just went and had some lunch. Came back and hit F5, and the thing worked! weird huh?
  2. Damn this has bugging me for a few days now - feel like my head is gonna explode! Its Visual Studio .net ... hope that qualifies for this forum. Basically, I want to add 32bit tga files to the projects as resources. So, creating a custom resource type ("TGA") went fine, its just loading the resource that is a pain in the arse. I want to just get a pointer to the data, so I checked out MSDN and followed its instructions - FindResource, LoadResource, LockResource. But it doesn't work - FindResource ALWAYS fails. I've tried FindResourceEx aswell - still fails. And there is one final annoyance. MSDN says NULL is returned on error, for extended information, call GetLastError(). So I put some code after FindResource(Ex) fails to tell me what the problem is. And I get anice messagebox saying "The Operation Completed Successfully"!!!! HRSRC res = FindResource(GetModuleHandle(0), MAKEINTRESOURCE(ID_PARTICLE_IMAGE), "TGA"); if (res == NULL) { FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, NULL ); MessageBox( NULL, (LPCTSTR)lpMsgBuf, "and Windows says...", MB_OK | MB_ICONINFORMATION ); LocalFree( lpMsgBuf ); } I've tried replacing the first FindResource parameter with NULL, I've tried manually calling LoadLibrary on the exe (which succeeds), and passing the module handle to FindResource but still FindResource fails. I fired up PE Explorer just to make sure that the resource was getting compiled, and it is. Please please help a guy who is completely befounded by a problem that windows claims isn't happening. Regards, Tim [Edited by - tlg on August 18, 2004 7:17:33 AM]
  • Advertisement