|
Thanx a lot
|
|
|
|
|
string val = "32742937.234234";
how to change this type of string to double? Thanks!
|
|
|
|
|
Check your documentation on sscanf .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
strtod()
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
double ConvertStringToDouble(const CString s)
{
char pszString[MAX_PATH];
char* pszStop;
memset(pszString, '\0', MAX_PATH);
strncpy(pszString, (LPCTSTR)s, s.GetLength());
double d = strtod((const char*)pszString, &pszStop, 0);
return d;
}
|
|
|
|
|
double ConvertStringToDouble (LPCTSTR psz)
{
LPTSTR pszStop;
errno = 0;
return _tcstod (psz, &pszStop);
}
or (if you don't like the "T" variables)
double ConvertStringToDouble (const char *psz)
{
char *pszStop;
errno = 0;
return strtod (psz, &pszStop);
}
Since CString has a type cast to LPCTSTR and since you won't be storing the value into another CString, then there isn't any need to use CString in the argument list.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Hi,
Suppose while running, my explorer restarts
itself (normally does in Win95 & win98).. how
do i detect that and make my icon in the system
tray REAPPEAR..
Please help
|
|
|
|
|
Assuming you've put the icon in the first place with Shell_NotifyIcon , you can have your app periodically (say with a timer) test whether the icon is still there by calling Shell_NotifyIcon with flag NIM_MODIFY and appropriate hWnd and uID parameters (it's not necessary you actually modify anything). If Shell_NotifyIcon fails, you can assume the icon is no longer present and proceed to insert it again.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
When explorer restarts it broadcasts a registered message "TaskbarCreated". You can process this message to redisplay your icon.
Regards
Phil
|
|
|
|
|
Hi,
Phil
Can u please elaborate on that.. what kind of message
is sent etc..
Sameer
|
|
|
|
|
The message is only sent if the system in question has IE4 or later.
As I said, it's a registered message. You get its message number like this...
const UINT wm_TaskbarCreated = RegisterWindowMessage(_T("TaskbarCreated"));
Then, in the WindowProc of the top-level frame window of your app. do something like this...
if (nMsg == wm_TaskbarCreated)
m_pTrayIcon->ReloadTheIcon();
A better way would be for your tray icon class to hook the WindowProc and be responsible for reloading itself. That avoids having to inject a chunk of code into an entirely unrelated class. Unfortunately I don't have time to explain all about that...
Hope this helps,
Phil
|
|
|
|
|
Here is the article for people who have the same problem in
future
Regards
Sameer
|
|
|
|
|
Hi All,
How to resolve ip address to hostname in WIN32? for example, given ip address 204.127.222.1, find the hostname (say, MYDOG ).
Thanks.
|
|
|
|
|
Use Winsock function gethostbyaddr . If you're not used to this library, remember you have to initialzie it before attempting to use it (have a look at WSAStartup .)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
what are breakpoint and how are they use in vc++ 6.0.
karanba
|
|
|
|
|
Breakpoints are only used when debugging (F5 instead of Ctrl-F5). Place a breakpoint on the line where you want the execution to stop break (right-click->Add breakpoint), press F5, and when the breakpoint is reached use F5 (resume), F10 (step over), F11 (step into) and so on. All command can be found in the debug window.
/moliate
|
|
|
|
|
As title.
I'm amumu, and you?
|
|
|
|
|
Yes.. ofcourse..
you can try Bison for windows..
Sameer
|
|
|
|
|
|
Hi,
I am practice RTTI excerices and encounter such a debug result.
struct NCL_Runtime CVehicle::structCVehicle=
{szCVehicle, sizeof(CVehicle), 0xffff, NULL, NULL};
debug result is
J:\pearl\Sim02\Vehicle.cpp(16) : error C2065: 'NULL' : undeclared identifier
Plz tell me WHY??????
Best regard.
I confess that I am a stubborn guy, but why not put things thoroughly, logically and systematically clean. One concrete prolem is worth a thousand unapplied abstractions.
|
|
|
|
|
NULL is not a C++ keyword, but rather a macro defined in a lot of usual headers, like <stdlib.h> or <windows.h> . In your case, none of these headers happens to be included. You can safely replace NULL with 0 .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Oye Joaquin no paras tio !, estás hecho un máquina ...
Me parece que Chris debería de darte una camiseta de codeproject por la colaboración que haces...
Un saludo
Braulio
|
|
|
|
|
Hola Braulio.
No te creas que estoy todo el día aquí, tan sólo que cuando tengo algún ratito me divierto más contestando a la gente que navegando por playboy.com Un saludo.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
tsk tsk tsk
u so bored that you do that???
situations to avoid #37: "good morning ... how many sugars do you take in your coffee ... and what was your name again?"
coming soon: situations to avoid #38: "...and the dog was there too?"
|
|
|
|
|
u so bored that you do that???
As you seem to do as well, I guess
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|