|
PanB wrote: Is there any way, I can stop a user to end task an application/Process running, from Task Manager.
Lets say I have a simple application, i.e., HelloWorld. I do not want any user to end task that application from Task manager.
Upto Window OS 2000, you can make service to stop user from killing it from Taskmgr.. but Xp and Upward any thing can be closed from taskmgr
PanB wrote: Is it possible to hide an application/process from Task Manager?
Yes.. Hook the NT dll..
"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
|
|
|
|
|
Hi Alok.
Thanks for the reply and time.
Actually, I am working on WinXP.
Let me explain my problem in detail.
Lets say I have 2 executables.... a.exe and b.exe.
From a.exe, I am launching my another application b.exe.
i.e., wxExecute(modulePath, wxEXEC_ASYNC, NULL);
In modulePath, I am providing the string to launch b.exe.
Now, both of these applications are running as a stand alone process. But a.exe is a parent and b.exe a child process.
Now at this stage, if a user Kills a.exe from Task Manager, b.exe still run as a stand alone application.
My Requirement.
1. User should not be able to end task a.exe
----1st approach - I may hide it.
----2ns approach - User should not have previledge to kill it.
2. Id user end task a.exe, then b.exe should also be killed automatically.
If you can help, with any of the above appraoches, it will be great.
Thanks for your time and support.
Regards
PanB
|
|
|
|
|
PanB wrote: 1. User should not be able to end task a.exe
----1st approach - I may hide it.
----2ns approach - User should not have previledge to kill it.
IMHO 1 St Approach will be better, here is link for hiding process from taskmgr,
http://www.codeproject.com/system/Paladin.asp[^]
PanB wrote: 2. Id user end task a.exe, then b.exe should also be killed automatically.
b.exe should check that a.exe is running or not at regular interval (use WM_TIMER and FindWindow ), if b.exe don't find a.exe in process list (for this Check out EnumProcess api that will enumerate current system process list for you), it should stop itself or exit...I have used this approach in app monitoring program and its work fine for me till now. (you can make a seprate thread for monitoring in the b.exe).
if you have any suggestion apart from that.. please do share
"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
|
|
|
|
|
Alok.
Actually you are right.
I was also in touch with other developers in relation to the same.
Other option I was planning to implement was API hooking but that "virusy" way to do things.
Thanks for your support and time.
Questions:
Do you have any sample code to implement the solution. Or just explain the steps I need to follow to implement the same.
Thanks and Best Regards.
PanB
|
|
|
|
|
PanB wrote: Do you have any sample code to implement the solution. Or just explain the steps I need to follow to implement the same.
for which Problem... i.e. Problem One :- i have already giving you link that will hook TaskMgr to Hide your Application and problem Second :- I have already given you hint.. if problem is still there then tell me ..
"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
|
|
|
|
|
How about this.
Duplicate your A.EXE process handle and give the copy 'inheritable' permissions before starting the child process. Pass the handle's value to the child process. Then the child can check the duplicated parent process handle to see if it is signaled to detect that the parent process has exited.
Else, have the child just 'open' the parent process to see if it is running, and use that opened handle to watch for it being signaled.
I can't believe you recommended FindWindow , you should know better than that
|
|
|
|
|
Blake Miller wrote: I can't believe you recommended FindWindow
Why Not!, May be I am not clear in expressing my thought.. but i believe this code will express me well..
HWND g_hParentWnd=NULL;
g_hParentWnd=FindWindow(...,...);
Now make a thread or on WM_TIMER
If(!::IsWindow(g_hParentWnd))
{
}
Blake Miller wrote: you should know better than that
Any Particular Region for That Sir!
"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
|
|
|
|
|
I knew what your intention was, you just should not use FindWindow, and I thought you already knew that.
It is well-documented in the literature that FindWindow sends a WM_GETTEXT to all the windows it searches. If you encounter a window that has a stalled message loop, then your application will hang as well. And then if ANOTHER progrma does FindWindow, then guess what, it stalls when it gets to your application, and so on, and so on. Microsoft no longer recommends using that functon UNLESS you are only searching by the window's class name, which does not use the WM_GETTEXT method call.
These articles discuss the problem:
http://www.codeproject.com/dialog/messagemgmt.asp[^]
This one especially:
http://www.developerfusion.co.uk/show/1716/5/[^]
Another:
http://blogs.msdn.com/oldnewthing/archive/2003/8/21.aspx[^]
|
|
|
|
|
Blake Miller wrote: is well-documented in the literature that FindWindow sends a WM_GETTEXT to all the windows it searches.
I forget thats .. Thanks for great Information!
"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
|
|
|
|
|
Blake Miller wrote: It is well-documented in the literature that FindWindow sends a WM_GETTEXT to all the windows it searches. If you encounter a window that has a stalled message loop, then your application will hang as well. And then if ANOTHER program does FindWindow()
Sorry to Trouble you again Sir!. I am just clearing my doubt.
Here is entry of author of Blogs OldNewthing :-
"
If you are trying to GetWindowText() from a window in another process, then GetWindowText() will use the string from the "special place" and not send a message.
"
What MSDN states: -
In Remark Section of FindWindow :-
"
FindWindow calls the GetWindowText function to retrieve the window name for comparison. For a description of a potential problem that can arise, see the Remarks for GetWindowText.
"
Yes, Sir you 100% right that GetWindowText internally call WM_GETTEXT (i.e. FindWindow api call WM_GETTEXT), but with little exception, here what the remark section tells about that: -
"
If the target window is owned by another process and has a caption, GetWindowText retrieves the window caption text. If the window does not have a caption, the return value is a null string. This behavior is by design. It allows applications to call GetWindowText without hanging if the process that owns the target window is hung
"
But Sir, As Usual, you are Right, it will no good to use the FindWindow method in the scenario where we searching for the window which is hung, then GetWindowText will return NULL String( as written in Documentation), that can make Monitoring application Quit... When the Monitored application is still running. I will Take care of this in future!
"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
|
|
|
|
|
This returning of NULL, I believe, is newer behavior. I am pretty sure it did not used to work that way, and now at least we avoid the hanging. But, as you mention, it will still not be useful to get NULL back either for your purposes.
I only use FindWindow to search for window class names, not captions.
|
|
|
|
|
Blake Miller wrote: I am pretty sure it did not used to work that way, and now at least we avoid the hanging. But, as you mention, it will still not be useful to get NULL back either for your purposes.
Sir, Atleast this discussion lead both of us for new aspects of FindWindow api .... Now, atleast we will be careful using it..
"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
|
|
|
|
|
Blake Miller wrote: your purposes.
But I am replying to User PanB.. I just discussing scenrio with you, Sir.
"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
|
|
|
|
|
now i get the reason why they are using Win2000 in internet ceters
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1"> --[V]--
|
|
|
|
|
VivekuniQ wrote: now i get the reason why they are using Win2000 in internet ceters
Yeah previously i work for company which make Software of internet cafe
"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
|
|
|
|
|
|
Blake - Alok.
Thanks to both of you for your discussion.
Through your notes, even I have learnt a LOT.
Thanks again both you guys for your time and support.
Regards
PanB
|
|
|
|
|
Hi, I'm Trying to go further on Ole integration and Access2000 but there is something that is puzzling me: When everybody talks about Ole integration, all examples goes on Excel and Word, but what I’m trying to do is to integrate Access2000 functionality in a Dialog window. Is there any way to get this without having the Access window apart from my dialog?
Thanks in advance.
|
|
|
|
|
|
hi
I am localizing an MFC application(to support other languages).I gathered all the strings in string table and assigned corresponding ID for them.
I am using them in code as follows:
eg: if ID_OUT_OF_BOUNDS is the id for string "array out of bounds" in string table
i am using the code as
CString strOut;
strOut.LoadString(ID_OUT_OF_BOUNDS);
MessageBox(_T(strOut));
//the above line shows "error LstrOut Undeclared identifier" in unicode releaze minsize ,even i placed _T macro before the ID instead of string but it still throws up the error
If i compile in Release mode without unicode there is no error
if i remove the _T macro there is no error in unicode release minzsize.
so tell me whether _T macro is required in unicode builds or not .or Am i Missing Something?
Any Kind Of Help is Highly Appreciated
-- modified at 2:55 Friday 2nd December, 2005
|
|
|
|
|
There is no need to mention_T before CString strOut;
|
|
|
|
|
_T() is used for string *literals*.
So if you write something like _T("hello world"), it becomes L"hello world" in Unicode builds and "hello world" in non-Unicode builds.
The two most common elements in the universe are Hydrogen and stupidity. - Harlan Ellison
Awasu 2.2 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
vamshin wrote: MessageBox(_T(strOut));
convert above code to
MessageBox(strOut);
"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
|
|
|
|
|
Hello everybody,
Could anybody let me know how to use unique member function of list template class in STL? My problem is, I have a C++ class, Complex, which has two data members, real and imaginary numbers. I am using Complex class in creating a list. How can I use unique member function of list class when I have created a list using Complex class?
Grateful to you,
Thanks,
Software Developer
Sanjay Khapre
|
|
|
|
|
Uuuuhhh ??? What the hell are you talking about
Do you simply want to use a list of Complex ? If yes, just use that:
std::list<Complex> m_MyList;
Don't forget to #include <list>
Otherwise, be much more explicit (and even try to post code) because you question is really unclear.
|
|
|
|
|