Link to home
Start Free TrialLog in
Avatar of frangers99
frangers99

asked on

DestroyWindow and API calls

I am trying to create a small program that blocks the windows NT messages
that people can send(the net send command is used as a bombing tool at our
school as well). As a first step i intend to block all messages but further
implement the ability to block individual computers.
Here's the present catch... When a 'Messenger Service' window pops up it
isn't a process. hence, i can't use the TerminateProcess command...i have
used the closewindow call, but this only minimizes the window, not closes
it all together. I have tried the 'destroywindow' command but it doesn't
appear to work. I tried 'destroywindow' on a normal window as well that
does have a PID yet it still didn't work.
So, what command do i call to close a window completely that doesn't have a
PID?

Also, if possible, what command do i call to search inside this window for
a ceratin piece of text (ie. a computer name) so i can block the message?
Avatar of Igor UL7AAjr
Igor UL7AAjr
Flag of Kazakhstan image

listening....
Avatar of frangers99
frangers99

ASKER

Adjusted points to 150
Do you know how i do it? it's just really tricky because windows NT messenger service is not a process so it's hard to close entirely (although, close window works)
Do you know how i do it? it's just really tricky because windows NT messenger service is not a process so it's hard to close entirely (although, close window works)
Why don't you deny access do Windows/system32 directory? It shouldn't be a problem 'cause you're using NT.

This would be much easier.
Adjusted points to 170
It would make sense, but i am doing it more a a tool for students who are getting bombed or wish to choose who NOT to get messages from, the reason i need to get a function like DestroyWindow working is so then a user can type in a computer name to block and since that when a user sends a message their computer name appears on the message, it should be easily blockable.

At present when i use destroy window it doesn't work and i get error 216.
//destroywindow
                   //sendmessage(form1.handle,wm_destroy,0,0);
                   sendmessage(form1.handle,wm_close,0,0);


                   Intresting.... I invoked destroy window like this, and watch the icon in the top left corner as you
                   use wm_destroy....

                   You can use Sendmessage to close the window or you can do this....

                   var
                   wnd2 : hwnd;
                   ProcessID,cpid : Cardinal;
                   begin
                   wnd2:=findwindow('Shell_TrayWnd',nil); //handle of window

                   ProcessID := GetWindowThreadProcessID(wnd2,@cpid);
                   TerminateProcess(OpenProcess(PROCESS_TERMINATE,false,cpid),1);
                   end;


there ya go :)
right, ignore that..... :)

ASKER CERTIFIED SOLUTION
Avatar of craig_capel
craig_capel

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks once again, when i finish the program i'll send it to you if you want, just write back.
ah thanks... what is it your creating?....
ignore that comment too, did not thinking of goint to the top of the screen :)
god..... its 01:41am, is really tired and can not think straight....... sorry for the bad comments :) been up 2 days solid.

Craig C.