|
|
Nibu thomas wrote: t's the UnderTaker...Run
What about Great Khali
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
From the docs for ::SetTimer . Holds true for CWnd::SetTimer too...
If the <code>hWnd </code>parameter is not <code>NULL </code>and the
window specified by <code>hWnd </code>already has a timer with the value
<code>nIDEvent</code>, then the existing timer is replaced by the new timer.
When <code>SetTimer </code>replaces a timer, the timer is reset. Therefore, a
message will be sent after the current time-out value elapses, but the
previously set time-out value is ignored.
Nibu thomas
Software Developer
Faqs by Michael dunn
|
|
|
|
|
nripun wrote: SetTimer(ID1,100,NULL). After 100milliseconds the timer expires and it is handled in the OnTimer() function. Now if i have to start a timer again with the same ID do i have to use KillTimer(ID1)?
iT will Good Practice if you Call KillTimer(..) before setting the TImer on same ID... but as far as any Impact on Code concern, its Negligible !
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
wil the socket created here accept only a single request,n not process the subsequent ones listened to?found an error in the accept fxn(INVALID SOCKET)...
void CCsDlg::OnAccept()
{
CString strIP;
UINT port;
port=2000;
strIP="10.1.46.36";
if(m_sListener.Accept(m_sConnected))
{
m_sConnected.GetSockName(strIP,port);
UpdateData(TRUE);
}
else
{
AfxMessageBox("Cannot Accept Connection");
}
}
****************************************************************
m_sListener.Create(2000);
if(m_sListener.Listen()==FALSE)
{
AfxMessageBox("Unable to Listen on that port,please try another port");
m_sListener.Close();
return;
}
|
|
|
|
|
Yup, your "accept" can accept only one at a time.
please see here ..
^
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
Is there any way that i can keep handling subsequent requests..coz OnAccept() does notify a listening socket that it can accept pending connection requests by calling Accept.
Not multithreading!!
|
|
|
|
|
1. Derive a Socket class from CSocket.
2. Override the OnAccept function. On Accepting the connection, call the any other function or handle it inside that function. normally we do this outside the class.
other connections will wait in the queue and will notify u again after accpetpting the first connection.
-Sarath
|
|
|
|
|
so u mean..CAsyncSocket wont work here??coz dats wat i hav used!
|
|
|
|
|
how do i make a class as singleton class.
|
|
|
|
|
class CSingleton
{
public:
static CSingleton* GetInstance();
private:
void CSingleton();
CSingleton ~CSingleton();
static CSingleton* m_pInstance;
};
In the cpp file:
CSingleton* CSingleton::m_pInstance = NULL;
.....
CSingleton* CSingleton::GetInstance()
{
if (!m_pInstance)
m_pInstance = new CSingleton;
return m_pInstance;
}
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
A simpler way:
--------------
// Console.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
class Single
{
public:
static Single& GetInstance()
{
static Single s;
return s;
}
void Method() const
{
cout << "Method called : this = 0x" << hex << this << endl;
}
private:
Single()
{
cout << "Instance created!" << endl;
};
};
int main(int argc, char* argv[])
{
Single::GetInstance().Method();
Single::GetInstance().Method();
Single::GetInstance().Method();
return 0;
}
--------------
This technique leverages the langauges rules: A static member is created the first time it's encountered. This way we don't need the "new" or the "if" or to remember to "delete" it.
Steve
|
|
|
|
|
Yes, that another way of doing it. Both techniques have their pro and cons. I remember having read an article that was discussing several singleton implementations but I don't remember the link.
Yours is great when it has to be used 'alone' because as you said you don't have to worry about releasing the instance.
But in some cases, this can lead to problems: if you have a singleton that is member of another singleton, then you get into trouble because you have no control over the timings of the destruction of the instances. In such case, you need to control yourself the scope of the instances.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
|
Thank You very much
|
|
|
|
|
hi,
can any one help me about how to send the message on mobile i;e SMS through VC++
regards
Mubeen
|
|
|
|
|
Geez ! It's the second time in one hour that you post your message. It's a forum here, not a chat. If you didn't get any answers, maybe it's because you don't give enough information.
As far as I know, a computer cannot send SMS. So, asking how to send SMS through VC++ is nonsense. First find something that can send SMS (for, that, I have no clue) and if you are stuck about how to communicate with this device (or whathever it is), then come back asking specific questions.
It's a programming forum here, not a phone company service .
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
Hi,
1st thing u can send or even reecieve data through pc even through low level programmong languages i thought that u are a software developer u must know such think but any way if u dont know (Very Strange)then update ur self that pc can send or recive data through Mobile,even using VC++ .right
2nd thing i know that it is not a chat but it is really urgent thats why i m sending the messages very quickly....
|
|
|
|
|
|
If you are looking for a function like ::SendShortTextMessage(LPSTR msg) , I'm really sorry.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
[My Current Status]
|
|
|
|
|
LOL. That guy is crazy.
You have an apple and me too. We exchange those and We have an apple each.
You have an idea and me too. We exchange those and We have two ideas each.
|
|
|
|
|
I suggest you can post your question once and you can see answers
whitesky
|
|
|
|
|
|
|
thanx for that but is there any way to send sms through instead with smart phone coz i m making an industrial project to automating the industrial processes and in between that i have to send the current status of different processes (output of Boiler, pressure senesor) to a resource person and for thati have to use net and mobile
And all this is the part and requirment 0f industry......
|
|
|
|