Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 14th, 2006, 7:41 PM   #1
n0x
Newbie
 
n0x's Avatar
 
Join Date: Jan 2006
Posts: 1
Rep Power: 0 n0x is on a distinguished road
Giving Focus To Another Window

I want to write a simple program that would allow me to make IE STAYONTOP with a push of a button, and make it not STAYONTOP with the push of another button. I want to write it in Visual Basic since I know that language a little bit. I
don't want it to be integrated with IE or anything. Is there code that would allow me to make a program like "IEXPLORE.EXE" stay on top? I know there is code in basic that can make the program you are making stay on top but can it make another program stay on top??
n0x is offline   Reply With Quote
Old Jan 15th, 2006, 2:07 PM   #2
TwiliperTech
Newbie
 
TwiliperTech's Avatar
 
Join Date: Jan 2006
Posts: 1
Rep Power: 0 TwiliperTech is on a distinguished road
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Const FRMNOMOVE = 2
Private Const FRMNOSIZE = 1
Private Const BOTH = FRMNOMOVE Or FRMNOSIZE
Private Const WNDTOPMOST = -1
Private Const WNDNOTOPMOST = -2

Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crey As Byte, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long

Private Sub Command1_Click()
Dim ans As Long
Dim LhWnd As Long

LhWnd = FindWindow("IEFrame", vbNullString)
ans = SetWindowPos(LhWnd, WNDTOPMOST, 0, 0, 0, 0, BOTH)
End Sub

Mark
TwiliperTech is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:53 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC