CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: Process Help

  1. #1
    Join Date
    Apr 2007
    Posts
    68

    Question Process Help

    Hi All

    Looking for a little help..

    I would like to create a process that runs on both a Windows XP and Vista Machines that loads on startup, what this process will do is, on the "F12" keypress it brings up a simple form that a user fills in some details then clicks on send, then it goes back to sleep and waits on the "F12" key being pressed.

    Never created a process before so any help is appreciated.

    Cheers

    Djbell

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Process Help

    That is a keyboard hook, and certain keys are 'owned' by the OS. (Like ctrl-alt-delete)

    It is pretty advanced, and different for Vista than XP.

    It is also something that can be misused, so ask smart questions.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Apr 2007
    Posts
    68

    Re: Process Help

    Hi dglienna

    I get what you are saying and this is not a keylogger if that is what you are trying to say. This is for an inhouse helpdesk application, I just want the user to be able to hit F12 on there keyboard to bring up the form to log a call, just a quicker means than the user havig to open up the application, going up to New Request, trying to make things simpler. On reflection though think a process may not be what I am thinking off, does this sound a better way of doing it? In machine startup the program is loaded and minimized immediatly (Program is hidden from Taskbar, but a icon is put into system tray) Program stays in minimized until the F12 key is encountered then form is restored, user fills in details clicks on send, then program is minimized again to system tray?

    Cheers

    Djbell

  4. #4
    Join Date
    Apr 2007
    Posts
    68

    Re: Process Help

    Hi All

    Ok I am a little further. I now have my form created, I have it minimizing on startup, it hides the Taskbar Icon and I now have a small icon in the System Tray indicating that the program is running. Now I have the following code in the KeyDown Event of my form

    Code:
    Select Case e.KeyCode
               Case Keys.F12
               Me.WindowState = FormWindowState.Normal
    End Select
    This works ok as long as I dont open any other applications, basically the form is still the focus, but obviously it stops working the minute the form loses focus. I have looked at the thread on Low Level Keyboard hooks but this is way above my head. Is there an easier way for my form to detect the F12 key even though it does not have focus?

    Cheers

    Djbell

  5. #5
    Join Date
    May 2004
    Location
    Osijek
    Posts
    61

    Re: Process Help

    You can register a hotkey. I have attached you a sample application (main thing is HelperHotkey class I wrote for one program of mine).

    P.S. You cannot use F12 for hotkey since it is reserved for use by the debugger (NT4 and above).

    If you by process mean windows service, you cannot show from it on Vista and above since services get special desktop (if you allow it to interact with desktop) or no desktop at all.

    I would approach this via small trayed application which runs with user logon.
    Attached Files Attached Files

  6. #6
    Join Date
    Apr 2007
    Posts
    68

    Re: Process Help

    Hi Jmedved

    Thanks for the reply, I will have a look at your sample and see if I can implement it into my project..

    I have another question, same project but another part of it.. I have a tabcontrol with 7 tabsheets. Each tab contains different information for display. Now the user wants the tabpages to change automatically every 30 seconds. The hard part is they want to specify the order in which they will be displayed, so I thought of a form with 7 Comboboxes named CBDisplay1 to CBDisplay7. Each Combobox will contain the name of the tab. Unfortuantly I am not sure how to get my timer to start on CBDisplay1, display the selected tab, then after 30 seconds look at CBDisplay2 and so on, then start back at cbdisplay1 after all other CBDisplay comboboxes have been used.

    Cheers

    Djbell

  7. #7
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Process Help

    Just create a 'clock' of the order, and in your timer, move to the next one
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  8. #8
    Join Date
    May 2004
    Location
    Osijek
    Posts
    61

    Re: Process Help

    Quote Originally Posted by 1druid1 View Post
    I have another question, same project but another part of it.. I have a tabcontrol with 7 tabsheets. Each tab contains different information for display. Now the user wants the tabpages to change automatically every 30 seconds. The hard part is they want to specify the order in which they will be displayed, so I thought of a form with 7 Comboboxes named CBDisplay1 to CBDisplay7. Each Combobox will contain the name of the tab. Unfortuantly I am not sure how to get my timer to start on CBDisplay1, display the selected tab, then after 30 seconds look at CBDisplay2 and so on, then start back at cbdisplay1 after all other CBDisplay comboboxes have been used.
    Just put TabPages in Some List(Of TabPage) in order that you want. Every time timer ticks, just go on list((i + 1) % 7).

    P.S. I am not sure that this is exactly what user wants. Usually user has some internal process in mind and proposes solution which may not be an optimal one. Check what user really wants because this interface is not nice and it will get uglier before it gets better.

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

Featured