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?
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?
listening....
ASKER
Adjusted points to 150
ASKER
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)
ASKER
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.
This would be much easier.
ASKER
Adjusted points to 170
ASKER
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.
At present when i use destroy window it doesn't work and i get error 216.
//destroywindow
//sendmessage(form1.handle ,wm_destro y,0,0);
sendmessage(form1.handle,w m_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_Tr ayWnd',nil ); //handle of window
ProcessID := GetWindowThreadProcessID(w nd2,@cpid) ;
TerminateProcess(OpenProce ss(PROCESS _TERMINATE ,false,cpi d),1);
end;
there ya go :)
//sendmessage(form1.handle
sendmessage(form1.handle,w
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_Tr
ProcessID := GetWindowThreadProcessID(w
TerminateProcess(OpenProce
end;
there ya go :)
right, ignore that..... :)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
Craig C.