-
April 21st, 2008, 02:29 AM
#1
form hide and unhide the form using rightclick shortcut
Hi all,
I have written a code for sound application.Functionalitywise it works perfectely.But i want to hide a form, that is easy,but i want that form to unhide using a rightclick menu(own custumized menu of application itself).I have tried it for system icon . created rightclick popup menu.it hides form.but how can i unhide that frm once it is hide.
actualy i want rigth click menu item that unhide the form..is there any idea pls.?
-
April 21st, 2008, 03:35 AM
#2
Re: form hide and unhide the form using rightclick shortcut
Can you show us your code for system tray icon? Cheers... It should be easy.
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
0100 1101 0110 1001 0110 0011 0110 1000 0110 0001 0110 0101 0110 1100 0010 0000 0100 0101 0110 1100 0110 1100 0110 0101 0111 0010
-
April 21st, 2008, 03:36 AM
#3
Re: form hide and unhide the form using rightclick shortcut
-
April 22nd, 2008, 11:13 AM
#4
Re: form hide and unhide the form using rightclick shortcut
it is not the case.once form is hide form.show will not work except we use any rightclick popuup menu or any desktop shortcut. So i want shortcut or rightclick menu only.
-
April 22nd, 2008, 12:45 PM
#5
Re: form hide and unhide the form using rightclick shortcut
Try this:
Code:
Option Explicit
'User-defined variable to pass to the Shell_NotiyIcon function
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
'Constants for the Shell_NotifyIcon function
Private Const NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2
Private Const WM_MOUSEMOVE = &H200
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4
Private Const WM_LBUTTONDBLCLK = &H203
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
Private Const WM_RBUTTONDBLCLK = &H206
Private Const WM_RBUTTONDOWN = &H204
Private Const WM_RBUTTONUP = &H205
'Declare the API function call
Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" _
(ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
Dim nid As NOTIFYICONDATA
Public Sub AddIcon(ByVal ToolTip As String)
On Error GoTo ErrorHandler
'Add icon to system tray
With nid
.cbSize = Len(nid)
.hWnd = Me.hWnd
.uId = vbNull
.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
.uCallBackMessage = WM_MOUSEMOVE
.hIcon = Me.Icon
.szTip = ToolTip & vbNullChar
End With
Call Shell_NotifyIcon(NIM_ADD, nid)
Exit Sub
ErrorHandler: 'Display error message
Screen.MousePointer = vbDefault
MsgBox Err.Description, vbInformation, App.ProductName & " - " & Me.Caption
End Sub
Private Sub Form_Load()
Call AddIcon("This would be a tooltip...")
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim msg As Long
On Error GoTo ErrorHandler
'Respond to user interaction
msg = X / Screen.TwipsPerPixelX
Select Case msg
Case WM_LBUTTONDBLCLK
'nothing
Case WM_LBUTTONDOWN
'nothing
Case WM_LBUTTONUP
If Me.WindowState = vbMinimized Then
Me.WindowState = vbNormal
Me.Show
Else
Me.WindowState = vbMinimized
Me.Hide
End If
Case WM_RBUTTONDBLCLK
'nothing
Case WM_RBUTTONDOWN
'nothing
Case WM_RBUTTONUP
Call PopupMenu(mnuFile, vbPopupMenuRightAlign)
End Select
Exit Sub
ErrorHandler: 'Display error message
Screen.MousePointer = vbDefault
MsgBox Err.Description, vbInformation, App.ProductName & " - " & Me.Caption
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
'Remove icon from system tray
Call Shell_NotifyIcon(NIM_DELETE, nid)
End Sub
Private Sub mnuFileArray_Click(Index As Integer)
Select Case Index
Case 0 'Option 1
MsgBox "You've clicked on option1 - good for you!", _
vbInformation, App.ProductName & Me.Caption
Case 1 'Option 2
MsgBox "You've clicked on option2 - great!", _
vbInformation, App.ProductName & Me.Caption
Case 4 'Option 1
Unload Me
End
End Select
End Sub
-
April 23rd, 2008, 10:08 AM
#6
Re: form hide and unhide the form using rightclick shortcut
tx for the code,
actualy i had already a code of such type, in which we can hide a form.but in above code a icon will remain displayed in systray in right bottom corner of taskbar.I want to hide everythig i.e form and/or systray icon.in simple word i want a code just like ,as we press 'ctrl+alt+del' to display a "windows task manager".
Last edited by mynick; April 23rd, 2008 at 10:12 AM.
-
April 23rd, 2008, 09:47 PM
#7
Re: form hide and unhide the form using rightclick shortcut
That would be a system service. Why would you want to hide your form from the user? And don't say it's some kind of security. We get those about 6 time per semester...
-
April 24th, 2008, 10:34 AM
#8
Re: form hide and unhide the form using rightclick shortcut
I want to run an application in stealth mode.
in other words ,if any idea through which we can use a keybord key combination to invoke an application or process which is already runing behind..
-
April 24th, 2008, 03:34 PM
#9
Re: form hide and unhide the form using rightclick shortcut
What is stealth mode? I want to know what's running on my computer. It sounds like you want to do something that the user would want to do. Again, I ask, what are you doing?
-
April 25th, 2008, 11:52 PM
#10
Re: form hide and unhide the form using rightclick shortcut
i just want a code(keyboard shortcut )by which i can display(or unhide) a form(application), just like in case "ctrl+alt+del" to show "task manager"
-
April 30th, 2008, 03:15 AM
#11
Re: form hide and unhide the form using rightclick shortcut
my nick, u can hide forms when having two forms at a a time. hiding forms, simply code:
Private_Sub Form1_Click()
form1.hide
form2.show
otherwise
Private Sub Form1_Click()
form1.hide
form2.show
or you can place a button in your form named "Back"
Private Sub Command1_Click()
form1.hide
^_^
dont make it complicated
make it simple...
-
April 30th, 2008, 03:19 AM
#12
Re: form hide and unhide the form using rightclick shortcut
Mynick, if you want a fastkey terminator try this
if u have a cmdbutton
You should name it for example "&Procede" or "_Procede" or "*Procede"
just try one of these and after running the program you press "ALT P" to terminate try it
-
April 30th, 2008, 03:23 AM
#13
Re: form hide and unhide the form using rightclick shortcut
For the programming Master:
Can you please tell me how to make a WEBSITE using VB 6.0??
Whats the difference between an open source and not open source prog'mng language???
-
April 30th, 2008, 10:07 AM
#14
Re: form hide and unhide the form using rightclick shortcut
mynick, I get the impression that you are looking for a global mouse hook, I'm almost 100% convinced that that is the case.
If that's the case, it is absolutely ridiculous to have total control over the user's mouse - think about all the other applications on the system, that still need to function as they are intended to.
Rather concider a global keyboard hook instead.
-
May 6th, 2008, 07:26 AM
#15
Re: form hide and unhide the form using rightclick shortcut
still i could not get solution.
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
|