|
-
Oct 26th, 2006, 01:00 PM
#1
Sys Tray security app?
I have a security app on this computer that keeps people out of my personal files. However, at this time, it's a standard .exe sitting in one of the folders, nothing difficult to find.
What I'm looking for is a program that launches from the Windows startup, and maintains itself active in the system tray so I know it's running, but registers keystrokes that the user makes. That way, if I enter a certain key set, then the program will kick up the password screen. I can run everything after that no problem.
the problem is with the system tray, startup, and keystrokes... Is there any way to accomplish all of this with vb6?
-
Oct 26th, 2006, 01:07 PM
#2
Re: Sys Tray security app?
Why not use the password feature of the desktop? Just activate the screensaver when you've got to go.
-
Oct 26th, 2006, 01:08 PM
#3
Re: Sys Tray security app?
This computer is one of the fastest in the house, so I let everyone use it... otherwise I wouldn't have a problem. My account does have a password on it. I'm not that dumb...
-
Oct 26th, 2006, 01:23 PM
#4
Re: Sys Tray security app?
Are you using Windows XP?
If so the easy solution is to create another user (which everyone else will use), then "Fast user switching" will do the job.. on the Start menu click on "Log off", then "Switch User".
They can then log in as the other user, but not as 'you' unless they know the password. That way they can't see your files, and your desktop will stay as it was (along with any open programs).
-
Oct 26th, 2006, 01:26 PM
#5
Re: Sys Tray security app?
I have that too, but the guest file can't download to the right directories. That's mostly what other people use it for... downloading stuff that I put on iPods and Cd's and the like... otherwise I'd just use that method.
Either way, it'd be a good experience and a good way to expand my knowledge of VB.
-
Oct 26th, 2006, 01:31 PM
#6
Re: Sys Tray security app?
Fair enough.. but I'll just point out that you could give the other user permission to the directories, and put shortcuts on their desktop.
-
Oct 26th, 2006, 01:36 PM
#7
Re: Sys Tray security app?
Noted.
So, with a project like this, where should I start? I've modified the end routine (when I hit a certain keystroke) to work a little more sleekly, but what should the first target be? I'm thinking working backwards, since testing the whole program would require restarting Windows. Should the System Tray be first? If so, how? I've never even thought about venturing here before... I'm planning on having fun and learning.
-
Oct 26th, 2006, 01:45 PM
#8
Re: Sys Tray security app?
Well the way I see it there's a few things that would be useful...
First off would be HotKeys (example code) to get the key-strokes you want, no matter which program has the focus.
The system tray is fairly easy, and can be seen here.
-
Oct 26th, 2006, 02:44 PM
#9
Re: Sys Tray security app?
Ok, now that I have some code... Is there any chance you could catch me on MSN or AIM and help me pick this stuff apart? Some of it looks kinda confusing...
-
Oct 26th, 2006, 02:58 PM
#10
Re: Sys Tray security app?
I have the system tray code incorporated successfully, with just minor problems...
First, I need to know how to call up a subroutine when I double click (debugging purposes), that involves the form itself, and two...
I think I'm going to have to set Form.Visible to False to keep the application hidden until the keystroke is entered, but will the previously mentioned subroutine be able to launch while invisible?
-
Oct 26th, 2006, 03:44 PM
#11
Re: Sys Tray security app?
I didn't notice that the systray code I linked to was missing the interaction part, see this thread for another example which includes that side of things.
The hotkey should work no matter whether the form is visible or not.
 Originally Posted by timeshifter
Ok, now that I have some code... Is there any chance you could catch me on MSN or AIM and help me pick this stuff apart? Some of it looks kinda confusing...
I'm afraid I dont use any kind of messenger, only the forums.
-
Oct 26th, 2006, 03:48 PM
#12
Re: Sys Tray security app?
OK... I've got the SysTray part working the way it should... and the hotkey works, but only until focus is diverted to something... seems to be a problem...
-
Oct 26th, 2006, 03:57 PM
#13
Re: Sys Tray security app?
I just read the documentation and it looked like the window does actually need to be visible, but a quick test showed it is not the case - changing "WindowState = vbMinimized" to "Me.Visible = Not (Me.Visible)" worked fine.
I think we'll need to see your code.
-
Oct 26th, 2006, 04:01 PM
#14
Re: Sys Tray security app?
I can do that... Single form with one text box (Text1) and one command box (Command1):
VB Code:
'Hotkey Credits:
'KPD-Team 2000
'URL: [url]http://www.allapi.net/[/url]
Option Explicit
'//////Start Sys Tray Info\\\\\\
Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Long
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
Private Const NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2
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_RBUTTONUP = &H205
Dim NID As NOTIFYICONDATA
'\\\\\\End Sys Tray Info//////
'//////Start Hotkey Info\\\\\\
Private Declare Function RegisterHotKey Lib "user32" (ByVal hWnd As Long, ByVal id As Long, ByVal fsmodifiers As Long, ByVal vk As Long) As Long
Private Declare Function UnregisterHotKey Lib "user32" (ByVal hWnd As Long, ByVal id As Long) As Long
Private Declare Function PeekMessage Lib "user32" Alias "PeekMessageA" (lpMsg As Msg, ByVal hWnd As Long, ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long, ByVal wRemoveMsg As Long) As Long
Private Declare Function WaitMessage Lib "user32" () As Long
Private Const MOD_ALT = &H1
Private Const MOD_CONTROL = &H2
Private Const MOD_SHIFT = &H4
Private Const PM_REMOVE = &H1
Private Const WM_HOTKEY = &H312
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type Msg
hWnd As Long
Message As Long
wParam As Long
lParam As Long
time As Long
pt As POINTAPI
End Type
Private bCancel As Boolean
'\\\\\\End Hotkey Info//////
Private Sub Form_Load()
'///System Tray\\\
With NID
.cbSize = Len(NID)
.hIcon = Me.Icon
.hWnd = Me.hWnd
.szTip = "Crazy Dave's Security Suite" & vbNullChar
.ucallbackMessage = WM_LBUTTONDBLCLK
.uFlags = NIF_MESSAGE Or NIF_ICON Or NIF_TIP
.uId = 1&
End With 'Set the data
Shell_NotifyIcon NIM_ADD, NID 'Add the Icon
'\\\System Tray///
'///Hotkeys\\\
Dim ret As Long
bCancel = False
ret = RegisterHotKey(Me.hWnd, &HBFFF&, MOD_CONTROL, vbKeyT) 'register the Ctrl-T hotkey
ProcessMessages 'process the Hotkey messages
'\\\Hotkeys///
Me.Visible = False
Me.WindowState = vbMinimized
End Sub
Private Sub ProcessMessages()
Dim Message As Msg
Do While Not bCancel 'loop until bCancel is set to True
WaitMessage 'wait for a message
If PeekMessage(Message, Me.hWnd, WM_HOTKEY, WM_HOTKEY, PM_REMOVE) Then 'check if it's a HOTKEY-message
Visible = True
WindowState = vbNormal
End If 'any needed tasks upon detection of the hotkey
DoEvents 'let the operating system process other events
Loop
End Sub
Private Sub Form_Unload(Cancel As Integer)
bCancel = True
Call UnregisterHotKey(Me.hWnd, &HBFFF&) 'unregister hotkey
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Command1_Click
End Sub
Private Sub Command1_Click()
If Text1.Text = "youdonotneedmypassword" Then
Shell "explorer.exe myFolder", vbNormalFocus
Me.Visible = False
End If
Text1.Text = ""
End Sub
Last edited by timeshifter; Oct 29th, 2006 at 08:55 PM.
-
Oct 26th, 2006, 04:28 PM
#15
Re: Sys Tray security app?
Never mind about the problems... must have just been one of those wierd things that causes something not to work. Seems to work great now.
That leaves just one problem: activating on startup. Any great ideas?
-
Oct 26th, 2006, 05:22 PM
#16
Re: Sys Tray security app?
It seems the barrage of phone calls I recieved came at the right time, I would have been hunting for a cause & solution otherwise! 
As it is just for your PC, the easiest way is to go into the registry, and add a new entry here:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
..you should be able to work out what kind of thing needs to be entered based on what is there already.
-
Oct 26th, 2006, 05:57 PM
#17
Re: Sys Tray security app?
I feel like a real noob with this question, but I've never dealt with registries before...
-
Oct 26th, 2006, 06:48 PM
#18
Re: Sys Tray security app?
No problem, we've all had to learn at some point!
Open up the Start menu, and select Run; then type in "Regedit" (without quotes), and press enter. RegEdit will then open, and you will notice it looks like Windows Explorer - just navigate to the location I mentioned above in the usual way.
On the right hand side you will then see several entries, and you are just going to add one more - to do this Right-click in the right hand pane, and select "New" -> "String Value". The name doesn't really matter that much (preferably something that makes sense to you!), just set the value to the full path & filename of your executable.
-
Oct 27th, 2006, 01:11 AM
#19
PowerPoster
Re: Sys Tray security app?
-
Oct 27th, 2006, 02:08 AM
#20
Addicted Member
Re: Sys Tray security app?
http://sf.greyfyre.info/forums/index...opic,13.0.html
Is this the kind of thing you are looking for? if so i can help you out a lot with a project like this. (if you need anymore). all this one needs is a run @ start up
EDIT: i know it is a bit late, but this has almost everything you want
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
|