|
Actually yes! Most western languages do not require Unicode, it was the rest of the world it was mainly designed for. Just enclose C-style string with ‘_T()’ (like ‘_T(“some string”) ). If you are using MFC, which using CString implies, then most of your work is done for you.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Dear John , I tried but I see only a garbage in the message box ex.
MessageBox(_T(" arabic sentence");
Best regards,
jarrah a.
|
|
|
|
|
Ok .. I have a CListCtrl for which I've implemented sorting functionality. With this I am also showing an up/down arrow in the header control. Now, for one of the headers, the max length for the content is 2 digits. Now after sorting, with the arrow appearing in the header my header width becomes larger than the contents. After sorting has finished, I tried to the set the column width using
SetColumnWidth(selColumn, LVSCW_AUTOSIZE); OR
SetColumnWidth(selColumn, LVSCW_AUTOSIZE_USEHEADER..);
But it auto-sizes the width to 2, which is the length of the contents and this way I cannot see the complete header!
I am wondering if there is a way to auto size the width according to header's width ...
any help is appreciated...
Thanks..
-- modified at 3:40 Tuesday 30th October, 2007
|
|
|
|
|
First of all... Sorry for the extension of the message, I hope it helps you.
EDIT: if my answer has nothing to do with what you asked for... please tell me and I will delete it.
I am not as good as other users but I try to explain my point of view.
I have used a CListCtrl in my project with a variable number of columns, the width of some columns are fixed the other are variable depending on the length of the subitems.
To do this, I have made a bypass (maybe there are better ways to do it, but it works for me).
I explain a bit to let you understand my way of thinking. My project is to do Fuzzy control, that means some inputs go through a regler to give a concrete value to an output. The CListCtrl is used in the regler to stablish the different combinations that rule the output's value. So it needs to know how many inputs are connected to the regler (output is only one) to set the number of columns. Every input has attributes that are used to stablish a rule (like "when I11 and I21 and I35 then O21 with X=0,75", Input1 parameter1 and Input2 parameter1 and input3 parameter5 should trigger output2 parameter1 with a value in 75%)
I hope you get the idea. It is important to my structure.
I have coded the initialization of the CListCtrl and the Upgrade of values in different functions that are called when necessary by the OnDraw (). This is because if the name of any attribute changes, or an input connection is deleted or something like this, I close the form because the complete structure of the ListCtrl should change as well.
I do it more or less like that:
void CParamRegTabView::InitializeView()
{
LV_COLUMN lvCol;
int nCol = 0;
DWORD dwStyle;
dwStyle = LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES;
m_clcRuleList.SetExtendedStyle (dwStyle);
lvCol.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH;
lvCol.fmt = LVCFMT_CENTER;
lvCol.cx = TABCOLWIDTH - 35;
lvCol.iSubItem = 0;
lvCol.pszText = "RegelNr.";
m_clcRuleList.DeleteColumn (nCol);
m_clcRuleList.InsertColumn (nCol, &lvCol);
for (nCol = 1; nCol <= m_pRegPar->m_cmlInConSet.GetCount (); nCol++)
{
lvCol.cx = nMaxLength * 8;
lvCol.iSubItem = nCol;
lvCol.pszText = TransformTextFormat(m_pRegPar->m_cmlInConSet[nCol-1]);
m_clcRuleList.DeleteColumn (nCol);
m_clcRuleList.InsertColumn (nCol, &lvCol);
}
lvCol.cx = TABCOLWIDTH - 40;
lvCol.iSubItem = nCol;
lvCol.pszText = "Oper.";
m_clcRuleList.DeleteColumn (nCol);
m_clcRuleList.InsertColumn (nCol, &lvCol);
lvCol.iSubItem = nCol+1;
lvCol.pszText = "GWF";
m_clcRuleList.DeleteColumn (nCol+1);
m_clcRuleList.InsertColumn (nCol+1, &lvCol);
lvCol.cx = nMaxLength * 8;
lvCol.iSubItem = nCol+2;
lvCol.pszText = TransformTextFormat(m_pOutCon->m_szOutName);
m_clcRuleList.DeleteColumn (nCol+2);
m_clcRuleList.InsertColumn (nCol+2, &lvCol);
lvCol.cx = TABCOLWIDTH - 38;
lvCol.iSubItem = nCol+3;
lvCol.pszText = "AttValue";
m_clcRuleList.DeleteColumn (nCol+3);
m_clcRuleList.InsertColumn (nCol+3, &lvCol);
m_bJustOpened = FALSE;
return;
}
code above stablish the ListCtrl formats, columns headers, width...
the insertion of the values, attribute names and so on... (contents of every cell) are made in DrawViewElements (), but this has nothing to do with your question.
and I call them by...
void CParamRegTabView::OnDraw(CDC* pDC)
{
if (m_bJustOpened)
InitializeView ();
if (m_bListRedraw)
DrawViewElements ();
return;
}
So... with this code. When a critical change happens (attribute deleted, input disconnection or something like that) I close the frame and by new opening the table is new configured thanks the m_bJustOpened (set to TRUE in the constructor). When a working point of any input changes its value, I set the m_bListRedraw to true and send a pDoc->UpdateAllViews (NULL) from the origin of the value change.
The only problem I could not avoid yet is that, when a double clik in the separator between two columns headers is made, then the column is resized to the header content size, cutting the contents of the subitems in that column.
If anyone knows how to avoid it, the answer will be wellcome, but atm is not important for me.
I mean:
Header =___________________________|____Input1____|
anywhere in the column a subitem with = |VeryFastChange|
after double click in the right "|"
Header =___________________________|_Input1_|
anywhere in the column a subitem with = |VeryFa..|
(The underscores are empty spaces, but if not used, the perspective is lost, multiple empty spaces are not considered)
Sorry for the length, I hope it helps you.
Any other tips from people that reads it are wellcome
-- modified at 7:28 Tuesday 30th October, 2007
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Readjust the column's width after each item is added.
"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
|
|
|
|
|
How to get the current logged in user ? Any idea ?
Thanks in advance.
Thanks,
Anand.
|
|
|
|
|
How about GetUserName() ?
"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
|
|
|
|
|
Also see WTSEnumerateSessions and WTSQueryUserToken in case you are interested in more than just the user logged into the console or your specific session from which the application is running.
|
|
|
|
|
Hi all,
I am making a dialog based application and from that dialog box i am coping some file to my disk. Now my problem is as soon as my dialog box is opened all the files start copying themselves to the disk and i only see the last message box poping up and saying all the files had been copied and after that my main dialog box pops up....i want that as soon as the application runs main dialog box should be shown with the progress bar. I am writing my code in OnInitDialog()and i cannot use any button....
Can anybody tell me how to do this.....
Thanks in advance
|
|
|
|
|
Did you use of WM_TIMER on your program?
|
|
|
|
|
actually i have used timer to run progress bar alone not with coping file code. can you just tell me where to call SetTimer function in code...
|
|
|
|
|
You must use of CProgressCtrl::SetStep on the timer when you want to copy files you can get count number of files and set progesss bar to it for example(100 files) and then set timer on the timer you must increase step of progress bar.
|
|
|
|
|
Create a modeless dialog box in your OnInitDialog and show the progress of the copy in that modeless box.
Judy
|
|
|
|
|
You can either utilize JudyL_FL's suggestion, or do the file copying in a separate thread that posts "status messages" back to the main UI thread.
"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
|
|
|
|
|
when I click button A want it to display a dialog;
so I fire this button with click event,
ON_BN_CLICKED(IDC_A, OnClickedA)
void CMainDlg::OnClickedA(void)
{
<BREAK1> COtherDlg dlg(this);
dlg.DoModal();
}
BOOL COtherDlg::OnInitDialog()
{
<BREAK2> CDialog::OnInitDialog();
return TRUE;
}
Above are the important areas of my codes, <BREAK> means I set breakpoint there, But when I press F5 to debug, vs stop at <BREAK1> but don't enter <BREAK2> at all, I am so confused, it is so simple a program, and other button to show dialog works fine.
And when I check the COtherDlg class, enum {IDD = IDD_OTHERDLG}; IDD_OTHERDLG is the same as I set in the dialog editor, I cannot find where it is wrong, is there any aspect I don't think about? DO HELP ME!
|
|
|
|
|
|
Sorry for forgetting to tell you, no compile and run errors.
Just did not work.
|
|
|
|
|
Do you have any specific code on the constructor?
|
|
|
|
|
Did you delete any commented part which was generated by wizard?
if u did so that might be the problem because, VC compiler uses commented
part to goto any specific statement.
|
|
|
|
|
I don't think I delete any coments.
|
|
|
|
|
Try it without passing this pointer.
Replace these two lines with
// COtherDlg dlg(this);
// dlg.DoModal();
this,
COtherDlg dlg;
dlg.DoModal();
OR
COtherDlg* dlg = new COtherDlg ;
dlg ->DoModal();
delete dlg ;
dlg = NULL;
|
|
|
|
|
abhijit bhopale wrote: COtherDlg* dlg = new COtherDlg ;
dlg ->DoModal();
delete dlg ;
dlg = NULL;
In what way is using the heap instead of the stack supposed to address the problem?
"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
|
|
|
|
|
Thanks for reply
I did not get you, can you explain i brief ?
|
|
|
|
|
Your suggestion to fantasy1215's problem was to use a heap-based variable (i.e., pointer) rather than a stack-based one. Exactly how does that help?
"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
|
|
|
|
|
I didn't fully understand your question. What is the problem ? You have a button and when you press it, it should display an other modal dialog box and nothing appears, is that your problem ?
What controls are you using on this dialog ? Any non-registered ActiveX controls maybe ? That could be a possible problem.
|
|
|
|