Click here to Skip to main content
15,899,825 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: write Series of this program 1+-3+5+-7+9+-11 in c++ Pin
«_Superman_»12-May-14 19:11
professional«_Superman_»12-May-14 19:11 
AnswerI can only point you in the right direction... Pin
Software_Developer12-May-14 23:42
Software_Developer12-May-14 23:42 
AnswerRe: write Series of this program 1+-3+5+-7+9+-11 in c++ Pin
C_Vivek Arya13-May-14 5:33
C_Vivek Arya13-May-14 5:33 
GeneralRe: write Series of this program 1+-3+5+-7+9+-11 in c++ Pin
CPallini13-May-14 5:52
mveCPallini13-May-14 5:52 
Questionhow to design the architecture? Pin
Falconapollo12-May-14 0:09
Falconapollo12-May-14 0:09 
AnswerRe: how to design the architecture? Pin
«_Superman_»12-May-14 1:05
professional«_Superman_»12-May-14 1:05 
GeneralRe: how to design the architecture? Pin
Falconapollo12-May-14 14:56
Falconapollo12-May-14 14:56 
GeneralRe: how to design the architecture? Pin
«_Superman_»12-May-14 19:34
professional«_Superman_»12-May-14 19:34 
Falconapollo wrote:
>>it is even possible to embed the resource only DLL into the EXE itself.

could you explain how to do it? If successfully do it, how can submodule access the resource?

To embed a DLL in the resource, first create a custom type resource -
Right click on the .rc file in the resource view and select Add Resource -> Custom.
Give it any name like DLL.
The newly created resource will open in a binary editor and will be blank.
Now open the DLL file using the binary editor by using File -> Open, select the DLL and choose Open With -> Binary editor.
Select all the contents of the DLL (Ctrl + A), copy and paste it in the newly created resource file and save it.

To access the resource at runtime, do the following -
Use FindResource[^] to locate the resource.
Use SizeofResource[^] to get the size of the resource.
Use LoadResource[^] to get a handle to the resource.
Use LockResource[^] to get a pointer to the memory where the resource is loaded.
Use CopyMemory[^] to copy the resource contents into a buffer.
Now Create a new binary file using CreateFile[^].
Use WriteFile[^] to write the contents of the buffer into the file.

Now you have a resource only DLL file on disk that you can use just like a normal resource only DLL file.

Falconapollo wrote:
>>If you do not want the resource extraction to be done at runtime, you could embed the resources in the static library itself.

as far as i can see, it's not possible to embed resources into static library directly, could you explain your idea?

You can create resources in static libraries in the exact same way as you do in an EXE or DLL project.
However, there are some caveats to it.
Read about it here -
VC++ resources in a static library[^]
LINKING RESOURCES FROM A STATIC LIBRARY[^]
«_Superman 
I love work. It gives me something to do between weekends.


Microsoft MVP (Visual C++) (October 2009 - September 2013)

Polymorphism in C

GeneralRe: how to design the architecture? Pin
Falconapollo12-May-14 19:47
Falconapollo12-May-14 19:47 
GeneralRe: how to design the architecture? Pin
«_Superman_»12-May-14 19:59
professional«_Superman_»12-May-14 19:59 
GeneralRe: how to design the architecture? Pin
Falconapollo12-May-14 20:04
Falconapollo12-May-14 20:04 
QuestionPosition Of Taskbar in MFC Pin
Member 945167311-May-14 22:40
Member 945167311-May-14 22:40 
AnswerRe: Position Of Taskbar in MFC Pin
Richard MacCutchan11-May-14 23:12
mveRichard MacCutchan11-May-14 23:12 
AnswerRe: Position Of Taskbar in MFC Pin
«_Superman_»11-May-14 23:13
professional«_Superman_»11-May-14 23:13 
QuestionHow can I fix memory leaks with CMFCVisualManager? Pin
Andrew Truckle9-May-14 21:06
professionalAndrew Truckle9-May-14 21:06 
AnswerRe: How can I fix memory leaks with CMFCVisualManager? Pin
ahmad_ali16-May-14 5:42
ahmad_ali16-May-14 5:42 
AnswerRe: How can I fix memory leaks with CMFCVisualManager? Pin
Andrew Truckle16-May-14 5:45
professionalAndrew Truckle16-May-14 5:45 
QuestionHow to change the "application menu" button on the CMFCRibbonBar Pin
Andrew Truckle9-May-14 21:04
professionalAndrew Truckle9-May-14 21:04 
Questionhow to detect Blue Screen Of Death in my driver Pin
Member 84685749-May-14 17:24
Member 84685749-May-14 17:24 
AnswerRe: how to detect Blue Screen Of Death in my driver Pin
«_Superman_»9-May-14 22:01
professional«_Superman_»9-May-14 22:01 
AnswerRe: how to detect Blue Screen Of Death in my driver Pin
Munchies_Matt10-May-14 11:00
Munchies_Matt10-May-14 11:00 
QuestionHow to create lib file for header file alone. Pin
shanmugarajaa8-May-14 20:51
shanmugarajaa8-May-14 20:51 
GeneralRe: How to create lib file for header file alone. Pin
CPallini8-May-14 21:50
mveCPallini8-May-14 21:50 
GeneralRe: How to create lib file for header file alone. Pin
Richard MacCutchan8-May-14 22:45
mveRichard MacCutchan8-May-14 22:45 
GeneralRe: How to create lib file for header file alone. Pin
leon de boer8-May-14 23:51
leon de boer8-May-14 23:51 

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.