|
I have some strings in my program. Does these strings goes into string table of exe?
can i use string name as resource_name?
|
|
|
|
|
Hi,
I got crash once in GetMessage method while calling that method in message loop. I am doing some simple opertion with win32 coding and try to get the message form message queue of windows and it got crash. Can anybody help me to find out the possible reason behind this crash with fixes. The crash has been seen on XP 32 bit machine.
|
|
|
|
|
Kundan Kumar Bharti wrote: Can anybody help me to find out the possible reason behind this crash with fixes.
Without any code neither the exact error message, this will be very difficult. We still can't read mind, you know...
So, please post the code snippet where the crash occurs (make sure you read point 7 here[^] before posting). Post also the exact error message of the crash.
|
|
|
|
|
I have a dialog box popping up, which contains a updown control.
I need to set and get the values of its buddy control through my c++ program.
Basically i am automating it.
Please could some one help me.
|
|
|
|
|
Use FindWindowEx[^] to find the updown control in the dialog.
Type cast the CWnd* of the control to a CSpinButtonCtrl* and call CSpinButtonCtrl::GetBuddy[^] to get a pointer to the buddy window.
You can then use GetWindowText[^] and SetWindowText[^] to get and set the value of the buddy control respectively.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi Superman,
First thanks a lot for replying.
I have another problem, i know only the dialog name.
I don't have the handle to the updown control.
How should i find it?
Thanks in advance
|
|
|
|
|
That is exactly what FindWindowEx gives you.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks a lot.
Its working fine..
|
|
|
|
|
Hi all,
I m using a ListBox and add Variable for this that is CCheckListBox type.
there is 4 items,and i m also use a Check box that is use to select and deselct all items of ListBox.
i m handle it over ON_LBN_SELCHANGE of ListBox and Click event of Check box.
selection and deselection from Checkbox working fine.
but problem occur when i use it by List box means, iwant when the all items of list box checked than Select all Check box automatically Checked or vice-versa.
but i have one problem when i continous click on listbox its not working fine.
CButton m_sel_all_chk;
CCeckListBox m_col_lb;
void CExcel_Info_Dlg::OnBnClickedCheckSelAll()
{
if(m_sel_all_chk.GetCheck()==1)
{
for(int i=0;i<m_col_lb.GetCount();i++)
{
m_col_lb.SetCheck(i, 1);
}
}
else if(m_sel_all_chk.GetCheck()==0)
{
for(int i=0;i<m_col_lb.GetCount();i++)
{
m_col_lb.SetCheck(i, 0);
}
}
}
void CExcel_Info_Dlg::OnLbnSelchangeListColumns()
{
BOOL flag;
flag=FALSE;
int count=m_col_lb.GetCount();
for(int i=0;i<count;i++)
{
if(m_col_lb.GetCheck(i)==0)
{
flag=TRUE;
break;
}
}
if(flag==FALSE)
{
m_sel_all_chk.SetCheck(1);
}
else
{
m_sel_all_chk.SetCheck(0);
}
}
so please help me for this.
thanks in advance.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
"_$h@nky_" wrote: but i have one problem when i continous click on listbox its not working fine.
...
so please help me for this
Your code snippet worked fine for me.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
i means when i click on List box item multiple times and all items are checked than select all check box automatically checked.
or if not checked all items select all button not checked.
To accomplish great things, we must not only act, but also dream;
not only plan, but also believe.
|
|
|
|
|
I understand what you want, and the code snippet you've shown does exactly that.
In addition to what you want the code to do, you might also add what it's actually doing.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi all,
I want to read the content of the file.(say .txt)
I am using Read method...But Its not reading the entire contents present in the file rather it reads around 50% of the file.
-------------------------
Code Snippet:
CStdioFile docfile;
WCHAR* preadbuf;
if(docfile.open(....))
docfile.read(preadbuf,docfile.getlength());
------------
Please tell me how to solve this problem. please let me know if you have any queries..
Thanks,
Rakesh.
|
|
|
|
|
Does CStdioFile have open and read methods?
The length parameter to any read function is the amount of data to be read from the file.
I believe there is some mistake here.
The first parameter to the read function must be a buffer containing some memory and not just a pointer.
Look at the example in the documentation of CFile::Read[^].
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
You never allocate preadbuf, so I'm really amazed that your code doesn't crash here...
|
|
|
|
|
|
shuzh wrote: 这个东西 貌似很好弄袄
Exactly.
|
|
|
|
|
First you should make up your mind if you want to read the file line by line or read the entire file into a buffer.
In case of the former option use CStdioFile::ReadString() method, for the latter use CFile::Read() .
|
|
|
|
|
Rakesh5 wrote: if(docfile.open(....))
docfile.read(preadbuf,docfile.getlength());
This will not even compile. If you want to know why a particular piece of code does not work, at least show the actual code.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Just a thought. But here goes:
You seems to read the file as Unicode, that way every character consists of two bytes in the file.
If docfile.getlength() reports the file size in bytes, then you get your 50%.
An example, suppose the file is 50 bytes.
docfile.getlength() returns 50.
But you can read 25 Unicode characters from it.
Makes sense?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
I have a worker thread for example,
DWORD ThreadProc(void* pVal)
{
while()
{
pcEdit->SetWindowText("Status");
pcEdit2->SetWindowText("Status2");
}
}
Is it okay to update UI this way from the thread? Or how should I do? Anybody can explain in simple words?
The above actually works fine. But mate says I shouldn't do it, but he doesn't say how to do it.
----------------------------
286? WOWW!
|
|
|
|
|
The right way to do it is to post messages to the thread that owns the UI.
Use the PostMessage[^] API to post messages.
For SetWindowText post the WM_SETTEXT[^] message.
The problem that can occur is such scenarios is when both the worker thread and the thread that owns the UI simultaneously updates the control. For SetWindowText , this may not be a problem because the function does the same thing of sending the WM_SETTEXT message.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
«_Superman_» wrote: The right way to do it is to post messages to the thread that owns the UI.
You mean I should post the message straight to the control right?
«_Superman_» wrote: For SetWindowText, this may not be a problem because the function does the same thing of sending the WM_SETTEXT message.
You mean I can go ahead with myCtrol->SetWindowText()? Then which controls/APIs exactly make the problem?
----------------------------
286? WOWW!
|
|
|
|
|
_8086 wrote: You mean I should post the message straight to the control right?
No. Create a custom message and post the custom message to the UI thread.
The custom message handler in the UI thread can call SetWindowText .
_8086 wrote: You mean I can go ahead with myCtrol->SetWindowText()?
It is cleaner to send a custom message to the UI thread.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Here[^] is an excellent article you should read before starting to work with threads. It will cover a lot of important points and traps when working with thread (it also has a section answering your question).
|
|
|
|