I’m currently developing a program that scans the desktop for opened windows and stores the relevant window information into a database for retrieval later on.
I need to store things like the Window’s Size and position on the desktop in pixels, into a relevant “Size” and “Position” field in the database.
The size could consist of either the Top-Left and Bottom-Right X&Y coordinates, or instead could contain the width and height of the window. Whichever is simpler.
The Position could contain just the X, Y, and Z coordinates of the Top-Left corner of the window, which would allow us to position the window correctly on the desktop.
What would be the best data type to accomplish this? I’ve seen mentions of people using the POLYGON data type, but it’s one I’ve never seen before, and the examples I’ve seen are all for storing Latitude and Longitudes along with using “GetFromText” which is a function I’m having a hard time understanding as well.
Thanks for all your help!
From my perspective it’s more reliable (and more traditionaly) to store such parameters in Registry or ini-files. At the moment when app is launching, DB server can be not available. Besides, connecting to DB, performing select and so on just for restoring window coordinates and sizes looks very expensive. Launch process can take a long time.
And yes. Windows has integer screen coordinates, so it makes sense to use Integer data type for storing values separately x, y, w, h