Ryan's District
November 22, 2008, 04:05:04 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: You are not allowed to view links.
Register or Login
How to Unlock Nokia mobile Phones

You are not allowed to view links.
Register or Login
Request any TV Show / series / Episodes / movie and we will get it for you for free

 
   Home   Help Search Chat Calendar Chess Shop Login Register  
Digg This!
Pages: [1]   Go Down
  Send this topic  |  Print  
Author Topic: How to Create a Topmost or Floating Window in Visual Basic  (Read 2199 times)
0 Members and 1 Guest are viewing this topic.
ben2ong2
Quality Poster
Paid
Hero Member
*****

Reputation: 17
Offline Offline

Gender: Male
Posts: 2374
9976.80 RD$

View Inventory
Send Money to ben2ong2

View Profile Awards
« on: October 07, 2006, 03:58:14 PM »

PRODUCT :Microsoft Visual Basic for Windows
PROD/VER:1.00 2.00 3.00
OPER/SYS:WINDOWS
KEYWORDS:kbui kbprg kbcode

----------------------------------------------------------------------
The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for
  Windows, versions 2.0 and 3.0
- Microsoft Visual Basic programming system for Windows, version 1.0
----------------------------------------------------------------------

SUMMARY
=======

You can create a "floating" window such as that used for the Microsoft
Windows version 3.1 Clock by using the SetWindowPos Windows API call.

MORE INFORMATION
================

A floating (or Topmost) window is a window that remains constantly
above all other windows, even when it is not active. Examples of
floating windows are the Find dialog box in WRITE.EXE, and CLOCK.EXE
(when Always on Top is selected from the Control menu).

For more information on this topic, please see the following article in the
Microsoft Knowledge Base:

ARTICLE-ID: Q81137
TITLE     : INF: How to Create a Topmost Window

NOTE: Visual Basic forms that are TopMost Windows when they are in either
Normal or Maximized positions will lose the Topmost setting when the Visual
Basic program is Minimized. Visual Basic destroys the old window and
creates a new one with the Icon in the Window. Therefore, in order for
TopMost to stay in effect, the user needs to reset TopMost in the Resize
event.

There are two methods to produce windows that "hover" or "float," one
of which is possible in Visual Basic for Windows. This method is
described below:

Use the following declarations:

Declare Function SetWindowPos Lib "User" (ByVal hWnd As Integer, ByVal
hWndInsertAfter As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal
cx As Integer, ByVal cy As Integer, ByVal wFlags As Integer) As Integer
' The above Declare statement must appear on one line.

Global Const SWP_NOMOVE = 2
Global Const SWP_NOSIZE = 1
Global Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE
Global Const HWND_TOPMOST = -1
Global Const HWND_NOTOPMOST = -2
'Put global constants in bas module.

To set the form XXXX to TOPMOST, use the following code:

success% = SetWindowPos (XXXX.hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)
REM success% <> 0 When Successful

To reset the form XXXX to NON-TOPMOST, use the following code:

success% = SetWindowPos (XXXX.hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, FLAGS)
REM success% <> 0 When Successful

NOTE: This attribute was introduced in Windows, version 3.1, so
remember to make a GetVersion() API call to determine whether the
application is running under Windows, version 3.1.

REFERENCES
==========

"Page 892 of Microsoft Windows 3.1 Programmer's Reference, Volume 2,
 Functions,"

Additional reference words: top most Win31 Float Topmost Notopmost
Setwindowpos
KBCategory: kbui kbprg kbcode
KBSubcategory: APrgWindow

=============================================================================

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS
PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND.  MICROSOFT DISCLAIMS
ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  IN NO
EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR
ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL,
CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF
MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.  SOME STATES DO NOT ALLOW THE EXCLUSION
OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES
SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1996.
Logged

You are not allowed to view links.
Register or Login
Free Paid Survey & Home Business Resources.

You are not allowed to view links.
Register or Login
Free Article Directory | Quality Content
Ryan's District
« on: October 07, 2006, 03:58:14 PM »

 Logged
Pages: [1]   Go Up
  Send this topic  |  Print  
 
Jump to:  

Archive - WAP2 - WAP - imode
Sponsors: RAYAN.tv
-

Powered by MySQL Powered by PHP Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 1.242 seconds with 31 queries.

Google visited last this page Today at 08:20:33 AM