Hey everyone,

I'm looking to add a block / function within a C++ application that will search for open windows. For instance, wordpad and notepad. If either are open perform an action. I'm doing this within win32 API but my question is this.

If I create something as such, this has to be on a thread. (I come from a VB background) and we had timers. What would be the best way to implement a timer in C++? I was thinking a do loop on a thread that checks for certain things, but would this be too memory / cpu intensive?

I'd appreciate any and all advice.

Thank you.

My preferred timer method is described here. What time span are you looking at to check for open windows?

@nullptr,

I will have to modify this code to make it so that it runs every 500ms and check for a handful of windows. I'm using this for a specific training where I work and I need to provide different instances for our employees to think outside the box to solve certain issues that may arise. I need to see how well to get this to fit into what we are looking to accomplish as I've already planned out the VB6, vb 2010/2015 portions.

A better question would also be if you wouldn't mind do you nkow of any tutorials or books from the 9X days (VC++ 6.0) that I might be able to reference as well? I used to have a lot of resources but stopped coding for a while.

Thanks.

@amx86,
You may want to add a tag to which VC++ you are using up top. I hope you understand that new apps in VB6 and VC 6.0 are from 1989 or earlier so this was the early days of the Internet and as the versions moved on the books may still be out on amazon and such but that's not why I'm replying.

First, add the tag if you can for the version you need this in. Next it's going to be hard to find folk with these version still working code. I have a few apps that live on in VB6 but they almost died as the client moved to W10. I did figure out what it was but am still left with a dead database link and have to work one last issue about printing in W10. The database issue is dead and not coming back to life unless the client agrees to moving forward off VB6. Printing? I think I have a workaround so we'll see.

I'd avoid to outright deny starting a new development in a dev system from 1989. At some point some one will have to take over so finding a set of CDs from 1989 may not be possible for them, not to mention the license.

@rproffitt,

Oh trust me I know. The reason why I'm going back to these days of coding is because we are seeing an uptick in malware written in these languages. Moreso VC++ 6.0, VB5-6. I'm pulling some old malware samples I've written and turning them into learning tools so that I can deliver what others need to pull regarding IOC's

vb5-6 I have a lot of code to fall back on. VC++ 6.0 wasn't my strong suit so that's why I posted the question.

In all actuality I still have my MSDN 6.0 still on my RAID. I have the environment installed in a VM for this purpose. PSC has been a good resource too. -=]

I really need to not post when it's late. My grammar was terrible. Sorry about that.

What I was getting at was while you have the dev kit today and even in a VM, your successor may not. Moving up can be cheap if you can use the Community versions of Visual Studio.

As to legacy apps, even I am stuck with a few VB6 apps that I got the client to pay up for a jump to making them install and run on W10. Using the web I found out how to get VB6's development system up on W10. This was crucial to figure out what else had to change in the app so it would install and run without having to resort to a VM or other tricks. As in natively on W10.

I did encounter a very odd issue that I noted at https://www.daniweb.com/programming/software-development/tutorials/516501/installing-visual-basic-6-on-windows-10-legacy-support-workarounds which is only there so others might not have to work out that bug.

Good luck in your efforts.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.