|
I'm working on adding the hot-switching of languages to my app, though I have ran into a few problems. I have created sattelite dlls for each of the translated resources. I create a language selection menu at run time with the help of this[^]article. I am able to update the menu and progress bar but unable to update the main dialog. The dialog is contained within the language dlls and contains many controls (with text). So, after calling LoadLibrary how do you update the main window? BTW this is a non-MFC app.
|
|
|
|
|
Well, unless there is an easier method, I stored all the controls text into the string table and created a function to reset the text for each control
|
|
|
|
|
I have a MDI application. From CDoc, how can I get a handle on the
active document. I can do this for a SDI application:
<br />
CFrameWnd *pWndMain = (CFrameWnd *)AfxGetMainWnd();<br />
ASSERT(pWndMain != NULL);<br />
<br />
CDocument *pDoc = pWndMain->GetActiveDocument();<br />
ASSERT(pDoc);<br />
<br />
POSITION pos = pDoc->GetFirstViewPosition();<br />
<br />
CView *pView = pDoc->GetNextView(pos)<br />
How can I rewrite this code for an MDI? Please any response
any one can give me will be greatly appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
MDIGetActive() instead of GetActiveDocument should do it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Any chance you can show me more code? I cant type:
CDocument *pDoc = pWndMain->MDIGetActive();
because MDIGetActive is not a member of CFrameWnd.
How would you rewrite that portion of code that I
posted earlier for an MDI?
Sincerely,
Danielle Brina
|
|
|
|
|
|
DanYELL wrote: From CDoc, how can I get a handle on the
active document.
What's wrong with calling AfxGetMainWnd() , which is a global function, followed by GetActiveDocument() ?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hello. - Does anyone out there know of a GPRS API for C++.
Thankyou
|
|
|
|
|
flippydeflippydebop wrote: Does anyone out there know of a GPRS API for C++.
See here.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Ahh, nice 1.. thanks Dave... I will have a look into that now
|
|
|
|
|
question: Can i use the eMbedded Visual C++ 4.0 Sample with Visual C++ Studio 6?
|
|
|
|
|
I do not know. Why not try it and see?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I have created my own Excel reader which opens and reads the compound files using the ISorage and IStream classes. Everything works perfectly, but I would like to make it a little more user friendly. Here is the code used to open the file:
WCHAR wcFilename[1024];
MultiByteToWideChar(CP_ACP, 0, filename, strlen(filename)+1, wcFilename, 1024);
IStorage *pStorage = NULL;
IStream *pStream = NULL;
HRESULT hr;
hr = ::StgOpenStorage(wcFilename, NULL, STGM_READ|STGM_SHARE_EXCLUSIVE , NULL, 0, &pStorage);
if(FAILED(hr)) {
return 0;
}
When you try to open an excel file with MS Excel, and the file is already in use, it opens it as read only. I want to add the same functionality to my code, but so far I have been unable to. StgOpenStorage always returns with the 'File unavailable' (locked) error. Does anybody know of a method of doing this?
|
|
|
|
|
waldermort wrote: When you try to open an excel file with MS Excel, and the file is already in use, it opens it as re
Ehm, remove the STGM_SHARE_EXCLUSIVE flag. You're telling StgOpenStorage to open the file as read only, but you don't want to share it with anyone. Since the file is already open, you obviously can't be granted exclusive access to it.
--
The Show That Watches Back
|
|
|
|
|
I have tried a variation of just about all the flags, none of which work. The STG_E_SHAREVIOLATION is returned for each. After spending quite some time searching the web for an answer I have concluded that there isn't one. However, I am going to try copying the file to the temp directory and opening it from there. This app is a simple reader, the file would not be modified in any way at all.
|
|
|
|
|
Creating a temp copy of the file seems to work. For anybody with a similar problem here is the modified code:
if(FAILED(hr)) {
if(hr == STG_E_SHAREVIOLATION ) {
char tmpPath[MAX_PATH];
char tmpName[MAX_PATH];
GetTempPath(MAX_PATH,tmpPath);
GetTempFileName(tmpPath,"TMP",0,tmpName);
if (!CopyFile(filename,tmpName,FALSE) )
return 0;
MultiByteToWideChar(CP_ACP, 0, tmpName, strlen(filename)+1, wcFilename, 1024);
hr = ::StgOpenStorage(wcFilename, NULL, STGM_READ|STGM_SHARE_EXCLUSIVE , NULL, 0, &pStorage);
if(FAILED(hr))
return 0;
}
else
return 0;
}
|
|
|
|
|
waldermort wrote: Everything works perfectly, but
If I had a nickel for every time somebody said that in this forum...;P
|
|
|
|
|
Does StgOpenStorageEx() work any better?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I have a problem regarding keyboard navigation in child controls of dialog boxes. I have mentioned the style of the child controls to Tab stop while desining the dialog boxes . It works fine when I test the dialog boxes from Layout->Test menu option in Developer Studtio. But when i run the program the keyboard navigation does not work.
Can any one tell me the solution?
|
|
|
|
|
If you create your dialogs using the DialogBox API then there is nothing further to do. However if you have modeless dialogs (CreateDialog API) then you need the IsDialogMessage API in you main-message loop.
|
|
|
|
|
Hi,
I'm trying to program a custom control using VS2005 MFC AppWizard.
The framework code built by the wizard produces several errors, when I try to built it:
for instance:
IMPLEMENT_OLETYPELIB(CEchoCtrl, _tlid, _wVerMajor, _wVerMinor)
error C2065: '_tlid' : undeclared identifier
error C2065: '_wVerMajor' : undeclared identifier
error C2065: '_wVerMinor' : undeclared identifier
Any ideas how to fix this bug?
Thanks a lot in advance.
Matthias
|
|
|
|
|
I've had this happen when trying to add OLE automation support after my project was already created.
I had to use the GUID generator tool, to create a GUID in the IMPLEMENT_OLECREATE format and place something like the following in my Application implementation file. Your needs may be slightly different but maybe this'll help you work out the details. For what it's worth...
// {EF6B41DD-E766-45d8-B731-5923AF4B105A}
const GUID CDECL BASED_CODE _tlid =
{ 0xef6b41dd, 0xe766, 0x45d8, 0xb7, 0x31, 0x59, 0x23, 0xaf, 0x4b, 0x10, 0x5a } };
const WORD _wVerMajor = 1;
const WORD _wVerMinor = 0;
|
|
|
|
|
Hi,
Could someone please show me how to insert data to a number field in an access database. I am using ADO with safe arrays. I can insert and retrieve strings but havent got the hang of working with numbers and boolean data.
Thanks
|
|
|
|
|
Currently I am using the LVN_ITEMCHANGED notification message to update some controls containing data related to the items selected in the a list control. The problem is that since LVN_ITEMCHANGED gets called for every item that changes state even if they all change state at the same time, say 100 items get deselected at once, it makes the processing very slow.
My question is: do list controls send some kind of message notifying the parent of when they're going to start to select/deselect multiple items (I haven't found any such notifications) or what would be the best method of implementing this type of behavior?
Thanks in advance.
|
|
|
|
|
_johan wrote: do list controls send some kind of message notifying the parent of when they're going to start to select/deselect multiple items
Do you mean LVN_ITEMCHANGING ?
_johan wrote: ...what would be the best method of implementing this type of behavior?
After each item has been selected, why not just iterate through each one using:
POSITION pos = m_list.GetFirstSelectedItemPosition();
while (pos != NULL)
{
int nItem = m_list->GetNextSelectedItem(pos);
}
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|