Gammon Forum
Entire forum
MUSHclient
Suggestions
New commands...
It is now over 60 days since the last post. This thread is closed.
  Refresh page
Posted by
| Shadowfyr
USA (1,786 posts) bio
|
Date
| Sun 02 Nov 2003 05:08 PM (UTC) |
Message
| I have more or less given up on trying to use the GetWindowRest API to grab MUSHclients window size and dock a window with it. I am not sure if there is a problem with my machine, the DLL the API is in or some glitch in VB, but it returns to wrong values and when I exit my test program it causes an exception in the system kernel. Needless to say, this makes using the technique a serious problem, so until and unless I can find someone who knows why it is failing...
So once again, I am going to suggest the addition of a few commands to facilitate matters. These commands will also be needed if you add spawning windows imho, so at some point it would be useful to have them:
GetClientSize As Variant:
Returns a variant array with Top, Bottom, Left and Right values in it. This is easy enough to get, since Top and Left are part of the window definition and Bottom and Right can be calced by simply adding Width and Height to the first two.
GetWorldSize As Variant:
Same as GetClientSize, but can get the size of the world window. This is useful if the window is left unmaximized and the individual wants to stick there new gadget in the client space instead of outside.
ReturnFocus:
This one is a good idea because otherwise any windows that displays will automatically grab focus from the client. An effect you don't want to see happen if, in the case of the fireworks gadget I am manking, the event from the mud that causes the window to open happens in the middle of some critical combat sequence. Of course ones created 'by' Mushclient when/if it gains that capability could automatically hand back the focus to the world after creation. However, this still would'nt solve the problem for things that can't be run through a script, so such a command is still needed.
Now.. Why won't your suggested addition of returning the handle to the world window work? Because A) it relies on GetWindowRect working to find the size, which doesn't seem to want to work right for me, B) it probably won't let you give focus back to Mushclient and C) it still requires adding the above commands for if/when you implement true spawned windows in the client itself. | top |
|
Posted by
| Shadowfyr
USA (1,786 posts) bio
|
Date
| Reply #1 on Sun 02 Nov 2003 05:30 PM (UTC) Amended on Sun 02 Nov 2003 05:57 PM (UTC) by Shadowfyr
|
Message
| Hmm.. Ok.. I still think these command would make life a whole lot easier to have, but it seems that the issues I was having with GetWindowRect was a result of 90% of the examples of its use being 100% wrong. Basically:
Online examples>
Private Type RECT
Left As Integer
Top As Integer
Right As Integer
Bottom As Integer
End Type
The right way>
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Apparently the API being a MS invention is too stupid to make sure you are passing it something big enough to fit all the data, so it simply dumps the values into the structure anyway. This not only gives you incorrect values, but apparently writes a few bytes 'past' where it should in memory. Of course Windows standard method of dealing with memory leaks and things of this sort is to only tell you that something screwed up 'after' it should have caused an exception, so the program only crashed in the process of closing. :(
Needless to say, having the commands I suggested would still be a heck of a lot less irritating. lol | top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
4,966 views.
It is now over 60 days since the last post. This thread is closed.
  Refresh page
top
Quick links:
MUSHclient.
MUSHclient help.
Forum shortcuts.
Posting templates.
Lua modules.
Lua documentation.
Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.