|
this is a bit off topic in this forum... but i was unable to find a better place, so...
i am planning to rewrite my entire C kernel into C++ kernel. i'll be using g++. What basic runtime support will i need? can i use the STL safely? What about exceptions and other advanced features?
[please forgive me. i know this topic does not belong in here. but u all are c++ gurus, so u know the c++ language better, that is why i am asjing here.]
|
|
|
|
|
Since you had written your kernel in C, you should have known the answer to your question.
Maxwell Chen
|
|
|
|
|
Hi,
I have written a CEdit derived control for displaying formatted float values. Now I want to implement a handler for WM_COPY and WM_PASTE.
The WM_COPY handler for e.g. must copy the unformatted(!) float value to the clipboard.
I have tried something like
BEGIN_MESSAGE_MAP(CMyNumberEdit, CEdit)
ON_MESSAGE(WM_COPY, OnCopy)
END_MESSAGE_MAP()
...
but OnCopy is never called.
Can anyone help me?
THX
|
|
|
|
|
madmax0001 wrote: ON_MESSAGE(WM_COPY, OnCopy)
Try:
ON_COMMAND(WM_COPY, OnCopy)
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Hi,
I've tried but it is also never called.
|
|
|
|
|
Something else must be up. I used the following and both methods get called:
BEGIN_MESSAGE_MAP(CEditEx, CEdit)
ON_MESSAGE(WM_COPY, OnCopy)
END_MESSAGE_MAP()
...
LRESULT CEditEx::OnCopy( WPARAM wParam, LPARAM lParam )
{
return 0;
}
...
LRESULT CEditEx::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
if (WM_COPY == message)
;
return CEdit::WindowProc(message, wParam, lParam);
}
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Hi,
thank you very much. You're right. I have found my problem. I had implemented a handler for WM_CHAR where my editbox content is formatted. To process WM_COPY commands I must call the base class procedure for WM_CHAR for nonprintable characters like this:
void CMyEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if(isprint(nChar)==0){
CEdit::OnChar(nChar, nRepCnt, nFlags);
return;
}
// Further processing here
}
Now the OnCopy implementation is called !
|
|
|
|
|
can anyone tell me how to convert a std::string to float type?
|
|
|
|
|
float MyFloat = atof(MyString.c_str());
|
|
|
|
|
float MyFloat=atoi(MyString.c_str());
That's correct!;P
|
|
|
|
|
Err, no, this will convert a string to an integer value, not to a float value. atof convert to a float value.
|
|
|
|
|
|
Michael Dunn wrote: From the C++ FAQ lite:
[39.2] How do I convert a std::string to a number?[^]
Please no stringstream solution. Just encapsulate strtod.
|
|
|
|
|
|
Michael Dunn wrote: OP's
means "Original Poster" ?
led mike
|
|
|
|
|
Gee Mike, what in the world were you thinking?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Roland Pibinger wrote: Please no stringstream solution.
Out of interest, why not?
|
|
|
|
|
I would like to know why not too. While MSVC6s STL implementation is crap and it would be more efficient to use the old C-style functions, other STL versions are more efficient and have less overhead. Efficiency issues aside, there are many advantages to the stringstream solutions such as that fact that it's extensible and you can change the type your converting to simply by changing variable your reading into instead of having to change the function called. The intent is also clearer as the C style function names are obscure to say the least. Another issue is the fact that STL implementations are allowed to implement basic_string in a manner such that calling c_str is not as efficient as the programmer might think. One example is basic_string implementations which don’t use a single contiguous memory block to store the string.
Steve
-- modified at 21:50 Thursday 4th May, 2006
|
|
|
|
|
Hello,
Does anybody know if it is possible to show an icon in the system tray (near the clock) when an usb device is plugged in? Is it necessary to develop an additional application? Can I implement it in the driver dll installer?
Thank you!
|
|
|
|
|
i don't understand... what OS do you use ?
doesn't it show the "Safely Remove Hardware" naturally when you plug any USB drive ??
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
I'm sorry for my explanation.
Actually I have developed a hardware which connects to pc by means of usb connection. I would like to develop a device driver that show an icon in the system tray when the hardware is connected and remove that icon when the hardware is removed. This hardware is not an storage device. I wonder if I can reach this behavior with the driver or if I must develop a "resident" program or similar.
Thank you a lot!
|
|
|
|
|
Hi,
I'm trying to do something that seems pretty easy. I have a xml string that I want in a datatable. I think the biggest problem is with getting the schems into the datatable. I can't use the Path.xsd because I don't know it at this point. I want to read the schema from the xml string.
public void XMLStringToDataTable(string as_xml, ref DataTable adt_working)
{
if (adt_working == null)
adt_working = new DataTable();
StringReader lstr_temp = new StringReader(as_xml);
XmlTextReader lxmlReader = new XmlTextReader(lstr_temp);
adt_working.ReadXmlSchema(lxmlReader);
adt_working.ReadXml(lxmlReader);
adt_working.AcceptChanges();
}
Is there any easier/ better way to do this? One that works? I would like to use a datatable instead of a dataset if possible.
sample xml string:
<d_edit_mod><d_edit_mod_row><contr_fund_id>6229<contr_id>190<fund_mod_dt>5/4/2006 00:00:00<fund_mod_no>2<fund_mod_reason>test<fund_mod_eff_dt>5/4/2006 00:00:00<fund_initial_load>N<fund_mod_type_cd>1647<fund_mod_status>1678
Thanks, Jessica
|
|
|
|
|
sorry about the xml string sample. That didn't work how I wanted it to.
Thanks, Jessica
-- modified at 12:29 Thursday 4th May, 2006
|
|
|
|
|
Hi, so my problem is threefold, here it is:
I want to append text to a richedit.
Right now, I'm doing this:
chat_window_rich.SetSel(GetWindowTextLength(chat_window_rich), -1);
chat_window_rich.SetSelectionCharFormat(cf);
chat_window_rich.ReplaceSel(buff);
That would be fine except for two reasons.
1: The program is multithreaded, and sometimes messages will come in at almost exactly the same time, overwriting each other (like I presume the one sets based on windowtextlength, and then the ohter one sets based on the same length before the first one is appended, then the second just overwrites the first)
2: If someone is in the middle of dragging the cursor to select text, the incoming text will destroy all of the selected text and replace it (presumably the carat is reset from the cursor dragging, from the end of the text to something before it, i.e. whatever is being selected).
I tried locking shared memory right before I set and replace the selection to prevent the multithreaded message receiving problem, however this sometimes causes the program to freeze (infinite memory lock, even though the way I have it coded, it appears to me as if this is totally impossible, and I even have a wait timer on the lock to release the memory if it takes too long, but this doesn't always work for some reason).
So my question: Is there a way to append text to a richedit WITHOUT setting the carat with setsel? I really want to append the text without messing with whatever's being selected by the person's cursor.
If there isn't, does anyone else have suggestions? This sort of thing is obviously possible since it's done in AIM and other chat programs.
Thanks!
Kelly Ryan
|
|
|
|
|
Not exactly sure what you are doing in your worker thread.
But if you are doing
chat_window_rich.SetSel(GetWindowTextLength(chat_window_rich), -1);
chat_window_rich.SetSelectionCharFormat(cf);
chat_window_rich.ReplaceSel(buff);
in your worker thread
Create a handler for a user message that does something like this
LRESULT OnAppendText(WPARAM wParam, LPARAM lParam)
{
int start, end;
chat_window_rich.GetSel(&start, &end);
chat_window_rich.SetSel(GetWindowTextLength(chat_window_rich), -1);
chat_window_rich.SetSelectionCharFormat(cf);
chat_window_rich.ReplaceSel( (LPCTSTR) wParam);
chat_window_rich.SetSel(start, end);
}
From your worker thread send (or post - you would be responsible for allocating and deallocating the string you want to append) the user defined message to the main thread when you want to append text.
|
|
|
|