|
I thought he wants to terminate the process which is not under his control (which is not programmed by him).
|
|
|
|
|
You are correct that took me correct. Actually problem is this I have a exe that behaves in 2 ways:
If run by user it is getting maximized, if run by timer(automatically) then it is in minimize mode. I want to close the minimize application as soon as it completes its job.
Task manager shows the same process name 2 times then how can I recognise which process in minimized.
|
|
|
|
|
pther wrote: how can I recognise which process in minimized.
See GetWindowPlacement[^]
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Yes this may work but through another exe I can get the HANDLE of process
like :
HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION |PROCESS_VM_READ,FALSE, processID );
How can I pass this HANDLE to :
GetWindowPlacement(HWND hWnd,WINDOWPLACEMENT *lpwndpl);
|
|
|
|
|
pther wrote: if run by timer(automatically) then it is in minimize mode
what makes the application to go into minimised mode. How you are spawning the application.
pther wrote: I want to close the minimize application as soon as it completes its job.
TerminateProcess API won't ensure that the job has completed.
I would say killing a process is cruel programming.
If this application is developed youself see Rajesh's reply[^] to restrict the number of instance. Why you need to kill the minimised one.
|
|
|
|
|
Rajkumar R wrote: Why you need to kill the minimised one.
I think he's trying to develop a 'killer app'.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
pther wrote: If run by user it is getting maximized, if run by timer(automatically) then it is in minimize mode. I want to close the minimize application as soon as it completes its job.
So what's the problem?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Don't use TerminateProcess to kill a process except as an absolute last resort - it can leave the DLLs that were in use in an incorrect state. Try to close it by posting a WM_CLOSE.
Judy
|
|
|
|
|
Hello.
I’m working on a Class that is going to solve a couple of equations.
My Visual Studio 2005 project contains two solutions.
-My Class (and a simple interface for testing)
-A general math library
I use a equation-solver from the general library, and it has a function pointer as one of its inputs. After some intense googeling I came up with the following code:
<br />
class MyClass{<br />
<br />
private:<br />
typedef double (MyClass::*FunctionPtr)(double x);<br />
double Equation(double x);<br />
double MyFunction(double x,double x1,double x2);<br />
};<br />
<br />
double MyClass::Equation(double x)<br />
{<br />
return x*x;
}<br />
double MyClass:MyFunction(double x,double x1,double x2)<br />
{<br />
double result = 0;<br />
<br />
FunctionPtr ptr;<br />
ptr = &MyClass::Equation;<br />
<br />
result = EquationSolver(x1,x2,(this->*ptr)(x));
<br />
return result;<br />
}<br />
<br />
double EquationSolver(double x1,double x2, double (*func)(double));<br />
But when I run the code I get the following error message (when I call the EquationSolver):
error C2664: 'EquationSolver' : cannot convert parameter 3 from 'double' to 'double (__cdecl *)(double)'
I have no clue how to solve this error. Can someone smarter than me help pointing me in the right direction? 
|
|
|
|
|
You cannot do that.
Declare your function as static , for instance:
class MyClass{
static double Equation(double x){ return x*x;}
};
result = EquationSolver(x1,x2, Equation);
BTW (this->*ptr)(x) is a function call.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
johanlich wrote: result = EquationSolver(x1,x2,(this->*ptr)(x)); // <- Error here
this "(this->*ptr)(x)" actually calling the member function and not just passing the function pointer as you expect.
johanlich wrote: // function in another solution
double EquationSolver(double x1,double x2, double (*func)(double));
func is a not a type of class member function, you cannot pass non-static class member function pointer to this function.
if you want to call a pointer to member function you need the class object, so you may pass both the object and pointer to member function like,
double EquationSolver(double x1,double x2, MyClass *pObj, double (MyClass::*func)(double));
or if you use a static member function. like
class MyClass{
private:
...
static double Equation(double x);
then use like this,
result = EquationSolver(x1,x2,this->Equation);
|
|
|
|
|
Thanks for your input. The static idea worked great, until I needed to call functions from within my Equation-function.
In the end we decided that it became too complex to use member function pointers, we will redesign the math library.
But I appreciate the help.
// Johan
|
|
|
|
|
I set the messages callback as so
<br />
lineSetStatusMessages(m_hLine,lpDevCaps->dwLineStates,0);<br />
But I don't get the message "LINECALLSTATE_RINGBACK"
It's possible so the device don't support this message?
Or how do I say to the system to send this message
Or maybe I need to take this message "LINECALLSTATE_PROCEEDING"
Thanks in advance
|
|
|
|
|
Is it posible to send SMSes via the RAS-Phone API? Platform: Windows CE 5.0
http://msdn2.microsoft.com/en-us/library/ms897066.aspx
|
|
|
|
|
|
9.39624
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
nisha00000 wrote: this is very important question ..to all
nisha00000 wrote: it's very urgent for us!!
How this is important to all? who is us?.... you???
Mukesh Kumar
Software Engineer
|
|
|
|
|
Mukesh_VC wrote: How this is important to all? who is us?.... you???
offcourse
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Yes, here are some C++ /VC++ openings.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
What are you expecting from us by asking this here?
I have been reading your posts today here on this forum. What do you think you are? Your replies to few of the questions here today are far from being a solution to what was actually asked. Don't you realize that you are downgrading the quality of the forum with your posts?
Don't ask anything like what you had posted here in this thread here. And moreover, don't post anything as solutions/suggestions when you are not sure about it. Leave that job to the experts here.
Regards,
Vijay.
|
|
|
|
|
nisha00000 wrote: Is there any openings in C++/VC++
if you know the answer, please replay ...
in C++/VC++ blocks opens with opening brace, you need to close it with closing brace otherwise you end with compilation errors 
|
|
|
|
|
Stop being facetious. That was an urgent query FYI.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: That was an urgent query FYI.
Sorry that i couldn't reply before OP delete the message.

|
|
|
|
|
thanks guys ....i these r all the best answers for ever ...its just guess but its correct..
By
Nisha
|
|
|
|
|
Its not good that you delete your qeustion.
|
|
|
|