|
Tim Smith wrote:
In example two, B1 is a circle. B2 is also a circle that doesn't encircle B1. D inherits from both B1 and B2 so D encircles both B1 and B2. However, since B1 and B2 can not exist at the same location in D, one of the two must follow the other. Thus B2 has a different address.
Here as u say B1 & B2 does not exist on same location, same case is for normal inheritance too..why it needs special handling in MI only?
|
|
|
|
|
hi all,
I want to get rid of "Log on to Windows" Dialog in Windows 2000 Professional when starting windows.
How ever my computer is in a domain..
Can I pass user name and password to "Log on Dialog" using C++ when starting windows?
Thanks in advance..
|
|
|
|
|
pubududilena wrote:
I want to get rid of "Log on to Windows" Dialog in Windows 2000 Professional when starting windows.
This will require replacing MSGINA.DLL with one of your own.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hey, I was wondering if there was a way to prevent operator new() from calling the class constructor.
I have a CDialog derived class that creates a modeless dialog when it's constructor is called and I want to limit it to one instance. So what I want to do is when the dialog's operator new() is called, I want it to return a pointer to the already existing dialog. To accomplish this I have overridden the operator new() function
CWnd *CMyDialog::pMyDialog = NULL;
#ifdef _DEBUG
void CMyDialog::operator new(size_t Size, LPCSTR File, int Line)
{
if (pMyDialog)
return pMyDialog;
else
return CDialog::operator new(Size, File, Line)
}
#else
The problem is that once operator new() returns it immediately jumps to the class constructor, which initializes everthing to NULL, totally messing up the dialog that was created previously.
Now I know that I can keep a pointer for the dialog in it's parent window, and check that pointer to see if the dialog is active, but I want to try something different if it at all possible. This way the dialog can be created or accessed from any other class without having to have access to the stored pointer.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
why not make it a singleton?
|
|
|
|
|
Zdeslav Vojkovic wrote:
why not make it a singleton?
Because I did not know what that was until now
Thanks for the suggestion, seems to fit the bill perfectly.
Do you have a prefered method on how to do this? or are the articles present here on CP all equal in their implementation?
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
when i display the shutdown dialog box(i did.). i want the procedure can select the item with shutdown/restart/logoff/... and does it's selection., how can i do ?
|
|
|
|
|
take a look at radiobuttons, GetCheck and ExitWindowsEx()
|
|
|
|
|
|
|
This code:
void Model3D::smooth() {<br />
vector<Vertex*>* newVertices = new vector<Vertex*>;<br />
float avg = 0.0f;<br />
for(int i=0; i<vertices->size(); i++) {<br />
Vertex *oldV = vertices->at(i);<br />
Vector3D pOld = Vector3D(oldV->x,oldV->y,oldV->z);<br />
Vector3D d = Vector3D(0.0f,0.0f,0.0f);<br />
int numOfVertices = 0;<br />
for(int j=0; j<oldV->edges->size(); j++) {<br />
Edge* e= edges->at(oldV->edges->at(j));<br />
Vertex* v= vertices->at(e->vertices->at(0));<br />
if(v->id == oldV->id)<br />
v= vertices->at(e->vertices->at(0));<br />
numOfVertices++;<br />
Vector3D qi = Vector3D(v->x,v->y,v->z);<br />
d = d + (qi-pOld);<br />
}<br />
d = d / (float)numOfVertices;<br />
d = d * ALPHA;<br />
avg += sqrt(d.x*d.x + d.y*d.y + d.z*d.z);<br />
Vector3D pNew = Vector3D(0.0f,0.0f,0.0f); <br />
pNew = pOld + d;<br />
Vertex *newV = new Vertex(oldV->id,pNew.x, pNew.y, pNew.z);<br />
newVertices->push_back(newV);<br />
}<br />
avg = avg / vertices->size();<br />
for(i=0; i<newVertices->size(); i++) {<br />
Vertex* v = vertices->at(i);<br />
Vector3D n = Vector3D(v->nx,v->ny,v->nz);<br />
n = n * avg;<br />
v->x = v->x + n.x;<br />
v->y = v->y + n.y;<br />
v->z = v->z + n.z;<br />
}<br />
for(i=0; i<vertices->size(); i++) {<br />
Vertex *oldV = vertices->at(i);<br />
Vertex *newV = newVertices->at(i);<br />
oldV->x = newV->x;<br />
oldV->y = newV->y;<br />
oldV->z = newV->z;<br />
delete newV;<br />
}<br />
}<br />
shows an incredible consumption of memory in the Win task manager when it is run several times over the same Model3D object... ideally NO memory should be used... can anyone help, please?
thanks,
FG
|
|
|
|
|
vector* newVertices = new vector;
you are not deleting this vector
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hi,
Plz have a look at the following code snippet.This code will be executing in an endless while loop waiting for an event to be logged in the application log.If any event is logged then it will post a message to the dialog class for displaying it.
NotifyChangeEventLog(hEventLog, hEvent);
DWORD dwWaitResult = WaitForSingleObject(hEvent, INFINITE);
if(dwWaitResult ==WAIT_FAILED)
{
AfxMessageBox("Waiting Failed");
return 0;
}
PostMessage(pDlg->m_hWnd,UM_EVENT_LOGGED,0,0); //(long)hEventLog );
Now the problem is it will not notify all the events logged.ie if it notifyes a event logged then it will notifyes only after 5 seconds.So all the events logged with in this 5 second time will be lossed.
Plz help me with a solution...
With Luv
|
|
|
|
|
WaitForSingleObject is stopping your application for five seconds, until it times out, I reckon.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
"WaitForSingleObject" never get timed out becoz the time out parameter is specified as "INIFINITE".
Suppose if an event is logged at 12:05:30(hh:mm:ss).
If ur belief is true, then the application will displays the event only at
12:05:35. Isn't it?
But here it displays at 12:05:30 itself. But after that it is ignored all the events logging till 12:05:35.
|
|
|
|
|
VCSharp007 wrote:
if it notifyes a event logged then it will notifyes only after 5 seconds.So all the events logged with in this 5 second time will be lossed.
This is by design because the system calls PulseEvent() no more than once every five seconds.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
...any idea to overcome this problem?
any alternate method for checking the event logging process??
Plz tell me a solution.
|
|
|
|
|
Couple what you have with a "date/time since last check" flag.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Thnx David.
Eventhough itz a good idea ..real time display is not possible??
another problem with this is if two events logged in the same time one wil be losed.
I think the "event count " checking is more effective, isn't it?
|
|
|
|
|
VCSharp007 wrote:
Eventhough itz a good idea ..real time display is not possible??
Of course not. PulseEvent() only notifies once every five seconds.
VCSharp007 wrote:
another problem with this is if two events logged in the same time one wil be losed.
Then this is a problem with the event logger itself, not your monitoring application. It should not matter when you check for new events, whether it's twelve times per minute or once per day, as long as the events are present in the log.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi all,if i have a string,i.e : "jry1924",how to check whether it is a number or not?
I tried using function atof but if your string is not a number,it returns 0.
Help me pls!
|
|
|
|
|
|
The old fashioned way was to use strtoul and check the 'end pointer'.
But be aware if it is a very large number it will fail with an overflow.
"An education isn't how much you have committed to memory, or even how much you know. It's being able to differentiate between what you do know and what you don't." - Anatole France
|
|
|
|
|
Use strtod instead of atof . It has a parameter that points to first character in the string that it does not recognize as part of a number. If that character is not NULL (the end of the string) the string is not a number. It takes into account your current locale settings and exponential numbers.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
have you given the thought of making ur own function? tis a little longer though!,if u like doing it from the basic,then this might intrest u.....
char a[]="jry1924";
int ch;
BOOL flag=0;
for(int i=0;(ch=*(a+i))!=0;i++)
{
ch-=48;
if(ch<0 || ch>9)
flag=1
}
if(flag ==0)
cout<<"NUMBER!"
else
cout<<"nope!not a number!";
cheerz.....
"faith, hope, love remain, these three.....; but the greatest of these is love" -1 Corinthians 13:13
|
|
|
|