|
I'm trying to get information from a dialog box and writie it to a binary file. I can use the following code:
m_txtAirplane.GetWindowText(s);<br />
strcpy(airplane[15], (LPCTSTR)s);
This works fine when I'm using non-Unicode character set, but I loose the "look and feel" of Windows XP on my dialogs.
Is there a way of getting the CString, from a CEdit box, into a char array when I'm using a Unicode character set so that I can preserve the look of Windows XP?
Thanks.
|
|
|
|
|
masnu wrote: strcpy(airplane[15], (LPCTSTR)s);
You might want to look here[^]
led mike
|
|
|
|
|
For me the easiest way to convert Unicode character sets to ANSI is to use the ATL conversion macro W2A.
<br />
USES_CONVERSION;<br />
char* pszchar = W2A(strText);<br />
btw, What do you mean by the look and feel of Windows XP?
I Dream of Absolute Zero
|
|
|
|
|
Use WideCharToMultiByte for conversion from UNICODE to multibyte.
Regards
Amar.
|
|
|
|
|
I am writing an C# plugin which contains a subclassed CTreeCtrl( in c++ ).
I wrote my own OnKeyDown() function and I'm having a strange (may be
normal?) behavior: VK_UP, VK_DOWN, VK_LEFT and VK_RIGHT keys do not
enter this function, though other virtual keys do. I checked it out with
Spy++ and WM_KEYDOWN messages **are** being sent to my control''s window
for every VK. The problem is I wish my control to be navigated with keys
(as in Explorer, you now), and somewhat I'm loosing it... I don't know
where or how to catch those keys. Any clues?
NG
|
|
|
|
|
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! ]
|
|
|
|