|
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
|
|
|
|
|
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.
|
|
|
|
|
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
|
|
|
|
|
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.
|
|
|
|
|
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
|
|
|
|
|
Totally valid question, I should have asked this in my previous post. My solution is just a dirty brutal-force hack.
|
|
|
|
|
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
|
|
|
|
|
Only keenness keeps people focused and on task. Your Super-Cop application is going to fail.
(bit philosophical, this time)
Veni, vidi, vici.
|
|
|
|
|
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]
|
|
|
|
|
So Rajesh was your workmate!
Veni, vidi, vici.
|
|
|
|
|
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...
|
|
|
|
|
Veni, vidi, vici.
|
|
|
|
|