|
Have each secondary thread post a message to the primary thread. In that message, set WPARAM to a value indicating which thread the message is from. That way, you can call InsertString() with an appropriate index value.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
« Programm3r » wrote: char strDest[100];
Try a ZeroMemory on strDest before using it.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
Thank you Rage, It seems to have done the job...
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Pasted from MSDN:
"The strncpy function copies the initial count characters of strSource to strDest and returns strDest. If count is less than or equal to the length of strSource, a null character is not appended automatically to the copied string."
You have to terminate the string yourself.
Rage suggested one way to it to be absolutely sure. Another way is to place a '\0' at the correct position, i.e. at the end of the string if you know where that is.
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
Thank you Roger, the qoute form MSDN makes perferct sense now
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
Take the function void foo(unsigned char * param) . It does not change the value of the string (it's a Win32 API function, don't ask me why it's not const). Now i'd like to pass it the value of std::string MyString . I do this liek that
foo(reinterpret_cast<unsigned char *>(MyString.c_str()));
but this can hardly be the recommended way (it works, but it's bad). Any suggestions anyone ?
|
|
|
|
|
why not the simple static_cast ?
i can't see anything wrong otherwise...
|
|
|
|
|
static_cast gives a compiler error:
error C2440: 'static_cast' : cannot convert from 'const char *' to 'unsigned char *'
|
|
|
|
|
hum, yes, that's right (i have no compiler with me at the moment...).
does it work without any explicit cast ?
|
|
|
|
|
You cannot cast a 'const' value to a 'non-const' because that's the whole point of the 'const' keyword.
In this case you have to make a copy of the string and provide the second function with the copy.
--
Roger
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
"No one remembers a coward!" - Jan Elfström 1998 "...but everyone remembers an idiot!" - my lawyer 2005 when heard of Jan's saying above
|
|
|
|
|
You want const_cast.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Dear All,
How can i read a binary data from the registry ?
Thanks.
|
|
|
|
|
There's articles and classes on this site, and all over the web, which answer this question.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
|
Use REG_BINARY with RegQueryValueExv() .
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
Hi all,
Will somebody advise me
1. how to build a C++ debugger or at least an rough architecture of a debugger?
2. what is the mechanism behind for a debugger to determine a breakpoint set by user is valid?
Appreciate your help....
br
Vincent
|
|
|
|
|
this[^] could be starting point.
|
|
|
|
|
hai ,
I am creating a set up dialog using InstallShield12.I wrote InstallScript for this.But some Issues/I want to add some text into it.But when i add a piece of text using these methods
hItem2=GetDlgItem(hDlg, STATIC_TEXT_ID);
SetWindowText(hItem2, "First");
SetWindowLong(hItem2, GWL_STYLE, nStyle1);
SetWindowPos(hItem2, NULL, 60,60,20,25, SWP_DRAWFRAME | SWP_SHOWWINDOW |SWP_NOSIZE|SWP_NOZORDER );
But only one line text is created ,
I want to add two sets of data.So I repatedly specifying the above code,
But either the first one or second one is displaying,
That is in the hItem having value at a single time only.
can anybody help me plz.....................
Jeeva
|
|
|
|
|
Jeeva Mary Varghese wrote: But only one line text is created
Be sure the ES_MULTILINE style is set when creating the edit control.
Besides that, your sample code obviouly only displays "First", which is indeed one line of text.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
Hi,
does anybody know how to resize a control or a CFormView view which contains the control when the view is nested in a CSplitterWnd Pane? I want the control to adapt its size when the size of the splitter window changes.
Thanks,
Frank.
|
|
|
|
|
I think you should add to your form a handler for WM_SIZE message (i.e. OnSize function) and do the adjustments of child controls here.
|
|
|
|
|
Thank you, it works. As in all other resizing dialogs. I don't know, why I've got problems with this. Somehow I thought that my CMDIChildFrame should handle the WM_Size message.
|
|
|
|
|
Hai all,
I have a dialog based programme.
-> I have Created CCustomStatic from CStatic using class wizard.
-> I havent inserted any CStatic Resource.
-> I created my static window in OnInitDialog() of dialogbox
st.Create(_T("my static"), WS_CHILD|WS_VISIBLE|SS_CENTER,CRect(10,10,150,50),this);
-> After this I have added OnEraseBackground() in my CCustomStatic and Wrote the following code
BOOL CCustomStatic::OnEraseBkgnd(CDC* pDC)
{
TRACE("\n ERASE BACKGROUND");
RECT rc;
GetClientRect(&rc);
CBrush brush(RGB(255,0,0));
pDC->FillRect(&rc,&brush);
return TRUE;
}
->But I didnt get a Static with Red Color.
->But Later when I added OnPaint Message Handler in my CCustomStatic class , I got Red colored Static Control.
->Why this is happening So.
->Here What is special with OnPaint() in CCustomStatic
Please Help me
Thanks in Advance
George
|
|
|
|