Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Get all substrings from an application

Get all substrings from an application

Scheduled Pinned Locked Moved C / C++ / MFC
c++
12 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Brandon X12000

    How do you get every string from every element, control and window from a running process. I am creating an app that keeps people focused and on-task, and what I wanna do is scan every running process, and if the process contains a restricted word from anything (whether be buttons, text boxes, the window title, the text on the window of the application process), it will be closed immediately.

    Simple Thanks and Regards, Brandon T. H. Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst). Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison

    P Offline
    P Offline
    pasztorpisti
    wrote on last edited by
    #2

    You can't do that universally for controls that are owner drawn. However with standard controls you could periodically enumerate (every second or every 5 seconds) all HWNDs and child HWNDs and check some of their parameters for example their window class and you can then do some control-type specific checks. Window enumeration: EnumWindows()[^] EnumChildWindows()[^] Getting the window class: GetClassName()[^] In general you can use GetWindowText()[^] to get the titlebar, or button text, editbox text, and so on, but depending on the result of GetClassName() you can do control specific checks. Conclusion: If you want to handle a lot of controls then you have to check the api of every controls and you will still be unable to handle owner draw controls in some cases.

    B 1 Reply Last reply
    0
    • B Brandon X12000

      How do you get every string from every element, control and window from a running process. I am creating an app that keeps people focused and on-task, and what I wanna do is scan every running process, and if the process contains a restricted word from anything (whether be buttons, text boxes, the window title, the text on the window of the application process), it will be closed immediately.

      Simple Thanks and Regards, Brandon T. H. Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst). Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #3

      Exactly what problem are you facing?

      "One man's wage rise is another man's price increase." - Harold Wilson

      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

      "Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous

      P B 2 Replies Last reply
      0
      • D David Crow

        Exactly what problem are you facing?

        "One man's wage rise is another man's price increase." - Harold Wilson

        "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

        "Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous

        P Offline
        P Offline
        pasztorpisti
        wrote on last edited by
        #4

        :thumbsup: Totally valid question, I should have asked this in my previous post. My solution is just a dirty brutal-force hack. :-)

        1 Reply Last reply
        0
        • B Brandon X12000

          How do you get every string from every element, control and window from a running process. I am creating an app that keeps people focused and on-task, and what I wanna do is scan every running process, and if the process contains a restricted word from anything (whether be buttons, text boxes, the window title, the text on the window of the application process), it will be closed immediately.

          Simple Thanks and Regards, Brandon T. H. Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst). Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #5

          Only keenness keeps people focused and on task. Your Super-Cop application is going to fail. (bit philosophical, this time)

          Veni, vidi, vici.

          In testa che avete, signor di Ceprano?

          C J 2 Replies Last reply
          0
          • CPalliniC CPallini

            Only keenness keeps people focused and on task. Your Super-Cop application is going to fail. (bit philosophical, this time)

            Veni, vidi, vici.

            C Offline
            C Offline
            Chris Meech
            wrote on last edited by
            #6

            CPallini wrote:

            Only keenness keeps people focused and on task

            At one place that I worked at, there was this giant ogre about 8 feet tall that would walk around the office with a whip in his hand. He kept everyone very keen and focused upon work. :)

            Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

            CPalliniC 1 Reply Last reply
            0
            • C Chris Meech

              CPallini wrote:

              Only keenness keeps people focused and on task

              At one place that I worked at, there was this giant ogre about 8 feet tall that would walk around the office with a whip in his hand. He kept everyone very keen and focused upon work. :)

              Chris Meech I am Canadian. [heard in a local bar] In theory there is no difference between theory and practice. In practice there is. [Yogi Berra] posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]

              CPalliniC Offline
              CPalliniC Offline
              CPallini
              wrote on last edited by
              #7

              So Rajesh was your workmate! :laugh:

              Veni, vidi, vici.

              In testa che avete, signor di Ceprano?

              1 Reply Last reply
              0
              • CPalliniC CPallini

                Only keenness keeps people focused and on task. Your Super-Cop application is going to fail. (bit philosophical, this time)

                Veni, vidi, vici.

                J Offline
                J Offline
                Joan M
                wrote on last edited by
                #8

                CPallini wrote:

                Only keenness kneenness keeps people focused

                You know with a whip, a hot iron to leave marks and impossible deadlines... Eveyone on their knees! MUWHAHAHAHAHA! PS: this also works, the only drawback is that it is difficult to maintain people alive without eating and so... and it happens that you spend a lot of whips on formation... :rolleyes:

                [www.tamautomation.com] Robots, CNC and PLC machines for grinding and polishing.

                https://www.robotecnik.com freelance robots, PLC and CNC programmer.

                CPalliniC 1 Reply Last reply
                0
                • J Joan M

                  CPallini wrote:

                  Only keenness kneenness keeps people focused

                  You know with a whip, a hot iron to leave marks and impossible deadlines... Eveyone on their knees! MUWHAHAHAHAHA! PS: this also works, the only drawback is that it is difficult to maintain people alive without eating and so... and it happens that you spend a lot of whips on formation... :rolleyes:

                  [www.tamautomation.com] Robots, CNC and PLC machines for grinding and polishing.

                  CPalliniC Offline
                  CPalliniC Offline
                  CPallini
                  wrote on last edited by
                  #9

                  :laugh: :thumbsup:

                  Veni, vidi, vici.

                  In testa che avete, signor di Ceprano?

                  1 Reply Last reply
                  0
                  • P pasztorpisti

                    You can't do that universally for controls that are owner drawn. However with standard controls you could periodically enumerate (every second or every 5 seconds) all HWNDs and child HWNDs and check some of their parameters for example their window class and you can then do some control-type specific checks. Window enumeration: EnumWindows()[^] EnumChildWindows()[^] Getting the window class: GetClassName()[^] In general you can use GetWindowText()[^] to get the titlebar, or button text, editbox text, and so on, but depending on the result of GetClassName() you can do control specific checks. Conclusion: If you want to handle a lot of controls then you have to check the api of every controls and you will still be unable to handle owner draw controls in some cases.

                    B Offline
                    B Offline
                    Brandon X12000
                    wrote on last edited by
                    #10

                    pasztorpisti wrote:

                    (every second or every 5 seconds)

                    Every second? The CPU usage would be skyrocketing, you don't want your application being seen, hogging up the resources of a computer, it looks very unprofessional, guess I'll do it every second. On top of that maybe a system driver, that can intercept execution, just like Faronics(R) Anti-executable or other anti-virus programs. Maybe the main module or main part of my program should be the driver, since applications cannot reach or even "touch" an app until it runs as a process. But the driver can touch the application before it executes or becomes a process. But it doesn't matter what order it comes in, because the driver will be the first thing to prevent the app from executing. So, the application module of my program will be back up.

                    Simple Thanks and Regards, Brandon T. H. Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst). Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison

                    P 1 Reply Last reply
                    0
                    • D David Crow

                      Exactly what problem are you facing?

                      "One man's wage rise is another man's price increase." - Harold Wilson

                      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                      "Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous

                      B Offline
                      B Offline
                      Brandon X12000
                      wrote on last edited by
                      #11

                      Making people stay on task, since some people could be brilliantly smart with computers or maybe they could even more than that, and be computer programmers and write their own programs to do things that are off-task and/or intercept my software.

                      Simple Thanks and Regards, Brandon T. H. Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst). Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison

                      1 Reply Last reply
                      0
                      • B Brandon X12000

                        pasztorpisti wrote:

                        (every second or every 5 seconds)

                        Every second? The CPU usage would be skyrocketing, you don't want your application being seen, hogging up the resources of a computer, it looks very unprofessional, guess I'll do it every second. On top of that maybe a system driver, that can intercept execution, just like Faronics(R) Anti-executable or other anti-virus programs. Maybe the main module or main part of my program should be the driver, since applications cannot reach or even "touch" an app until it runs as a process. But the driver can touch the application before it executes or becomes a process. But it doesn't matter what order it comes in, because the driver will be the first thing to prevent the app from executing. So, the application module of my program will be back up.

                        Simple Thanks and Regards, Brandon T. H. Programming in C and C++ now, now developing applications, services and drivers (and maybe some kernel modules...psst kernel-mode drivers...psst). Many of life's failures are people who did not realize how close they were to success when they gave up. - Thomas Edison

                        P Offline
                        P Offline
                        pasztorpisti
                        wrote on last edited by
                        #12

                        Because of custom controls you won't be able to solve this problem perfectly. Any solution to this problem will be a big HACK. :-) The 1 second was just a random interval put there, of course you should tweak it and measure it as a delay between the end of the current "scan for strings" and the beginning of the next one instead of between the beginning of two scans.

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups