|
-
Jun 15th, 2006, 09:58 AM
#1
Thread Starter
Junior Member
show form on top of other prog
Hello Everyone
I have a VB6 program that accepts rtc calls from other PC. I minimize that form in system tray and wheneve a call comes in that form pops us from system tray and shows on the destop. The problem with this is that if I have any window open like for example windows explorer my forms comes behind it. I want to have this form on the top so that user can easily answer incomming call.
Can some pls help me with this.
The followin is the code I use to maximize and minimize form:
Private Sub Minimize_Click()
'Add an icon. This procedure uses the icon specified in
'the Icon property of frmmain. This can be modified as desired.
Dim i As Integer
Dim s As String
Dim nid As NOTIFYICONDATA
s = "RIVA Answer Station"
nid = setNOTIFYICONDATA(frmMain.hwnd, vbNull, NIF_MESSAGE Or NIF_ICON Or NIF_TIP, WM_MOUSEMOVE, frmMain.Icon, s)
i = Shell_NotifyIconA(NIM_ADD, nid)
WindowState = vbMinimized
Visible = False
End Sub
Private Function setNOTIFYICONDATA(hwnd As Long, ID As Long, Flags As Long, CallbackMessage As Long, Icon As Long, Tip As String) As NOTIFYICONDATA
Dim nidTemp As NOTIFYICONDATA
nidTemp.cbSize = Len(nidTemp)
nidTemp.hwnd = hwnd
nidTemp.uID = ID
nidTemp.uFlags = Flags
nidTemp.uCallbackMessage = CallbackMessage
nidTemp.hIcon = Icon
nidTemp.szTip = Tip & Chr$(0)
setNOTIFYICONDATA = nidTemp
End Function
Private Sub maximize()
WindowState = vbNormal
Visible = True
Dim hProcess As Long
GetWindowThreadProcessId hwnd, hProcess
AppActivate hProcess
End Sub
Declarations
' To Minimize app in system tray
Private Type NOTIFYICONDATA
cbSize As Long
hwnd As Long
uID As Long
uFlags As Long
uCallbackMessage As Long
hIcon As Long
szTip As String * 64
End Type
Const NIM_ADD = 0
Const NIM_MODIFY = 1
Const NIM_DELETE = 2
Const NIF_MESSAGE = 1
Const NIF_ICON = 2
Const NIF_TIP = 4
Const WM_MOUSEMOVE = &H200
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Const WM_LBUTTONDBLCLK = &H203
Const WM_RBUTTONDOWN = &H204
Const WM_RBUTTONUP = &H205
Const WM_RBUTTONDBLCLK = &H206
Const WM_MBUTTONDOWN = &H207
Const WM_MBUTTONUP = &H208
Const WM_MBUTTONDBLCLK = &H209
Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Private Declare Function Shell_NotifyIconA Lib "SHELL32" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Integer
' minimize system tray ends here
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|