|
I found this in one of my old libraries. Ignore the CHECK, it's an internal macro.
BOOL AfxIsNumeric(LPCTSTR lpszText, BOOL bSigned, int nBase)
{
CHECK(lpszText != NULL, FALSE);
LPTSTR lpszEndPtr = NULL;
if (bSigned)
_tcstoi64(lpszText, &lpszEndPtr, nBase);
else
_tcstoui64(lpszText, &lpszEndPtr, nBase);
return ((lpszEndPtr != lpszText) && (*lpszEndPtr == _T('\0')));
}
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
Painted on the side of a dog trainer's van: SIT HAPPENS
|
|
|
|
|
Try something like this:
#include <ctype.h>
bool IsNumeric(const char* p)
{
int len = strlen(p);
for (int i = 0; i < len; i++)
{
if (!isdigit(p[i]))
return false;
}
return true;
}
Note: I didn't compiled it, so it may contain some error
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I am working on a winsock application that has the ability to connect to many servers. I have a dialog set up to select the server. My problem is that once a server is selected i cannot close that connection and reconnect to another server without restarting the application. I tried TerminateThread but it only caused my program to crash. Any Suggestions?
Thanks, Brandon
|
|
|
|
|
Hi,
I wrote an OCX few months back. Now I need to convert this OCX into a DLL with same functionality.
This is MFC OCX. What is an easy way to accomplish this?
Thanks!
|
|
|
|
|
What exactly do you mean by converting it into a DLL?
If my memory serves, an OCX is already a DLL. It's a special kind of DLL because it's supposed to contain one or more ActiveX controls, but it's a DLL with a .ocx file extension anyway. So in that sense, to convert it into a DLL you'd just need to rename the file...
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I dont think its that simple
OCX need a user interface container (Form, etc.).
|
|
|
|
|
If I start an MFC app as a service in NT or XP, what call do I send back to OS to acknowledge the start? I can get it to start, but windows says no response and shuts it down...
any help or a pointer to an example is really appreciated.
shotgun
|
|
|
|
|
How about StartServiceCtrlDispatcher() ?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
shotgun wrote:
any help or a pointer to an example is really appreciated.
See this article[^] for a whole service framework.
|
|
|
|
|
Okay, a little venting here....Here's what I believe but do not know as fact. Serial comm ports should be added to the registry at HKLM\Hardware\DeviceMap\SerialComm. For a minority of the new USB to Serial adapter devices they are located there after they are installed.
However, many manufacturers (perhaps their driver developers) are not signifying that they have installed an additional serial port in the HKLM\Hardware\DeviceMap\SerialComm key.
What are they doing? They're installing it in the USB section of the registry under...HKLM\SYSTEM\ControlSet001\Enum\\USB\ with a subkey of, I hope, a manufacturer unique Id/PID.
e.g. HKLM\SYSTEM\ControlSet001\Enum\USB\Vid_050d&Pid_0109 identifies the Belkin F5U109 USB to Serial port adapter. And get this! Its with subkeys 196669\PortName\COM !!!
So, how does one go about finding all installed serial ports under USB enum keys??? It appears that different manufacturers are using different terminology for key/subkey names e.g some may say port (can't verify its a serial port), not sure all are using the term "COM" to indicate it is a serial port.
Isn't there supposed to be a standard or convention that manufacturers SHOULD follow? I don't know whether to enumerate keys looking for serial, port, COM, adapter or any and all combinations. There's got to be a better way. Thanks.
I want to add that I've got a delivered program where I autodetect serial comm ports and allow the user to select one. I exclude modems. Works most of the time except recently, I've gotten more calls about new USB to serial port adapters not working with my program but are recognized by hyperterminal. I don't know how Windows is detecting that these new USB serial ports. Hopefully, somebody knows.
|
|
|
|
|
Hello,
I don't know how the registry key things work, but I also use usb serial port emulators. This[^] function finds all the comm ports and even tells you if it's an USB port!
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
I'll check it out. Thanks, Bob.
|
|
|
|
|
You're welcome
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
I am building an application used for tenant billing. I have to find the number of days in each billing period. This is inputed by the user.
ok with that set up the gas company changes rates every month. However, we do not conduct out meter readings and rent billing on the first of every month. Ineed to find a way to use the pastbilling date to find out the remaining days in the month to use for the past gas rates. I also need to use this months billing date to find out how many days have elapsed in the current month.
If i could find out how to get the number of days in the specified month i could compare it to the bill date.
I'm pretty much trying to figure out how to use datetime or another function to show the total number of days in the given month. Thanks in advance
|
|
|
|
|
Lagwagon56 wrote:
If i could find out how to get the number of days in the specified month
There are only 13 cases (February has 2 cases due to leap years), so just make lookup table.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
Yeah, that would work, was just wondering if there was a built in way with datetime. Thanks for the reply. That was easy enough, i was thinking to hard... Thanks again
|
|
|
|
|
Hello,
I get this error when my app is starting app
I have many dialog windows in a tab that loads and
I have tryed many things but I dont get it to word.
Is there a smart person that now what I can do to make this go away?
Here is the error I get;
ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));
|
|
|
|
|
Larsson wrote:
Is there a smart person that now what I can do to make this go away?
Here is the error I get;
ASSERT(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));
In what function is that line of code? What file?
Make the debugger stop at that line when the assertion fails, and check the call stack to see what is being done that caused the assertion. Just as a wild guess, I suspect you are trying to access some control in a dialog before the dialog has been initialized (like trying to initialize a control in the dialog's constructor rather than in OnInitDialog).
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
No this is the first thing I do!
m_FunkDlg = new CFunkDlg;
m_FunkDlg->Create(CFunkDlg::IDD, &m_tabctrl);
m_tabctrl.AddTab(m_FunkDlg, "Set function", 2);
So I dont now what can hapend!
|
|
|
|
|
You are calling (either directly or indirectly) a method on a CWnd object or derived class. The implementation of that method expects to either be attached to some window (IsWindow(m_hWnd) ) or to be a COM object wrapper (m_pCtrlSite!=NULL ). The assertion is failing because at the time of that call, neither of those conditions is true.
Again, run it under the debugger. When you get the assertion message, click "Retry" or "Break" (I don't remember the exact button caption) so as to stop the debugger at the line where the assertion was written. Take note of what function the assertion is in. Take note of the call stack and see where the call to that function is coming from, back to some of your code. That should give you some hint of what is wrong. If you are unsure, post again, but provide some more information.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
I am using C/C++, Visual Studio 6.0
I hsve created a Dialog-based app. I have several Dialog boxes each with it's own Class. When I have done this, VS nicely creates an OnInitDialog() function for each Class.
Somehow, on the last Dialog Box / Class that I created, the OnInitDialog() function did not show up.
Any help on creating an OnInitDialog(0 function would be greatly appreciated
Many thanks,
Robert
|
|
|
|
|
Robert Palma Jr. wrote:
Somehow, on the last Dialog Box / Class that I created, the OnInitDialog() function did not show up.
Any help on creating an OnInitDialog(0 function would be greatly appreciated
How about copying and adapting what you have in the other dialogs?
This is what you need:
1. Declare OnInitDialog as a member of your dialog class. Add it in the dialog header file (the .h file). It's something like this:
virtual BOOL OnInitDialog();
2. Provide an implementation for YourDialog::OnInitDialog(). Add it to your dialog implementation file (the .cpp file). Something like this:
BOOL YourDialog::OnInitDialog()
{
CDialog::OnInitDialog();
return TRUE;
}
That should be enough.
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Many thanks Jose
|
|
|
|
|
More comfortably, use Class wizard and then select the class you created then add windows message WM_INITDIALOG. This will add the OnInitDialog() function in your class.
Work hard and a bit of luck is KEY to SUCCESS.
|
|
|
|
|
Many thanks Neelesh
|
|
|
|