|
I haven't tried this but it should work.. where 0 is the first item on the menu like "File".
CMenu *pMenu = GetMenu();
CString csMnuStr;
pMenu->GetMenuString(0, csMnuStr, MF_BYPOSITION);
pMenu->ModifyMenu(0, MF_BYPOSITION, 0, "New Text");
DrawMenuBar();
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Thanks!
Now automaticly all the menu-item texts goes through a translate function. So that my program works with different language's.
<br />
CMenu *pMenu = GetMenu();<br />
CMenu *pSubMenu;<br />
CMenu *pSubSubMenu;<br />
<br />
CString csMnuStr;<br />
<br />
for(int i=0; pMenu->GetMenuState(i, MF_BYPOSITION) != -1; i++)
{<br />
if(pMenu->GetMenuString(i, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pMenu->ModifyMenu(i, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
<br />
pSubMenu = pMenu->GetSubMenu(i);
<br />
if(pSubMenu == NULL)
continue;<br />
<br />
for(int j=0; pSubMenu->GetMenuState(j, MF_BYPOSITION) != -1; j++)
{<br />
if(pSubMenu->GetMenuString(j, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pSubMenu->ModifyMenu(j, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
<br />
pSubSubMenu = pSubMenu->GetSubMenu(j);
<br />
if(pSubSubMenu == NULL)
continue;<br />
<br />
for(int k=0; pSubSubMenu->GetMenuState(k, MF_BYPOSITION) != -1; k++)
{<br />
if(pSubSubMenu->GetMenuString(k, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pSubSubMenu->ModifyMenu(k, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
} <br />
}<br />
}<br />
DrawMenuBar();<br />
|
|
|
|
|
Thanks!
Now automaticly all the menu-item texts goes through a translate function. So that my program works with different language's.
<br />
CMenu *pMenu = GetMenu();<br />
CMenu *pSubMenu;<br />
CMenu *pSubSubMenu;<br />
<br />
CString csMnuStr;<br />
<br />
for(int i=0; pMenu->GetMenuState(i, MF_BYPOSITION) != -1; i++)
{<br />
if(pMenu->GetMenuString(i, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pMenu->ModifyMenu(i, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
<br />
pSubMenu = pMenu->GetSubMenu(i);
<br />
if(pSubMenu == NULL)
continue;<br />
<br />
for(int j=0; pSubMenu->GetMenuState(j, MF_BYPOSITION) != -1; j++)
{<br />
if(pSubMenu->GetMenuString(j, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pSubMenu->ModifyMenu(j, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
<br />
pSubSubMenu = pSubMenu->GetSubMenu(j);
<br />
if(pSubSubMenu == NULL)
continue;<br />
<br />
for(int k=0; pSubSubMenu->GetMenuState(k, MF_BYPOSITION) != -1; k++)
{<br />
if(pSubSubMenu->GetMenuString(k, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pSubSubMenu->ModifyMenu(k, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
} <br />
}<br />
}<br />
DrawMenuBar();<br />
|
|
|
|
|
Thanks!
Now automaticly all the menu-item texts goes through a translate function. So that my program works with different language's.
<br />
CMenu *pMenu = GetMenu();<br />
CMenu *pSubMenu;<br />
CMenu *pSubSubMenu;<br />
<br />
CString csMnuStr;<br />
<br />
for(int i=0; pMenu->GetMenuState(i, MF_BYPOSITION) != -1; i++)
{<br />
if(pMenu->GetMenuString(i, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pMenu->ModifyMenu(i, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
<br />
pSubMenu = pMenu->GetSubMenu(i);
<br />
if(pSubMenu == NULL)
continue;<br />
<br />
for(int j=0; pSubMenu->GetMenuState(j, MF_BYPOSITION) != -1; j++)
{<br />
if(pSubMenu->GetMenuString(j, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pSubMenu->ModifyMenu(j, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
<br />
pSubSubMenu = pSubMenu->GetSubMenu(j);
<br />
if(pSubSubMenu == NULL)
continue;<br />
<br />
for(int k=0; pSubSubMenu->GetMenuState(k, MF_BYPOSITION) != -1; k++)
{<br />
if(pSubSubMenu->GetMenuString(k, csMnuStr, MF_BYPOSITION) < 1)
continue;<br />
<br />
pSubSubMenu->ModifyMenu(k, MF_BYPOSITION, 0, theApp.translate(csMnuStr));<br />
} <br />
}<br />
}<br />
DrawMenuBar();<br />
Willem
|
|
|
|
|
try DrawMenuBar()
CodeTheDreams();
|
|
|
|
|
Within a few days I'll begin to submit my arguments.
|
|
|
|
|
Mr. Andrea wrote:
Within a few days I'll begin to submit my arguments.
On what subject ?
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
Why?
Quitters never win. Winners never quit. But those who never win and never quit are idiots. -- despair.com
|
|
|
|
|
Hi,
i like to save received data files (.pmj) from a scanner serially numbered on my disc (001.pmj, 002.pmj, ...) I know i must work with a loop and a variable, but it is too tricky for me.
Untill now i do the following:
// Save the file...
if (r)
{
CString fileName = "e:\\data\\001.pmj";
SavePMJStream(fileName);
}
Thanks for help, Mark
|
|
|
|
|
use a int variable to hold the counter ( file number )
use CString::Format to format the counter into a string.
use the for loop to increment the counter and format filename as a string, and pass it to the SavePMJStream .
Max.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
macmac38 wrote:
Untill now i do the following:
// Save the file...
if (r)
{
CString fileName = "e:\\data\\001.pmj";
SavePMJStream(fileName);
}
----------------------------
CString csPath, csFileName;
int nLastFile;//Keep SomeWhere (Registry/file)
csPath = "e:\\Data\\";
if (r)
{
csFileName.Format("%03d", ++nLastFile);
csPath +=csFileName;
SavePMJStream(csPath);
}
Why Not THIS.?????
CodeTheDreams();
|
|
|
|
|
I use a CListCtrl on a dialog. The problem is that the background of the icons is somehow changed to black when the dialog pops up. But the background is supposed to be transparent.
Who knows how to prevent this?
This is the code that i use:
CMyDlg::OnInitDialog()<br />
{<br />
m_imageList.Create(32, 32, ILC_COLOR4, 2, 2);<br />
<br />
for(int i=0; i<2; i++)<br />
{<br />
int nID = GetIconID( i );<br />
<br />
HICON hIcon = ::LoadIcon(AfxFindResourceHandle(MAKEINTRESOURCE(nID),<br />
RT_GROUP_ICON), MAKEINTRESOURCE(nID));<br />
<br />
m_imageList.Add(hIcon);<br />
}<br />
<br />
m_listCtrl.SetImageList(&m_imageList, LVSIL_NORMAL);<br />
<br />
for(int nIndex=0; nIndex<2; nIndex++)<br />
{<br />
m_type.InsertItem(nIndex, "some text", nIndex);<br />
<br />
nIndex++;<br />
}<br />
}
Thanks in advance,
Jochem
|
|
|
|
|
not sure but it could be this
Jochem wrote:
m_imageList.Create(32, 32, ILC_COLOR4, 2, 2);
try using ILC_COLOR16|ILC_MASK instead of ILC_COLOR4
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Adding ILC_MASK did the trick
|
|
|
|
|
Hello,
I am creating a DLL, which I get a set of data, while within every data, there are several kinds of data type, something like:
Data1
int i=2;
String s="John";
Date d="1980/10/10";
Date3
int i=3;
String s="kevin";
Date d="2003/11/05";
Data3
...
...
I am trying to load these data in memory and offer method like GetData() to application programmer who is going to use my DLL.
Can someone give me little hint that which type should I use to store these day?
Is it correct that I use struct to store each "Data", and create a template to store all these "Data"s?
Thanks!
|
|
|
|
|
A structure lets you define a new data type that is a collection of other data types.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
One solution is a class if the design fits. Otherwise, use a structure as the other members has mentioned.
Kuphryn
|
|
|
|
|
Hi Kuphryn, thanks for your reply!
Then if I use structure, since I have many "structure" for many datas in the application, i.e. Data1, Data2, Data3,etc.. How could I access individual structure? Should I use template to store these structure?
|
|
|
|
|
Given that you store the same set of class or structure objects in a file, one solution is to use read() along with seekg(sizeof(object)).
Kuphryn
|
|
|
|
|
Hi,
I have a class template defined in a file called X.h:
template<class a="defaultA," class="" b="defaultB">
class X
{
...
bool test(string args);
};
And the functions defined in X.cpp :
template <class a,="" class="" b="">
bool X<a, b="">::test(string args)
{ ...
}
But the compiler (MSVC++6.0) claims "unresolved external symbol: bool X<defaulta, defaultb="">::test(string args)" during the linking stage. It works
fine if the function definition is in the X.h file but when separated the compiler can't seem to find the template and create the correct function. Note: it works if I change the definition in X.cpp to the specialized version, e.g.:
bool X<defaulta, defaultb="">::test(string args) { ... };
If anyone has any ideas it would be appreciated,
Cheers,
Julian Churchill
|
|
|
|
|
Templates are compile time and thus the function definitions MUST be known during compiler time. Place the function definitions in the H file.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hy all,
I have a problem and I don't know how manage it in the better way.
This is the calling of Open method using the OLE DB access to Database.
hr = TheCdboSPMigrationAccessor.Open(DBSession, sqlcmd_Migration.c_str());
My sqlcmd_Migration is variable of std::string type,unfortunatly this string is very long (more or less 600 characters!!) and I think to have limitation problem using string type.
I thought to use the vector of char but I need to use the functionality like CONCATENATION, parametrization of some parts of this string ect...
Can someone suggest me how resolve this problem or eventually a good compromise???
Thanks in advance!!!
Andrea
|
|
|
|
|
Is "sqlcmd_Migration.c_str()" your attempt to pass a buffer of 600 to the function? If yes then it is a problem. ".c_str()" provides access to the buffer, but there is no magic that makes it char[600].
|
|
|
|
|
What leads you to believe that there is something wrong with std::string? It can handle a string 5 or 5,000,000 characters long.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Hy Tim,
thanks in advance for your support!!!
I think so because when I debug my application and look the sqlcmd_Migration value,I see that the string is not complete,and if I try to delete some blank space in my string... I see that the string itself change format!!!
Bye
Andrea
|
|
|
|
|