Solved another window - make it always on top ?

February 21, 2012 at 09:56:51
Specs: Windows XP , 2Ghz/ 2Gb
Not the VB window / form
But another window eg IE

An additional problem is that I set the window as the smallest possible. Which means the "Title" looks more like the URL eg:

With ie
.Addressbar = False
.MenuBar = False
.StatusBar = False
.Toolbar = 0
.Height = 98
.Width = 198
.Navigate theURL
.Visible = True
Do While ie.ReadyState <> 4:
Loop 'wait for IE to finish
readHTML = .Document.body.innerHTML
End With

which does what I intend but for the "always on top"


See More: another window - make it always on top ?

Report •


✔ Best Answer
March 10, 2012 at 06:47:41
Yes, Handle is the window's handle. But if you're using .NET, you can just set TopMost to True and avoid importing Win32 functions.

How To Ask Questions The Smart Way



#1
February 21, 2012 at 10:44:57
Depends on the VB. If it's not VBScript, you can import and use SetWindowPos().

How To Ask Questions The Smart Way


Report •

#2
February 23, 2012 at 09:39:55
VB6 though I do use Excel 2003 as a workhorse as well.
I will go and digest the link for SetWinPos().

Thanx


Report •

#3
March 10, 2012 at 06:13:10
I just installed Visual Basic 2010 and used an API call to:

Declare Function SetWindowPos Lib "user32" _

The only problem is that while it worked well in VB6 I can't find how to get hwnd

Most attempts refused to accept the hwnd parameter

eg- Me.hwnd says:

'hwnd' is not a member of 'WindowsApplication1.addevent'.

addevent being the name/text of the form.

Any Ideas?


Report •

Related Solutions

#4
March 10, 2012 at 06:24:16
I can find Handle as a parameter is this it?
but the help system is useless 35,000 answers might as well be no answer

Report •

#5
March 10, 2012 at 06:47:41
✔ Best Answer
Yes, Handle is the window's handle. But if you're using .NET, you can just set TopMost to True and avoid importing Win32 functions.

How To Ask Questions The Smart Way


Report •

#6
March 13, 2012 at 09:52:03
thanx
It makes it a lot easier because the importing require another layer of permissions/declarations which I haven't got the energy to inspect.
I go look..............

Report •

#7
March 13, 2012 at 10:01:24
Oh - the problem with Handle is that it is deprecated so if I can avoid it so much the better.

I usually look in the properties of an object for likely candidates and there is an IntHandle (or something close) bears the same number.

by the lok of it, VB is being migrated to look like C# and C++. I do hope the language does not become as hard to handle. But it is looking that way.


Report •

#8
March 13, 2012 at 10:54:31
Is it? None of the documentation I saw notes Handle as depreciated, and the complier doesn't throw a depreciated warning. I know they hide the property because MS wants you to stay inside .NET, but they don't try too hard to keep you in.

That said, there is no applicable difference between VB.NET and C#. Both languages have similar features and compile down to the same bytecode.

How To Ask Questions The Smart Way


Report •

#9
March 31, 2012 at 03:04:42
The project has to change focus because I use a webpage referencing a time display via an IFRAME.
while I can see the text of the time display on this machine (the one running VB 2010) the compiled program is blocked from accessing HTML from cross domain HTML. It is what I would expect. I was just surprised to see it on this machine.

So the questions now have to be ideas/links for:
1) How to set the Z-order of a (in this case) an IE window to topmost
2) hide the calling program from the tsk bar. I can do it to IE by setting "Hide" to true.

TIA


Report •

#10
March 31, 2012 at 06:46:29
If you're running the calling program, and said program is .NET:
1) Import and use SetWindowPos().
2) Set ShowInTaskbar to False.

How To Ask Questions The Smart Way


Report •

Ask Question