Results 1 to 8 of 8

Thread: Adding (and saving) items to a list at runtime

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Location
    IL, USA
    Posts
    17

    Question

    I am creating a program that will run in the systray and when the user clicks the icon a menu of files will appear.
    When the user selects a file the file will open in it's respective app (like Word or Excel).

    I want to be able to give the user the option to add files to the list so they will be available next time he starts the app.
    I'm betting that this will require some type of data file for the app to read and write to, but I don't have any experience with this...Any suggestions?

    Also, I would like to allow the user to customize the layout of the menu so that he can arrange frequently used files at the bottom and even add spaces between groups of file items ...Any suggestions here?

    Thanks guys and girls!!!

  2. #2
    Hyperactive Member
    Join Date
    Sep 2000
    Posts
    257
    Do u mean u want to make something similar to "Documents" from the start menu?
    if so u could use an ini file to store the names and paths of the files, which would also add the customizability you want(as long as the users know how to edit ini files).


  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Location
    IL, USA
    Posts
    17

    Unhappy

    No, I want the process of adding and moving list items to be as transparent and user friendly as possible. Adding files will be done through user interaction with dialog boxes and customizing appearance and layout through drag and drop.

    Imagine an icon in the systray, when it is right clicked I want a popup menu to provide options like 'Add File', 'Organize File List', 'Launch File(s)', and 'Exit'. When the icon is double clicked, I want a popup menu containing a list of files and sub-groups of multiple files to appear. The user can then select a file or group of files to open.

    This program will do about the same thing as the MS Office shortcut bar but will run from the system tray. The MS shortcut bar uses a folder full of shortcuts and allows the user to customize the name and layout of the shortcuts on the shortcut bar. Does anyone know how to do something like this?

    All help will be very much appreciated.


  4. #4
    Hyperactive Member theman32x's Avatar
    Join Date
    May 2000
    Location
    New Jersey, USA
    Posts
    305
    well i think when u dbl click you should make a form come up with a listbox and the form is resize to the size of the listbox ...

    when u load the form you will input data from a data file to the list box ...

    u should look at sequential files in vb so u learn about inputing n outputing info

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Location
    IL, USA
    Posts
    17

    Unhappy

    A form with only a listbox would be just like a popup menu right? How would you go about sizing the listbox to its contents and then the form to the listbox? Or allow the user to rearrange the list items and/or create file subgroups?

    I'll play around with this and the sequential file stuff.

    Any other input will be gladly accepted...


    Thanks MAN

  6. #6
    Hyperactive Member marnitzg's Avatar
    Join Date
    Oct 2000
    Location
    South Africa
    Posts
    372
    To be honest, I have no idea what this code does. MSDN says:
    The CreateMenu function creates a menu. Play around, see what you get. Someone correct me if this does something else
    Code:
    Public Type MENUITEMINFO
        cbSize As Long
        fMask As Long
        fType As Long
        fState As Long
        wID As Long
        hSubMenu As Long
        hbmpChecked As Long
        hbmpUnchecked As Long
        dwItemData As Long
        dwTypeData As String
        cch As Long
    End Type
    
    Public Declare Function CreateMenu Lib "user32" Alias "CreateMenu" () As Long
    
    Public Declare Function InsertMenuItem Lib "user32" Alias "InsertMenuItemA" (ByVal hMenu As Long, ByVal un As Long, ByVal bool As Boolean, ByRef lpcMenuItemInfo As MENUITEMINFO) As Long
    
    Public Declare Function AppendMenu Lib "user32" Alias "AppendMenuA" (ByVal hMenu As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpNewItem As Any) As Long

  7. #7
    Addicted Member c@lle's Avatar
    Join Date
    Oct 1999
    Location
    Belgium
    Posts
    179
    with following code you can open the associated program (like doubleclicking on the file in the explorer)

    Code:
     'function to start file with associated program
     Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    
     Dim lngResult As Long
     Dim sFile As String
        sFile = "c:\temp\test.xls"
        'this will open excel
        lngResult = ShellExecute(hwnd, "Open", sFile, "", "", vbNormalFocus)

  8. #8

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Location
    IL, USA
    Posts
    17
    Thanks C@lle, That works great and easy!

    Do you, or anyone, know of any good book to check out for explanations of .dll functions?
    Like what each .dll can do for you and how???

    That would be cool!

    Thanks again,

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