Click here to Skip to main content
15,890,512 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to get access right to Registry in Vista Pin
Stuart Dootson29-Mar-09 23:26
professionalStuart Dootson29-Mar-09 23:26 
GeneralRe: How to get access right to Registry in Vista Pin
Nitheesh George30-Mar-09 3:12
Nitheesh George30-Mar-09 3:12 
QuestionProblem getting element from CDHtmlDialog when loading the HTML from a file using Navigate() Pin
electric_one200129-Mar-09 21:35
electric_one200129-Mar-09 21:35 
AnswerRe: Problem getting element from CDHtmlDialog when loading the HTML from a file using Navigate() Pin
led mike30-Mar-09 4:38
led mike30-Mar-09 4:38 
GeneralRe: Problem getting element from CDHtmlDialog when loading the HTML from a file using Navigate() Pin
electric_one200130-Mar-09 6:40
electric_one200130-Mar-09 6:40 
AnswerRe: Problem getting element from CDHtmlDialog when loading the HTML from a file using Navigate() Pin
jerryworm14-Nov-09 22:47
jerryworm14-Nov-09 22:47 
QuestionImages in Dll Pin
kiranin29-Mar-09 21:33
kiranin29-Mar-09 21:33 
AnswerRe: Images in Dll [modified] Pin
Stuart Dootson29-Mar-09 22:12
professionalStuart Dootson29-Mar-09 22:12 
Yes. Add them into the resource file. I've added an HTML file (contained in the 'res' sub-directory of my project) to my resources using this entry in the resource (.RC) file:

ABOUTDIALOG.HTML        HTML                    "res\\aboutdia.htm"


You could use (for example)

TEST.JPG        JPG                    "res\\test.jpg"


You can then use a code fragment like the following to load a resource into memory:

std::string LoadFileFromResource(HINSTANCE hmodResource, LPCTSTR name, LPCTSTR type)
{
   if (!type)
      type = ::PathFindExtension(name) + 1;
   HRSRC rsrcFile = ::FindResource(hmodResource, name, type);
   if (!rsrcFile) return std::string();
   HGLOBAL gblFile = ::LoadResource(hmodResource, rsrcFile);
   if (!gblFile) return std::string();
   DWORD sizeFile = ::SizeofResource(hmodResource, rsrcFile);
   if (!sizeFile) return std::string();
   LPVOID filePointer = ::LockResource(gblFile);
   if (filePointer)
   {
      std::string contents((char*)filePointer, sizeFile);
      ::FreeResource(gblFile);
      return contents;
   }
   return std::string();
}


[edit]You'd call that function a bit like this:

std::string loadedJpeg = LoadFileFromResource(resourceDllHandle, _T("TEST.JPG"), _T("JPG"));


std::string might not be the best result type for you, as you're loading a binary file - I've only loaded text files with this...[/edit]

HTH!

Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p

modified on Thursday, April 2, 2009 5:25 AM

GeneralRe: Images in Dll Pin
kiranin30-Mar-09 1:51
kiranin30-Mar-09 1:51 
GeneralRe: Images in Dll Pin
Stuart Dootson30-Mar-09 1:56
professionalStuart Dootson30-Mar-09 1:56 
GeneralRe: Images in Dll Pin
kiranin30-Mar-09 1:59
kiranin30-Mar-09 1:59 
GeneralRe: Images in Dll Pin
Stuart Dootson30-Mar-09 2:03
professionalStuart Dootson30-Mar-09 2:03 
GeneralRe: Images in Dll Pin
kiranin4-Apr-09 1:18
kiranin4-Apr-09 1:18 
GeneralRe: Images in Dll Pin
Stuart Dootson4-Apr-09 2:38
professionalStuart Dootson4-Apr-09 2:38 
GeneralRe: Images in Dll [modified] Pin
kiranin4-Apr-09 2:53
kiranin4-Apr-09 2:53 
GeneralRe: Images in Dll Pin
Stuart Dootson4-Apr-09 8:51
professionalStuart Dootson4-Apr-09 8:51 
QuestionProblem while setting text to a control using WM_SETTEXT with SendMessage API Pin
PankajB29-Mar-09 21:30
PankajB29-Mar-09 21:30 
AnswerRe: Problem while setting text to a control using WM_SETTEXT with SendMessage API Pin
CPallini29-Mar-09 21:38
mveCPallini29-Mar-09 21:38 
GeneralRe: Problem while setting text to a control using WM_SETTEXT with SendMessage API Pin
safeer vengasseri20-Aug-09 5:14
safeer vengasseri20-Aug-09 5:14 
Questionproblem with debug mode Pin
kir_MFC29-Mar-09 20:42
kir_MFC29-Mar-09 20:42 
QuestionCOM port number identification Pin
AnayKulkarni29-Mar-09 19:58
AnayKulkarni29-Mar-09 19:58 
AnswerRe: COM port number identification Pin
«_Superman_»29-Mar-09 20:59
professional«_Superman_»29-Mar-09 20:59 
AnswerRe: COM port number identification Pin
Jonathan Davies30-Mar-09 3:54
Jonathan Davies30-Mar-09 3:54 
Question[Message Deleted] Pin
Purish Dwivedi29-Mar-09 19:08
Purish Dwivedi29-Mar-09 19:08 
AnswerRe: how to conditionally select a DLL on detecting a language pack? Pin
CPallini29-Mar-09 21:32
mveCPallini29-Mar-09 21:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.