What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Basic Questions - LaTeX

Basic Questions - LaTeX
Author: Message:
Flippy
Junior Member
**


Posts: 29
34 / Male / Flag
Joined: Jun 2009
O.P. RE: Basic Questions - LaTeX
Wow thanks, I learned something new again :p

I've got it nearly done now. The latex png is created and shows in a window.

Only thing left now is to resize the window depending on the size of the image.

I have been trying first to simply resize the window, without caring for the size of the image yet. I have very limited experience with API calls from VB/C#. I'm looking at the SetWindowPos function now, and apparently it needs the window handle (wnd.Handle, correct?), the X, Y, width and height obviously, and then two other parameters I can't really understand.

First, there's the hWndInsertAfter parameter, which I assume is to determine whether the window is going to be on top, bottom etc of the z-order. OK. I want it to be on top (but not topmost), so apparently I need the HWND_TOP value.

Now... What is the value I need to use??!! That is the main reason I always have trouble with API programming. The MSDN entries never list the actual values for their constants?! How am I supposed to know what value to use?
I'm probably missing something... In the end I googled HWND_TOP SetWindowPos and found the value by accident in some obscure site... Why can't the MSDN page simply tell me what the value is?

Oh well, in the end I got it working with this:
JScript code:
Interop.Call("user32.dll", "SetWindowPos", wnd.Handle, 0, 1, 1, 800, 600, 0x0040);

It puts the window in the top-left corner, with a size of 800x600. Great.


Now a problem: The ImageElement displaying the equation is not resized. Do I need to resize that manually, too? Or can I use some kind of docking/anchoring to ensure that it stretches with the window when resized?

And, how can I find the size (not in kb, but width/height) of the PNG image? Ideally I want the window to be resized accordingly.

Finally, is it possible to find the location of the current chatwindow, so I can have the equation window pop up to the side, bottom, top, of it (depending on where the window is)?

I could calculate the 'free area' to the sides of the window, and then determine whether to display it to the right or left of it, to ensure that it does not pop up out of view.

If I can just find the location and size of the chat window that would be enough.



Oh yeah one more thing, there seems to be a bug in the editor. For the ImageElmt_SetImageFile function to accept a full path ("C:\Program Files\...") instead of a path relative to the Images folder, I needed to insert a backslash before the file path, so in my case this becomes:
JScript code:
wnd.ImageElmt_SetImageFile("EquationImage", "\\" + path + "\\file1.png");

The problem is that the editor (or at least the syntax highlighting) thinks that "+ path + ..." is part of the string.
When I run this code it works fine however, so it must be just a bug in the syntax highlighting.

Here's a screenshot to clarify the problem:
[Image: 144hfb.jpg]

This post was edited on 06-18-2009 at 11:33 AM by Flippy.
06-18-2009 11:29 AM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Basic Questions - LaTeX - by Flippy on 06-17-2009 at 09:14 AM
RE: Basic Questions - LaTeX - by ryxdp on 06-17-2009 at 09:26 AM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 09:48 AM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 10:01 AM
RE: Basic Questions - LaTeX - by NanaFreak on 06-17-2009 at 10:11 AM
RE: RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 10:14 AM
RE: Basic Questions - LaTeX - by NanaFreak on 06-17-2009 at 10:17 AM
RE: RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 10:25 AM
RE: Basic Questions - LaTeX - by NanaFreak on 06-17-2009 at 10:30 AM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 10:37 AM
RE: Basic Questions - LaTeX - by NanaFreak on 06-17-2009 at 10:51 AM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 10:59 AM
RE: Basic Questions - LaTeX - by Matti on 06-17-2009 at 12:07 PM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 12:23 PM
RE: Basic Questions - LaTeX - by Matti on 06-17-2009 at 01:49 PM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 02:41 PM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 03:07 PM
RE: Basic Questions - LaTeX - by CookieRevised on 06-17-2009 at 05:54 PM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 06:14 PM
RE: Basic Questions - LaTeX - by CookieRevised on 06-17-2009 at 06:36 PM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 07:38 PM
RE: RE: Basic Questions - LaTeX - by CookieRevised on 06-17-2009 at 08:27 PM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 08:32 PM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 08:38 PM
RE: Basic Questions - LaTeX - by NanaFreak on 06-17-2009 at 09:02 PM
RE: Basic Questions - LaTeX - by CookieRevised on 06-17-2009 at 09:27 PM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 10:01 PM
RE: Basic Questions - LaTeX - by foaly on 06-17-2009 at 10:42 PM
RE: Basic Questions - LaTeX - by CookieRevised on 06-18-2009 at 01:42 AM
RE: Basic Questions - LaTeX - by Flippy on 06-18-2009 at 11:29 AM
RE: Basic Questions - LaTeX - by NanaFreak on 06-18-2009 at 11:43 AM
RE: Basic Questions - LaTeX - by Matti on 06-18-2009 at 12:03 PM
RE: Basic Questions - LaTeX - by Flippy on 06-18-2009 at 01:29 PM
RE: Basic Questions - LaTeX - by Matti on 06-18-2009 at 01:52 PM
RE: Basic Questions - LaTeX - by Flippy on 06-18-2009 at 03:32 PM
RE: Basic Questions - LaTeX - by Matti on 06-18-2009 at 03:56 PM
RE: Basic Questions - LaTeX - by Flippy on 06-18-2009 at 04:21 PM
RE: Basic Questions - LaTeX - by Matti on 06-18-2009 at 05:33 PM
RE: Basic Questions - LaTeX - by matty on 06-18-2009 at 05:36 PM
RE: Basic Questions - LaTeX - by Flippy on 06-18-2009 at 05:47 PM
RE: Basic Questions - LaTeX - by Flippy on 06-18-2009 at 06:11 PM
RE: Basic Questions - LaTeX - by Spunky on 06-18-2009 at 07:11 PM
RE: Basic Questions - LaTeX - by Matti on 06-18-2009 at 07:22 PM
RE: Basic Questions - LaTeX - by Flippy on 06-18-2009 at 07:23 PM
RE: Basic Questions - LaTeX - by Flippy on 06-18-2009 at 08:10 PM
RE: Basic Questions - LaTeX - by CookieRevised on 06-19-2009 at 09:14 AM
RE: Basic Questions - LaTeX - by Matti on 06-19-2009 at 01:43 PM
RE: RE: Basic Questions - LaTeX - by CookieRevised on 06-19-2009 at 10:24 PM
RE: Basic Questions - LaTeX - by Flippy on 06-19-2009 at 02:31 PM
RE: Basic Questions - LaTeX - by sabian2008 on 07-30-2009 at 03:38 PM
RE: Basic Questions - LaTeX - by Flippy on 07-30-2009 at 04:36 PM
RE: Basic Questions - LaTeX - by sabian2008 on 08-07-2009 at 01:01 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On