|
I have created a Resource-only Dll viz. Language, which includes only resources i.e
Dialogs,
Toolbars,
Acceleraters,
Bitmaps,
Icons,
String Tables,
Version etc.
I have created one Dialog Based Application viz. LanguageApp, which includes only code - nothing else.
Now, I want to load each-n-every resource from the dll Language to application LanguageApp without including resource.h file of the dll.
<big>Provided that</big> : <big>Any modification done to dll should not cause application to build/compile again</big>
« Where There Is A Will There Is A Way »
|
|
|
|
|
So, what is your question here?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
...formerly known as brahmma
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Use the APIs FindResource and LoadResource .
Maxwell Chen
|
|
|
|
|
Punit Shah wrote: Provided that : Any modification done to dll should not cause application to build/compile again
Hence you cannot add resources to the DLL!
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
CPallini wrote: Hence you cannot add resources to the DLL!
Indeed!
Maxwell Chen
|
|
|
|
|
Hi all,
I want to add two radio buttons to select two states, + or - option. How can I do that.
I've try this, add to radio buttons and add member variables to them as well. Then I want to get the user selected state from there and do my processing. But I've no luck to find it.
I appreciate your help all the time...
Eranga
|
|
|
|
|
|
Are you talking about the GetCheck() and SetCheck() methods?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
dear all
fatal error C1010: unexpected end of file while looking for precompiled header directive
how to solve this prolbem? thanks
Li Zhiyuan
7/1/2008
|
|
|
|
|
Add this on the topmost line in .cpp files.
#include "stdafx.h"
Maxwell Chen
|
|
|
|
|
thanks, but i am using vc++ 2005, it need to add it yet? thanks
Li Zhiyuan
5/10/2006
|
|
|
|
|
li zhiyuan wrote: thanks, but i am using vc++ 2005, it need to add it yet? thanks
Where is the project from? You created it? Or you got from someone else?
If the project is created by yourself, either project type MFC or Win32 generates an "stdafx.h " file automatically in the project folder, unless you were starting from an empty project.
Maxwell Chen
|
|
|
|
|
|
u right click your source code .cpp, and go to setting,in category, u choose precompiled headers and also check not use precompiled headers..that is all..any problem, tell me..
Li Zhiyuan
5/10/2006
|
|
|
|
|
li zhiyuan wrote: u right click your source code .cpp, and go to setting, ... any problem, tell me..
Maxwell Chen
|
|
|
|
|
Per MSDN:
A precompiled header was specified, but it did not contain a precompiled header directive.
This error can be caused by specifying an incorrect file as a header file, or by specifying an include file with the /Yu (Use Precompiled Header) command line option that is not listed in the source file as an include file.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
I am creating an MFC app as well as learning about design patterns and good coding practices, and so I've got a question for you whizzes...
I am creating a class to control a dialog which fills in a DirectX materials structure:
typedef struct _D3DMATERIAL9 {
D3DCOLORVALUE Diffuse;
D3DCOLORVALUE Ambient;
D3DCOLORVALUE Specular;
D3DCOLORVALUE Emissive;
float Power;
} D3DMATERIAL9;
My question is thus:
The class I am creating for this control should take a pointer to a struct (as above) as an argument for it's constructor. This is not a problem if the control is being used as a modal dialog:
D3DMATERIAL9 Mat;
CDX9MaterialDialog dlg(&Mat);
INT_PTR nResponse = dlg.DoModal();
But when the dialog is being used as a child, I have to declare the class as a member of the parent dialog, right? How can I ensure that the my class is initialized with a valid pointer, when the parent dialog class will use the default no argument constructor for the class?
I would like to make sure that the dialog is initialized with a pointer so that the dialog class is not responsible for creating (and deleting) a new material structure.
Thanks - @LG
|
|
|
|
|
in the dialog, you will have a member pointer to the D3DMATERIAL9 structure, just be certain you initialize it to NULL in the constructure; and create a Set function to set the structure in the dialog.
in pseudo code.
class YourDialog
{
YourDialog();
D3DMATERIAL9* m_pMaterial;
void SetMaterial( D3DMATERIAL9* pMaterial) { ASSERT( pMaterial); m_pMaterial = pMaterial;};
};
YourDialog::YourDialog() : m_pMaterial(NULL)
{
}
and now, it's your job to check that each time you access m_pMaterial it is not NULL.
|
|
|
|
|
it adds more coupling between YourDialog and clients, assume what does it happen if doing this:
D3DMATERIAL9 *pMeterial = new D3DMATERIAL9 ;
YourDialog dlg;
dlg.SetMaterial(pMeterial);
delete pMeterial;
dlg.Dosomething(); //this function relies on m_pMaterial
it undoubtedly uses an invalid pointer, I think the better way is either change the function name to make callers clear YourDialog instance is attached to D3DMATERIAL9 pointer or maitance a D3DMATERIAL9 object inside of YourDialog class. it's much easier to change function name to: YourDilaog::AttachMaterial(D3DMATERIAL9 *pMaterial)
life is like a box of chocolate,you never know what you r going to get.
|
|
|
|
|
Thanks for the insights you guys.
Will, I think you're right... in either case the only way for the dialog to be sure that the D3DMATERIAL9 structure is valid is if it maintains one locally and copies it's value to one supplied by a client on request.
Sucks, 'cuz that will slow everything down a bit, but I can't see a way around it.
-@LRG
|
|
|
|
|
So I'm making a dialog based app in MFC, and I'd like to make a child Dialog that is acts like a control and part of my parent dialog... Seems like a very easy task, but for some reason I must be doing something wrong... I see a tutorial here on CP explaining it (http://www.codeproject.com/KB/dialog/CRHChildDialog.aspx[^]), but I don't like that solution, I'd rather not have to include someone else's custom code in my project...
Anyone know of any other tutorials?
Sorry if this has been asked before; I searched and didn't find much.
|
|
|
|
|
Well, the mentionned article looks like a great tutorial, it probably wraps usual code for doing that sort of task :
but it general it goes like that ( will not show you code since you do not want to use someone else's code )
- create parent dialog resource with a "placeholder" for the child dialog.
- create dialog resource with the "control parent" style (and another flag that I forget the name )
- create the parent dialog as you would do normally.
- in the OnInitDialog, get the RECT of the placeholder, create the child dialog (as a member of the parent dialog). Create it in the appropriate position, using the RECT.
normaly, that will be sufficent (as far as I can recall now )
|
|
|
|
|
Hmmm, I'm getting a crash/assert when I try and do it myself in
void AFXAPI AfxHookWindowCreate(CWnd* pWnd)
on the line: ASSERT(pWnd->m_hWnd == NULL);
Any ideas why? I googled for an answer to this problem, and although I found 10 pages of other people having the problem, I didn't see any answers
This is what I'm doing: (following the tutorial minus the part about using his giant class)
- I created a parent dialog, put a placeholder resource on it where the child will go
- created the child dialog resource with Style: Child, Border: None, Control: True
- created a normal parent dialog as I always do
- in the parent's DoDataExchange i used the DDX_Control function to tie the placeholder resource to my Child member object
- in the parent's OnInitDialog i call .Create for the child dialog, there is only 2 versions of create, wich both take the Template ID/Name, and a CWnd*, so i passed the child resource's ID (IDD_CHILDDIALOG), and "this"
any ideas?
|
|
|
|
|
|
Hi All,
I have ported ported code from a 16 bit embedded system to run in MSVC for testing purposes. One of the tasks is to simulate the same memory layout that the target has.
I'm running into padding/packing/alignment issues with MSVC sections. Maybe I'm doing something wrong. I've been an embedded developer for 16 years and never touched Windows programming.
I can't really restructure the code for MSVC. There are MANY variables that are being placed in specific places in memory so that they can be cleared with a memset. But those variables are declared all over the place.
Any help would be great.
I found on the web that you can get memory ordered by using the $ in the section name and make them alphabetical.
Here is my code snippet.
----------------------------------------------------------------
#pragma bss_seg(push, "MY$AA")
ee_block_bl_type ee_bbl; // ee_block_bl_type is 69 bytes
#pragma bss_seg(pop)
#pragma bss_seg(push, "MY$AB")
ee_block_mfg_type ee_bmfg;
#pragma bss_seg(pop)
----------------------------------------------------------------
Compile and run and get:
&ee_bbl = 0x01260000
&ee_bmfg = 0x01260158
----------
Diff = 0x00000158 = 344 bytes
344 just seems so arbitrary. 344 = 256 + 80 + 8??
Does anyone know hoe Visual Studio pads/packs/aligns its sections?
Can I do a memset on all of "MY" section without wiping something else out?
Any way to get it to pack the sections into byte alignment?
For the embedded target there is a linker directive file that takes care of all of this. Can MSVC have a "linker directive" file? I see an option for a Module Definition File but I don't think that'll do it.
I have exhauseted all of the info I can find on the web...
-Brad
|
|
|
|