Click here to Skip to main content
16,005,141 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generalsending broadcast packets Pin
Mridang Agarwalla6-May-05 17:13
Mridang Agarwalla6-May-05 17:13 
GeneralRe: sending broadcast packets Pin
CodeBeetle8-May-05 9:44
CodeBeetle8-May-05 9:44 
GeneralRe: sending broadcast packets Pin
Mridang Agarwalla8-May-05 17:18
Mridang Agarwalla8-May-05 17:18 
GeneralCString Pin
locoone6-May-05 15:52
locoone6-May-05 15:52 
GeneralRe: CString Pin
simon wan6-May-05 15:59
simon wan6-May-05 15:59 
GeneralRe: CString Pin
ThatsAlok6-May-05 21:33
ThatsAlok6-May-05 21:33 
GeneralEmbeded Executable Resource Pin
zx2c46-May-05 15:15
zx2c46-May-05 15:15 
GeneralRe: Embeded Executable Resource Pin
Gary R. Wheeler8-May-05 4:34
Gary R. Wheeler8-May-05 4:34 
The following is a general purpose method for retrieving any binary data from your program's resources:
HRSRC resource_handle = ::FindResource(AfxGetResourceHandle(),
                                       MAKEINTRESOURCE(IDR_PROGRAM),
                                       "PROGRAM");
if (resource_handle != NULL) {
    HGLOBAL resource_memory = ::LoadResource(AfxGetResourceHandle(),
                                             resource_handle);
    if (resource_memory != NULL) {
        LPVOID resource_data = ::LockResource(resource_memory);
        DWORD  resource_size = ::SizeofResource(AfxGetResourceHandle(),
                                                resource_handle);
        if ((resource_data != NULL) && (resource_size > 0)) {
            // write resource data to PROGRAM.EXE
            // and then execute it
        }
    }                                               
}
The corresponding resource.h and .RC look like this:
// resource.h:
#define IDR_PROGRAM 1234
// .RC
IDR_PROGRAM PROGRAM "Program.exe"
I've used this method a number of times. It's handy for simple programs. For example, I've got a tool application that consists of a single .EXE and a help file. Rather than make an install, I include the help file in the .EXE as a resource, and extract it as necessary.



Software Zen: delete this;
GeneralRe: Embeded Executable Resource Pin
Gary R. Wheeler8-May-05 4:39
Gary R. Wheeler8-May-05 4:39 
GeneralCFileDialog customization Pin
Anonymous6-May-05 14:09
Anonymous6-May-05 14:09 
GeneralRe: CFileDialog customization Pin
Jaime Olivares6-May-05 15:23
Jaime Olivares6-May-05 15:23 
GeneralVC++ 6.0 Class Wizard parsing problem Pin
humots6-May-05 13:36
humots6-May-05 13:36 
GeneralRe: VC++ 6.0 Class Wizard parsing problem Pin
Gary R. Wheeler8-May-05 4:43
Gary R. Wheeler8-May-05 4:43 
Generalno scroll clock display Pin
knapak6-May-05 12:04
knapak6-May-05 12:04 
GeneralRe: no scroll clock display Pin
khan++6-May-05 19:45
khan++6-May-05 19:45 
GeneralRe: no scroll clock display Pin
Ravi Bhavnani7-May-05 4:02
professionalRavi Bhavnani7-May-05 4:02 
Question24 bit DIB has different values on PPC and Desktop PC? Pin
georgiek506-May-05 11:52
georgiek506-May-05 11:52 
AnswerRe: 24 bit DIB has different values on PPC and Desktop PC? Pin
Chris Losinger7-May-05 6:40
professionalChris Losinger7-May-05 6:40 
QuestionAre their any comment plugins for vs.net to help c++? Pin
FocusedWolf6-May-05 11:46
FocusedWolf6-May-05 11:46 
AnswerRe: Are their any comment plugins for vs.net to help c++? Pin
FocusedWolf6-May-05 12:02
FocusedWolf6-May-05 12:02 
GeneralRe: Are their any comment plugins for vs.net to help c++? Pin
Gary R. Wheeler8-May-05 4:49
Gary R. Wheeler8-May-05 4:49 
GeneralHeap error when init'ing AcDbDatabase Pin
Ista6-May-05 11:34
Ista6-May-05 11:34 
Questioncan u terminate the dos window? Pin
includeh106-May-05 11:20
includeh106-May-05 11:20 
AnswerRe: can u terminate the dos window? Pin
CodeBeetle8-May-05 9:50
CodeBeetle8-May-05 9:50 
GeneralWin. Task Manager question for VC++. HELP! Pin
6-May-05 9:55
suss6-May-05 9:55 

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.