Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

prevent from getting Window Handle 1

Status
Not open for further replies.

nitramregeits

Programmer
Sep 20, 2001
7
0
0
AT
Hi
As far as I know it is possible for other applications to
get a handle of the window from my application, and then
it is possible for this application to write into my
window. Is that true? If yes, is there a possibility to
prevent this?

Thanx in advance
 
So, I see two ways to prevent situations like this, but each way is very complex, needs close attention and I wouldn't implement them LOL.
But if you really need to do this you have to 1. hook the functions that return a handle to a window (including WindowFromPoint ;-)), or 2. if you want to prevent certain actions from outside your window inside it, hook functions that perform such operations (e.g. LineTo).
I could not point you implementation details; I wrote you this just for the pure information. As you may notice this will slow down your entire system because for each call to a hooked procedure you have at least to (method 1) compare the result of original function with your window handle and return NULL so the other app does no "see" your window or (method 2) simply return immediately from function if the function tries to modify your window ::)
Besides, you have to be very careful because a small mistake may cause your ENTIRE system to crash >:):O>

Picard Out.
 
Hi Picard
Thanks for your Information. It sounds quite helpful. I have just on problem with it: What do you mean with "hook a function" respectively how do you hook a function?

Martin

 
Martin,

Search MSDN for words &quot;hook win32&quot;. If you haven't yet installed this library, you can find the online version here: <a href=&quot;
If you still can't find how enough information, give your mail address and I'll do some copy/paste 4 u.

Good luck.

Adi.
 
Hi Adi
Thanks a lot for the tip. I'm sure this will help me.

Martin :)
 
Hi Adi
I did some research on hooks and I'm know convinced that there is know solution for this problem. Even if there are a lot of other problems, like interfering my DLL, ...

I decided know to give the responsibility to the users to keep their computers clean of viruses and troyan horses and all of that stuff.
Thanks anyway. %-)
 
There is a mistake in the previous message. Of course I meant: &quot;there is NO solution for this problem!!&quot;
LOL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top