Is there anyway to go about querying system information? In particular, I need to find out how tall title bars are set to in Windows on the client's end which is stored in SystemInformation.CaptionHeight, or so I'm told.
I've tried a few tricks to find the title bar's height with interfacing and JavaScript, but I can't seem to find a way to nab it.
Any suggestions?
ID:273485
Jun 13 2010, 10:41 am
|
|
Jun 13 2010, 11:04 am
|
|
You'd probably have to use a DLL, but that would only work on the host and not the clients.
|
In response to Nadrew
|
|
My most promising guise was to use window.outerHeight in JavaScript and change switch the titlebar on and off to detect teh difference... unfortunately, the window object doesn't seem to work.
|
In response to Hiro the Dragon King
|
|
BYOND uses the InternetExplorer as browser, which does not support outerHeight (see http://www.quirksmode.org/dom/w3c_cssom.html#windowview).
To get what you were looking for, look at the 'Example HTML code 2' Edit: Upon rereading your initial posting, I doubt this would help you at all, given that we're talking about embedded browser elements here. |
You could try to use Javascript to query the registry, as that's probably where the information is actually stored, but most clients will probably have such intrusive measures blocked.
Why do you need to know the title bar height? Are you trying to make a UI layout perfectly utilize the area available in the window? If so, that's probably not worth doing in the first place. |
In response to Loduwijk
|
|
I designed a system that will give you accurate coordinates of where your mouse is on the client's screen. This means I have to first know where the map is on the screen. Since coordinates start from 0 at the top of the screen, I need to know how big the title bar is to know how much space is between the map and the top of the screen.
|
In response to Hiro the Dragon King
|
|
Let me rephrase that as I was sitting on the side of the road with my laptop, and someone was walking toward me as if I were a shady character and I was a bit paranoid of this.
Using JavaScript, I have the access to the absolute coordinates of the mouse on the client's computer screen. In order to translate those into screen_loc or map coordinates, I would need the absolute position of the map on screen, as well. This I have been able to do surprisingly well, except for the one thing, that I have recently found, will throw off the calculation... the title bar in Windows is adjustable and I have no way to tell it's height. So far, there are no methods to fix this, aside from turning off the title bar and implementing control freak, which is not a good solution. EDIT: I somehow skipped over Schnitz's solution earlier and I will be trying that tonight. |
In response to Hiro the Dragon King
|
|
Hiro the Dragon King wrote:
So far, there are no methods to fix this, aside from turning off the title bar and implementing control freak, which is not a good solution. If you *really* wanted to, you could have players go through some calibration steps before letting them into the game proper. I think that would be a major pain in the rear though. |
In response to Hiro the Dragon King
|
|
Have you considered creating an invisible window which only contains an anchored label. Winset thw window's is-maximized=true, then winget the label's size. Compare the result with the screen size and you should have the size of the title.
|
In response to Hiro the Dragon King
|
|
As another solution, I know that Windows (I don't know about Unix based systems) has functions that will get the dimensions of a window, and functions that will get the dimension of the client-area of the window (the area that is actually usable, which does not include the title bar). If Javascript has access to this ability, you could get the height of the window and the height of the usable area of the window and subtract the two to find the height of the title bar.
|
Is this about what you wanted to get?
winset(src, "window1", "is-maximized=true") |
In response to Schnitzelnagler
|
|
I figured out a reliable way to grab the needed information and it's not too far from what you just suggested. I also found that the border size for windows is something adjustable through Windows, as well.
So what I did was use JavaScript to nab the available height of the screen. Then, I got rid of the menus and I maximized the window without the title bar and grabbed the size of an element in the window. Then I added a title bar and grabbed the size once more. I took the first size and subtracted the second one from it, giving me the title bar size. Finally, I subtracted the first height from the available height, thus giving me the border size. To finish it up, I replace the menus and put the window back to it's original design. Anyway... Thanks for the help. I wouldn't have figured it out without this thread. |
In response to Hiro the Dragon King
|
|
I decided to come back with an update and an excerpt form my library showing how I obtain the relevant information.
var |