Results 1 to 6 of 6

Thread: How to block the computer during a save??

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2006
    Posts
    292

    How to block the computer during a save??

    Hi everyone!

    How can i make the computer to block while the user is doing a save to the application i'm building?

    I mean the user cant do anything else in the computer while the my application is making save, the applicattion cant loose the focus.

    Thanks.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,422

    Re: How to block the computer during a save??

    try this:

    vb Code:
    1. Public Class Form1
    2.  
    3.     Declare Function apiBlockInput Lib "user32" Alias "BlockInput" (ByVal fBlock As Integer) As Integer
    4.  
    5.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    6.         apiBlockInput(1) 'block input
    7.         'do your save
    8.         apiBlockInput(0) 'unblock input
    9.     End Sub
    10.  
    11. End Class

  3. #3
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: How to block the computer during a save??

    Please explain why your application cannot lose focus while saving? This is a little unusual.

  4. #4
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: How to block the computer during a save??

    Quote Originally Posted by em07189 View Post
    Hi everyone!

    How can i make the computer to block while the user is doing a save to the application i'm building?

    I mean the user cant do anything else in the computer while the my application is making save, the applicattion cant loose the focus.

    Thanks.
    That sounds like a really poorly designed save routine. If there's a lot of processing that cant be optimized better, you could at least do it in a background thread.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  5. #5
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: How to block the computer during a save??

    If you do block the computer during save, then you had better not allow that save to fail poorly.
    My usual boring signature: Nothing

  6. #6
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: How to block the computer during a save??

    Lol 'On Error Continue'.

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