Jump to content
AC Tool Forums
Sign in to follow this  

Ramblings of the Divide creation I

Recommended Posts

Sorry for the major delay in the release of Beta for Divide. But, I came across a major issue with the UI that unfortunately require the complete rewrite of the UI and it's code.
And as such I have been taking it slow on doing the rewrite and trying to correct the problem as I go along.
But, I wanted to tell you of one the things I have found while working on Divide, and AC Tool over the years.
One of the things I will bring up at this time is the SetActiveWindow command and the subsequent List of Active Windows window.
In AC Tool the SetActiveWindow was originally setup to allow the user to set the window they wish to be the active one by passing the Window's Caption/Title or by passing the appliation's PID (Process ID number). I even remember there being something in the AC Tool Help file about the use of the SetActiveWindow command being used with the Window's Caption/Title or it's PID. But, that was so long ago. And at that time I never need, or thought that I would need, to use the PID of the application.
But, as I started working on the creation of Divide. I had found that the code for the SetActiveWindow, as it was code, allowed for the use of the command with the Caption/Title, PID, or even without either of the Caption/TItle or PID. As it was coded if you used the SetActiveWindow command without a Caption/Title or PID. It would open up a window to display the currently Active Windows. And allow you to pick the WIndow/process that you wanted it to work with.
But, during my testing I had found that the SetActiveWindow was not working as it should have based on the code. I even went and pulled out the last version of AC Tool that Cam released and tht it too had the same problem. SetActiveWindow would not work if you used it with a PID.. And using it without a Caption/Title or PID would cause the window to be shown. But, SetActiveWindow would not set the WIndow/Process that you selected in it active.
So, I started looking at the original code used. I found that the reason the use of the SetActiveWindow command without a Caption/Title or PID would not work. Is because the code as written would use the PID number of the Window/Process that you selected in the Active Window list window. This told me that the problem in the SetActiveWindow command was with the use of the PID number. So, I changed the code to use Window/Process caption/title instead when not giving the Window/Process caption/title.
And Yes this confirmed my thinking. The problem was with the use of the PID number.
So, I went and added statements to the code help me find where the problem was happening and what the state of various variables were at each stage. And what I had found was that the PID number being received from the code to get the WIndow/process information, was not the correct PID number. In most cases the PID number received did not belong to any process running in windows.
At this point I spend the next 3 weeks writing, and rewriting, the section of code to get the list of windows/process and to retrieve their information. Every time I did so, I used the same procedure/functions that cam had use. But, I had done in so many ways, I had lost track of how many times I had redone the code. But, each time I ended up with the same problem. The list of windows/process would be created with all of the Windows, and processes, currently actively running. With correct caption/title and correct PID (as confirmed in Windows Task Manager) being display in the list. But, for some reason the PID would not work when trying to active the window/process.
So, I started looking on the net for some one having the same problem to see if there was a solution to it. I did not find any postings were someone was having the same problem. But, I did find postings with people were asking how to set another Window/process as the active Window/process. And the code given to those people was completely different from that of what Cam had used.
After doing some more research, I had found only one example code (at that time) that used the API methods that Cam had used to get the Window/Process window information. All the rest was using an API method that I assume was added sometime after Cam originally created that section of code.
So, I spent 4 hours going over the various codes samples I could find. And implemented the new IP use with SetActiveWindow using it.
Once I had implemented the new API to get the list of Windows/Processes and their caption/title or PID numbers. I was able to get proper PID numbers and the rest of the code that Cam had used to set the specific window/process as active work without any problems.
Once that was fixed and I had done much testing to make sure of it. I went and updated the code used in the List of Active Windows window to use the same code to get the list of active windows/process.
And the SetActiveWindow command now works as it was originally intended, and coded, to do.


Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...

Important Information

By using this site, you agree to our Terms of Use and to our Privacy Policy.