Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ VBscript ➜ Windows, Images

Windows, Images

It is now over 60 days since the last post. This thread is closed.     Refresh page


Pages: 1 2  

Posted by Okram   Italy  (8 posts)  Bio
Date Mon 28 Oct 2002 10:37 AM (UTC)
Message
Hallo all, I've recently (today) added MXP support to my Smaug-based MUD, and I was wondering how I could create a new window (like the "world" window) in VbScript, in order to put images in it.

What I would do is, shortly, that:

1) mud sends tag <SHOWIMAGE IMAGE_NAME.EXT>
2) client interprets SHOWIMAGE as: if no image window create image window; show file images/image_name.ext in image window

nothing else..

Anyone has clues on how to do it?

Thanks,
Okram
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #1 on Mon 28 Oct 2002 07:07 PM (UTC)

Amended on Mon 28 Oct 2002 07:10 PM (UTC) by Shadowfyr

Message
Short answer is you can't. Muschlient doesn't have support for displaying objects generated by the script.

Now the more complex answer is that 'in theory' you can by creating an COM program that has a picture box and adding some code into it for FTPing the file. I was working on this, but gave up when I realized that supporting all object types would be next to impossible due to the way Visual Basic dealt with some of them. Because of this I also don't have any real code to share either. Sigh...

That is the only way around it currently unless someone can come up with a simple window interface that can load any object, FTP when needed and is sufficiently fast and compact enough to convince Nick to add it to the client. Unfortunately this is a bit of a tall order. :p

However.. If you don't mind the ridiculous overhead involved you could create an Internet Explorer object (in other words open an explorer window) and pass it the address for the picture. I don't feel this is a 'good' solution though because it is like using a wrecking ball to remove plastic wrap. lol
Top

Posted by Okram   Italy  (8 posts)  Bio
Date Reply #2 on Wed 30 Oct 2002 08:58 AM (UTC)
Message
Quote:
The more complex answer is that 'in theory' you can by creating an COM program that has a picture box and adding some code into it for FTPing the file.


I sincerely don't need FTP/HTTP support: users can download images from my web site and put them under images/ under mushclient's program dir, I think. So I can create a COM program with some picture boxes and then pass it arguments to show pic 1,2 or 3 in the box I want it to show 'em...

My question is, now: how can I create a window INTERNAL to mushclient in which I can show this COM object?

Quote:
However.. If you don't mind the ridiculous overhead involved you could create an Internet Explorer object (in other words open an explorer window) and pass it the address for the picture.


this could be a quick fix :P

I'll see what can I do, but first I have to know how to create a window internal to mushclient, either in vbscript or whatever.. I really don't have clues on how to do it :)

Okram
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #3 on Wed 30 Oct 2002 06:52 PM (UTC)
Message
Well.. it isn't an internal window to mushclient, it is known as a out-of-process server. In other words you are having it talk to an external program. In both the case of a seperate image window or Internet Explorer object you link it through scripting like:
Sub loadIE()
  Dim Handle
  Set Handle = CreateObject("InternetExplorer.Application")
  Handle.Navagate "c:\MyMudPics\Fred.png"
  Handle.Visible = True
End Sub


Note... To make your own you would use Visual Basic to create an activex program with a simple picturebox, add some code to rescale it and the window depending on size (or even adding scroll bars, etc.), then since it doesn't actually need to talk to mushclient at all you would need is:
Sub loadMyApp()
  Dim Handle
  Set Handle = CreateObject("MyApp")
  Handle.Display "c:\MyMudPics\Fred.png" '<--- Your public sub in the program you made for resizing the window
    'and displaying the picture.
End Sub


The drawback though is that IE supports png directly, but the 'standard' libraries for most compilers don't, so you would have to use jpg, gif, etc. One alternative to this is to create your VB program and add a 'WebBrowser' control to it instead of the picture box. This would if done right provide 'most' of the function that IE has, but none of the extra junk that makes it so bloated.

To do this 'according to my 1-2 year out of date book' you would:

1. Create a new ActiveX EXE
2. Add the Microsoft Internet Controls (from Components) to the project.
3. Place a WebBrowser control on the form.
4. Add a sub to support the .Navigate function:
Public Sub Navigate(URL AS String)
  On Error Resume Next
  WebBrowser1.Navigate (URL)
End Sub

5. Make sure everything including the form is visible by default and you have changed any labels, captions, etc. to what you like. ;)
6. Optionaly add menus, button, a URL entry line, etc. to make it a real browser.

Then in your script you would just do:

Sub loadMyApp()
  Dim Handle
  Set Handle = CreateObject("MyApp")
  Handle.Navigate "c:\MyMudPics\Fred.png"
End Sub


Which is basically the same as what you would do with the picturebox, but relies on the core of IE to handle everything. This means you coulds also feed it 'C:\MyMudPics\AllPics.html" as well, if such a web page existed. NOTE: I have not tried this, so can't be 100% sure it works or that I didn't leave out something important.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #4 on Wed 30 Oct 2002 07:19 PM (UTC)
Message
MUSHclient's MXP implementation already supports the <img> tag, this will generate a hyperlink which when clicked on, if it can, cause that image to be opened in your web browser.

This is a partial solution.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #5 on Wed 30 Oct 2002 07:34 PM (UTC)
Message
I like my solution better... lol As I said having it call IE is 'like using a wrecking ball to remove plastic wrap' and I stand by that statement. The same goes in most respects for using any other browsers. Maybe you could impliment a floating window that supported the WebBrowser control directly into mushclient? It could even run in a seperate thread, since the only thing you want it to do is display stuff you request, not actually talk to the rest of the client or scripts. That would kill two birds with one stone, giving you a window you could call by name from inside scripts and that can display practically anything, but shouldn't hog mushclient's other resources. I have seen a program done this way and it is quite fast compared to full IE and though more limited, we don't need a complete full featured browser, just something that can handle 'basic' stuff. It may be something to consider as an alternative to adding in-line pictures and the like, though.. How you would handle multiple image tags that occure close together... Maybe adding a auto-thumbnail thingy to it.
Top

Posted by Okram   Italy  (8 posts)  Bio
Date Reply #6 on Mon 04 Nov 2002 12:15 PM (UTC)
Message
Ok for this solution, even if it's certainly not like having a window inside the client..

Probably my MUD will create a temp file like http://site/players/PLAYERNAME/temp[0000-9999].html and give a link to the player (if he wants to see the map he clicks)

OR

a mushclient script will create the HTML file and open it on the browser..

Uhm.. I'll see..

Are you sure there is *NO* way to open a window inside the client? :(

Okram
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #7 on Mon 04 Nov 2002 05:41 PM (UTC)
Message
Sorry but no.. lol Sadly MS decided that every user should be happy either using IE as a viewer or writing full on applications. While 3.1 had something ironically called Finder (this is MAC terminology), it was later integrated to IE and no middle ground was allowed. There is simply no 'window' class accessable through COM, so you are forced to integrate any object display into your main programs or use a browser. I think this sucks imho, but until someone a little bit cleverer than me can create a mini program that provides such a window class, it would likely need to be written in C++ to really do what it needs, we are stuck with very limited options. :p

Of course you can always use the Netsight browser (only 455k), assuming you can still find it. It is a pretty good example of what you can do with the browser control and had it not been developed for an online game, it would probably have been half the size it is (several embedded resources, a pop-up called mephista that repeats bits of web pages back to you, etc.) I use it all the time to hop to web sites when I don't want to wait for IE or Opera to load, not to mention swallowing about 10% of my memory. lol Wish I has the source code for it... :p
Top

Posted by Gedrean   USA  (12 posts)  Bio
Date Reply #8 on Thu 14 Nov 2002 06:35 PM (UTC)
Message
What you're saying is I can't just, oh say, create an object as a new dialog or window in Vbscript, slam some object in there, position, set it up, then do windowhandle.show ?

There's no way for that to work?

I'm not special! I just code my brains out for you!
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #9 on Thu 14 Nov 2002 07:25 PM (UTC)

Amended on Thu 14 Nov 2002 07:28 PM (UTC) by Shadowfyr

Message
That is exactly what I am saying, there is no 'window' COM class and unlike on Macs the dialog class has a fixed set of things they can display. While they 'are' accessable from scripting and have their own windows, they are limited to three fixed types, an input box style, an alert style and the usually ok - cancel design. There are no options to use Dialog.Add for additional objects and I am fairly sure that they auto-size, so you couldn't really make them bigger (I tried and they can only be directly called like a sub, not, as far as I could tell, created then displayed like other objects). In general most stuff done in scripting on the web relies on the ability of IE to directly support such objects. No support has ever been added to allow stand alone, user definable windows from scripting since the assumption is that you are going to use html and forms for this sort of thing and are thus using the browser to display them. The closest you can get, as I said, is to either call a browser window up or write your own program to provide such a window. Frankly, even on a Mac, the ability to customize things to such an extent is probably buried from the users level. :p
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #10 on Thu 14 Nov 2002 11:40 PM (UTC)
Message
I'm not sure if this is what you are trying to do exactly, but this seemed to work for me. It opens an image in a browser window. The example demonstrates setting various window attributes ...


Set IE = CreateObject ("InternetExplorer.Application")
IE.Navigate "http://www.gammon.com.au/images/name.gif";
IE.AddressBar = false
IE.menubar = false
IE.ToolBar = false
IE.width = 400
IE.height = 250
IE.resizable = false
IE.visible = true
set IE = Nothing

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #11 on Fri 15 Nov 2002 12:36 AM (UTC)
Message
OK, forgive me if this is entirely out of topic, but it's 4am and i'm too tired to read everything :p Can't you create an ActiveX/COM picturebox control (just a VB form with a picturebox in it) in VB, and then load that onto MUSHClient? That sounds reasonable to me, and relatively (if not ridiculously) easy to do.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #12 on Fri 15 Nov 2002 02:40 AM (UTC)
Message
Ok.. First to answer Nick..

Yes I did suggest this as a 'possible' alternative, for now. The problem is that IE is a major memory hog (even if you turn stuff off), slow to load and if you have 'any' problems with your version of windows, opening, closing and navigating with such a window is 100% certain to cause the system to lock-up, BSD or reboot. Imho it is not a stable or effecient way to do it. In fact most of the problems I have had with 95 and 98 and which many people have had in newer versions that they couldn't fix with a new driver have been tied to IE or its mini-version Explorer.

As for your statement Poromenos, that only works in programs that support what is known and a Document Container. Why? Because pictureboxes and 99% of all other ActiveX controls rely on the client to provide the form/window/space in which they are to appear. They have no internal means to display themselves and thus can only be placed onto existing windows. Mushclient does not provide a way to display them and I am not entirely sure how programs like IE or Word support loading and display of such things internally, except that they impliment a document container, which then loads a document, which in turn 'contains' the info needed to position the items to be shown. It is a complex mess when all you really want to do is tell it 'create a window and attach this picture'.
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #13 on Fri 15 Nov 2002 04:41 AM (UTC)
Message
I think Poromenos is right. If I can do it with IE, I should be able to do it with a custom VB COM object. I was about to write one when I thought that maybe IE could be used as an example.

I did earlier an example of using a VB program which could be instantiated from MUSHclient, so I don't see why it couldn't display a form and put a picture on it.

I agree that IE is an overkill, to say the least, for displaying one image, but it demonstrates that in theory at least, MUSHclient can cause images to be displayed.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Shadowfyr   USA  (1,791 posts)  Bio
Date Reply #14 on Fri 15 Nov 2002 03:53 PM (UTC)
Message
Oh, I agree. A custom COM program is better, the key being 'if it is packaged and integrated in some way with the client'. Even if only through a world.gotfocus style event, which I don't believe is available in plugins, a fact that presents the most serious problem with this method imho. That is why I think custom COM or not, it needs to be either aware of if the world has focus using a world.hasfocus query or mushclient needs to tie it to the world file some other way. Why? Imagine the guy who said he had like 11 (or was it 21) worlds open at once, then imagine 11-21 extra windows open for those worlds doing tasks of one sort or another and the mess you get if they can't minimize or otherwise hide themselves when the world they are connected to is not the one that has focus. A major mess.. The same may be true for an external one anyway, unless it was designed with tabbing like I suggested, so that you are not opening 10 seperate windows for every plugin or script requesting one in a single world, something that only multiplies the problem. This is imho a nightmare senerio, not a solution.
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.


54,387 views.

This is page 1, subject is 2 pages long: 1 2  [Next page]

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.