|
hi
I want my application to display menus,messages and captions in marathi.
abbmmm
|
|
|
|
|
What is that you are using to build your application? VC 6 or Above? If VC6, is your application unicode aware? Have you localised your computer with Indic script?
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
I have a large data array and was told to make it static to ensure that I have enough storage allocated
DATA_DETAILS signal_details[NO_FIELDS] = {
"1.000000",
"Integer",
"0",
"0",
etc
Note NO_FIELDS could be 25,000 and some of the elements are char arrays of 4096 bytes. i.e. lots of data.
Now if I make it static; e.g.
static DATA_DETAILS signal_details[NO_FIELDS] = {
"1.000000",
"Integer",
"0",
"0",
etc
the project fails to build as I have extern references; e.g including the keyword static causes a problem.
extern static DATA_DETAILS signal_details[NO_FIELDS];
How can I overcome this problem please.
|
|
|
|
|
I think the static is for the case your array is declared locally in a function. If it is a global variable and is accessed from other modules, then do not add static (otherwise it becomes available from the current file only).
|
|
|
|
|
Why somebody did tell that?
You have not to make it static , since static means only file scope in such context.
You can choose to allocate storage on the stack or on the heap. You don't need to allocate static as you did.
|
|
|
|
|
When you were told to make it static, they probably meant it in the context of where you allocate it ( stack or heap ). If you use operator new with such a large struct there is a good change you will run out of memory, but declaring it on the stack, as it appears in your code, you are guaranteed to have the memory before you run your exe.
|
|
|
|
|
|
static vars are not stored in the stack so in a way if you declare a var static, the memory is guaranteed for that var.
-Prakash
|
|
|
|
|
Mr.Prakash wrote: the memory is guaranteed for that var.
I think it holds for automatic vars too.
|
|
|
|
|
well static and extern do not o hand in hand.
but what abt the case when we have to make this structure visible to other files(declare extern) and also have guaranteed memory allocation assumin the structure is not local to any function. Is it that the allocatin shall be made on the stack for a function using it.
|
|
|
|
|
tom groezer wrote: Is it that the allocatin shall be made on the stack for a function using it.
Since the structure is declared in someother file, and used as extern in other files or function, the memory is still allocated to the structure, if the function is making a copy of the structure into its stack then its a different thing, but the original structure has been memory preallocated.
-Prakash
|
|
|
|
|
hi everyone,
I know, I already asked about that topic, but I still can't get it to work.
the problem was that i want the dialog opened by SHBrowseForFolder() to get opened on a specified folder.
here is the code i wrote :
void CFileRenamerDlg::OnBrowseFolder()
{
CoInitialize(NULL);
char folderBuf[MAX_PATH];
LPITEMIDLIST pidl = NULL;
BROWSEINFO bi;
bi.hwndOwner = this->GetSafeHwnd();
bi.pidlRoot = pidl;
bi.pszDisplayName = folderBuf;
bi.lpszTitle = _T("Select the folder where your files are located in...");
bi.ulFlags = BIF_NEWDIALOGSTYLE | BIF_RETURNONLYFSDIRS | BIF_SHAREABLE;
bi.lpfn = NULL;
pidl = SHBrowseForFolder(&bi);
if (pidl != NULL) {
SHGetPathFromIDList(pidl, folderBuf);
m_Directory.SetWindowText(folderBuf);
m_strFolder = folderBuf;
}
}
for your information, m_strFolder is declared as a CString .
this compiles fine, but always starts on the desktop. if I uncomment what is commented, the compiler (VC7.1) complains about the A2W() macro (actually, not directly the macro, but the "variables" used within).
did anybody already encountered this ?
can anyone suggest a better way (if any) to get SHBrowseForFolder() to get opened on a specified folder ?
thanks in advance.
|
|
|
|
|
super_ttd wrote: [...] the compiler (VC7.1) complains about the A2W() macro [...]
Try the newer improved CA2W macro. Actually I think you need CT2W macro. The correct shortest usage:
::SHParseDisplayName(CT2W(m_strFolder), . . .
Then try the rest of the code again. I hope this helps.
|
|
|
|
|
thanks for you answer. however, I have to add some more details.
actually, my A2W() was a mistake when I posted the message. I actually used T2W(), but not CT2W() because SHParseDisplayName() waits for a LPWSTR.
hum, not i'm checking the msdn and it tells me a LPCWSTR, but intellisense was telling LPWSTR. which to believe, and how to solve that ?
|
|
|
|
|
Since SHParseDisplayName requires LPCWSTR , the proposed solution should work:
::SHParseDisplayName(CT2W(m_strFolder), . . .);
|
|
|
|
|
yup, I think so (but i have no compiler for the moment, so I'll give you feedback tomorrow when I test it at home.
By the way, why does intellisense tell me SHParseDisplayName() wants a LPWSTR then ?
|
|
|
|
|
super_ttd wrote: why does intellisense tell me SHParseDisplayName() wants a LPWSTR then ?
I cannot explain this. In my case it tells me that the first parameter is of PCWSTR type.
|
|
|
|
|
super_ttd wrote: ...why does intellisense tell me SHParseDisplayName() wants a LPWSTR then ?
Because that is the way the function is defined.
|
|
|
|
|
did you read the other posts of the thread ?
boths ways are how the function is defined ! the problem is one is the doc online, and the other is what i'm using in my code.
|
|
|
|
|
super_ttd wrote: boths ways are how the function is defined
My point is as far as the compiler knows, at the point of the call there is only 1 definition.
Are you sure you didn't see LPCWSTR with intellisense? Same thing as PCWSTR.
I can't find any old reference (in header files) to SHParseDisplayName() taking anything but
a const WCHAR * as the first argument. The L part of the macro is a holdover from Win16 days.
|
|
|
|
|
hello Viorel,
then i tried your sample, and it does compile.
but the behavior is not the one expected.
actually, it does open the "browse for folder" dialogBox, but the folder in m_strFolder is drawn as the root folder.
what i wanted to have is still have the desktop folder as the root (exactly as if pidl was set to NULL), but with m_strFolder folder selected (the tree expanded to that folder).
another weird thing is that SHParseDisplayName() is available only since WindowsXP. wasn't it possible to have such a behavior on Windows 2000 ?!
thanks for your contribution... see you
|
|
|
|
|
Hello Comunity,
i use this funktion to show items in an CListCtrl with diferent colors, and i need to know
which item number is to be drawn.
I try to cast pNMHDR to
LPNMLVCUSTOMDRAW pLVCD = (LPNMLVCUSTOMDRAW)pNMHDR;
but i need to know the itemnumber who is to drawn...
any one have some sugestions for me?
thaks
break;
|
|
|
|
|
If no other solution, I think you can store the item number as a private data:
lvItem.mask = ... | LVIF_PARAM;
. . .
lvItem.lParam = (LPARAM)i;
pMatrixListResults->InsertItem(&lvItem);
Later obtain this number from the NMCUSTOMDRAW structure:
LPNMLVCUSTOMDRAW pLVCD = (LPNMLVCUSTOMDRAW)pNMHDR;
int number = (int)pLVCD->nmcd.lItemlParam;
I hope this works.
|
|
|
|
|
Hello,
yes, your idea works perfect, this is what i use now!
Thank you!
break;
|
|
|
|
|
Why don't you use OnDrawItem ?
|
|
|
|