Results 1 to 5 of 5

Thread: new program idea... having problems

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 1999
    Location
    Westfield, IN, USA
    Posts
    59
    ok, my cousin wants me to make him a program. It will run in the system tray. When he double-clicks it, it opens up and asks for a password. When he types in the correct password, it makes a folder (for example, c:\hidden) visible, but then when he double-clicks the icon again, it hides it, so that it's hidden in Explorer, except when "Show All Files" is selected.

    I haven't been able to figure out much about system trays, nor about changing folder options...

  2. #2
    Fanatic Member faisalkm's Avatar
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    752

    I hope it works

    Hi,

    You can use the Shell_NotifyIcon API and the Filesystem object to do ur task. I'm not telling u the whole code. Just research on this and try to find out by urself. If u have any doubt please ask me


    Faisal

    Faisal Muhammed
    Homepage:I Started making it in 1994 ...Still Under Construction
    Using

    Visual Basic 6.0 Enterprise SP5
    Embedded Visual Basic 3.0
    SQL Server 2000
    Windows 2000 Proff
    Delphi 6.0


    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.

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 1999
    Location
    Westfield, IN, USA
    Posts
    59
    the filesystem object:
    objects are like, command buttons, labels, and everything, correct? do i need a component for the filesystem one?

    i'm not at my workstation with vb on it, so i can't check this minute... but i will when i get home

  4. #4
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    hey mandrako...

    This will get you started:

    To get it in the tray:
    Code:
    'got it here from Vbworld
    
    'MODULE
    Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias _
    "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As _
    NOTIFYICONDATA) As Long
    
    Public 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
    
    Public Const NIM_ADD = &H0
    Public Const NIM_MODIFY = &H1
    Public Const NIM_DELETE = &H2
    Public Const NIF_MESSAGE = &H1
    Public Const NIF_ICON = &H2
    Public Const NIF_TIP = &H4
    
    'Make your own constant, e.g.:
    Public Const NIF_DOALL = NIF_MESSAGE Or NIF_ICON Or NIF_TIP
    
    Public Const WM_MOUSEMOVE = &H200
    Public Const WM_LBUTTONDBLCLK = &H203
    Public Const WM_LBUTTONDOWN = &H201
    Public Const WM_RBUTTONDOWN = &H204
    
    'FORM CODE
    Public Sub CreateIcon()
    Dim Tic As NOTIFYICONDATA
    Tic.cbSize = Len(Tic)
    Tic.hwnd = Picture1.hwnd
    Tic.uID = 1&
    Tic.uFlags = NIF_DOALL
    Tic.uCallbackMessage = WM_MOUSEMOVE
    Tic.hIcon = Picture1.Picture
    Tic.szTip = "Visual Basic Demo Project" & Chr$(0)
    erg = Shell_NotifyIcon(NIM_ADD, Tic)
    End Sub
    
    Public Sub DeleteIcon()
    Dim Tic As NOTIFYICONDATA
    Tic.cbSize = Len(Tic)
    Tic.hwnd = Picture1.hwnd
    Tic.uID = 1&
    erg = Shell_NotifyIcon(NIM_DELETE, Tic)
    End Sub
    
    'To to Click event of Command1, add the following code:
    CreateIcon
    
    'To the Click event of Command2, add the following code:
    DeleteIcon
    
    'To the MouseMove event of Picture1, add the following code:
    
    X = X / Screen.TwipsPerPixelXSelect Case X
    Case WM_LBUTTONDOWN
    Caption = "Left Click"
    Case WM_RBUTTONDOWN
    Caption = "Right Click"
    Case WM_MOUSEMOVE
    Caption = "Move"
    Case WM_LBUTTONDBLCLK
    Caption = "Double Click"
    End Select
    To set it to hidden/normal

    Code:
    SetAttr FILE, vbHidden 'hidden
    SetAttr FILE, vbNormal 'back to normal
    Say hi to your cousin!
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  5. #5
    Fanatic Member faisalkm's Avatar
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    752

    Hi mandrako

    U can use the Microsoft Scripting runtime to play with files
    Faisal Muhammed
    Homepage:I Started making it in 1994 ...Still Under Construction
    Using

    Visual Basic 6.0 Enterprise SP5
    Embedded Visual Basic 3.0
    SQL Server 2000
    Windows 2000 Proff
    Delphi 6.0


    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width