|
To add to Michael's reply...
If the Japanese string is Unicode then you don't want to store it in a TCHAR array. It should be
in a wchar_t array. Then use a CStringW instead of a generic CString.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Can somebody help me on how to change the caption in StringTable programmatically. Like i will select an ID and change it's caption through code.
|
|
|
|
|
Look up the APIs BeginUpdateResource, UpdateResource, EndUpdateResource. For a description of the in-memory format of string tables, see here[^].
|
|
|
|
|
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Actually, to be specific, what i need is a code that will modify a particular ID in StringTable resource and read that data later in the program. I am using Windows CE/Pocket PC MFC.
|
|
|
|
|
Hi All,
I am facing a small problem in accessing a member variable .
the code looks like this .
((CWmApp *)AfxGetApp())->m_WMIDE.m_bLaunchedFromIDE
... This is not working.
where as when i replace the above code with theApp.m_WMIDE.m_bLaunchedFromIDE
it is working.
my doubt is, can we directly use the theApp instance to access its member variables ??
Thanks in advance.
Appu..
"My blood group is not B+.But I have it my blood"
|
|
|
|
|
When you say it's not working what do you mean? Does it compile? If not what is the error message? If it does compile does it fail at runtime and in what manner?
Steve
|
|
|
|
|
I mean, ((CWmApp *)AfxGetApp())->m_WMIDE.m_bLaunchedFromIDE is not returning the correct value,
where as theApp.m_WMIDE.m_bLaunchedFromIDE is returning right value.
Appu..
"My blood group is not B+.But I have it my blood"
|
|
|
|
|
If you add the following:
ASSERT( static_cast<CWmApp*>(AfxGetApp()) == &theApp );
1. Does is compile?
2. If it compiles does the ASSERT fire at runtime in a debug build?
Steve
|
|
|
|
|
AfxGetApp() should only be used to access CWinApp members. Casting the CWinApp pointer will not do what you want.
If it were me and I needed access to the data from anywhere in the app, I would create a separate .h file and make it global OUTSIDE the scope of the app class, along with appropriate Get/Set functions you might deem necessary.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
There is nothing wrong with downcasting assuming CWmApp is derived from CWinApp .
Steve
|
|
|
|
|
I'm kicking a dead horse here, but...
If "theApp" is the one-and-only CWinApp object in the MFC application, then both methods should
work the same.
What happens if you use a more safe cast?
CWmApp *pApp = DYNAMIC_DOWNCAST(CWmApp, AfxGetApp());
if (pApp)
{
pApp->m_WMIDE.m_bLaunchedFromIDE ...
}
Is pApp NULL after the cast?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
NiceNaidu wrote: ((CWmApp *)AfxGetApp())->m_WMIDE.m_bLaunchedFromIDE
... This is not working.
Is CWmApp a CWinApp -derived class?
What type of pointer is AfxGetApp() returning?
NiceNaidu wrote: can we directly use the theApp instance to access its member variables ??
Yes.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sorry friends for not responding to your replies.
It worked fine with theApp.
DavidCrow wrote: Is CWmApp a CWinApp-derived class?
Yes,CWmApp is a CWinApp-derived class.
Thank you all for all your replies.
Appu..
"My blood group is not B+.But I have it my blood"
|
|
|
|
|
Did you ever figure out what type of pointer AfxGetApp() is returning?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
how to use this property to set the minimum size of a resizable window?
nathan
|
|
|
|
|
You need overrid CWnd::OnGetMinMaxInfo .
Sample code would look like this,
void CMyWnd::OnGetMinMaxInfo(MINMAXINFO* lpMMI)
{
lpMMI->ptMinTrackSize.x = 300;
lpMMI->ptMinTrackSize.y = 200;
}
Prasad
MS MVP - VC++
|
|
|
|
|
Hi all,
I developed an application as an installation in VC++. I am using Visual Studio 2005. The installation works perfectly. The problem arises when I am trying to install the application in a system without .net framework. Then the installation fails. This may be because of some additional dependency of the installation. How can I remove this additional dependency? The requirement specifies that no additional dependency should be there...
Can anybody please help me...
Thanks in Advance.....
|
|
|
|
|
You need to run vcredist_x86 on the target machine, this will install the required dll's. You can download it from here[^].
|
|
|
|
|
Did you not ask this[^] question yesterday? Or is that you've developed a new application today? Well, it applies for all new applications that you develop.
|
|
|
|
|
I thought the question looked familiar...
|
|
|
|
|
thanks Mark:
i have these code in OnInitDialog
CTreeCtrl * tree = new CTreeCtrl();
CRect rect = new CRect(10, 10, 200, 200);
bool suc = tree->Create(WS_THICKFRAME, rect, this, IDC_TREE);
because WS_THICKFRAME, i can resize the tree control in run time
how can i override the OnSize method of this tree control?
also, how can i prevent the user from dragging the top and left border of the tree control to resize it?
Thanks!
|
|
|
|
|
nathan7 wrote: i have these code in OnInitDialog
CTreeCtrl * tree = new CTreeCtrl();
Why is this not a member of your dialog class?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
nathan7 wrote: Mark Salsbery pls come in
Hola.
nathan7 wrote: bool suc = tree->Create(WS_THICKFRAME, rect, this, IDC_TREE);
You may want (or need) the WS_VISIBLE, WS_CHILD, and WS_BORDER flags as well, plus any treeview-
specific styles.
nathan7 wrote: how can i override the OnSize method of this tree control?
Derive a class from CTreeCtrl and add a WM_SIZE handler there.
nathan7 wrote: also, how can i prevent the user from dragging the top and left border of the tree control to resize it?
I believe you can use the WM_SIZING message. This would be done in the derived class as well.
Also, see David Crow's reply - you'll probably want to deal with the scope of your "tree"
variable!
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|