Results 1 to 7 of 7

Thread: Close Window based on title

  1. #1

    Close Window based on title

    As many of you know I'm a web developer not an application developer but one of my pet projects has given forth the need for a small application that can run in the background and close windows depending upon the window title.

    For example we could have a string "xxxx" the program would check every 5/10mins for any windows containg the target string if it found one it would close it automatically.

    If anyone could see their way to coing such an application I would be very gratefull.

    Minimum use of resources is prefered -thanks

    this will be part of a website/application I am developing and full credit etc will go to person who codes the app

    ta

  2. #2
    FindWindowA is part of the User32 library.

    push NULL
    push className
    call FindWindow

    push eax
    pop winhandle
    cmp al, FALSE
    jnz
    push error_message
    call MessageBox

    The FindWindow function retrieves the handle to the top-level window whose class name and window name match the specified strings. This function does not search child windows.

  3. #3
    Senior Member
    Join Date
    Jan 2003
    Posts
    3,915
    Hey Hey,

    You're going for minimal resources, how about using built in XP commands (or is this something other than XP)... taskkill can close a window based on window title..

    Example:

    taskkill /FI "WINDOWTITLE eq Untitled - Notepad"

    You could put this in the system scheduler and allow it to run.... I'm not sure if this will accomplish what you want.. but it seems like it should... If you just want the program to run at certain times.. I could prolly write you a small timer that would call taskkill every X minutes.

    Peace,
    HT

  4. #4
    HT sounds like exactly what I want - however can you use wildcards (as only a portion of the title will be the same each time) in your method?

  5. #5
    Senior Member
    Join Date
    Jan 2003
    Posts
    3,915
    Originally posted here by valhallen
    HT sounds like exactly what I want - however can you use wildcards (as only a portion of the title will be the same each time) in your method?
    Hey Hey,

    You can use Wild Cards as long as the first character of the search string is an actual letter. Not sure if it'll still be of use to you.

    Peace,
    HT

  6. #6
    ok full situation is i need to be able to close chat windows (http://www.reach-out.org.uk/skype) that contain the string '(offline)' which appears in format :

    username (offline) Skype Chat

    think you can help?

  7. #7
    Senior Member
    Join Date
    Sep 2004
    Posts
    117
    hehehe

    this post reminds me of a worm released that would search for titles in webpages if they contain xxx words or sex or such stuff would close the site or display Quoran words.
    (i think u guys know what i am talking about :P )

    so i was wondering, umm was it you loool

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •