Results 1 to 3 of 3

Thread: Form SetFocus

  1. #1
    Join Date
    Oct 2003
    Posts
    357

    Unanswered: Form SetFocus

    Hai,
    I am developing a VB Application. I want to make it visible and invisible according to the records in the table. I use MS Access2000. I use a table which has the field Signature which is of type OLE Object which I use it to store images. I load that image in the inkdata control and do screen capture and update the status of that record as captured. I am doing this in a timer event. My idea is that if there is no record to be captured the application should be invisible and if new record is added then it should become visible and capture the image and become invisible. This works well. But the problem is that after becoming invisible,the focus is not in the application if the application becomes visible. I have to click the application icon in the status bar to make it focus. Is there a way to make it focussed?

    Thanks for any helps
    Madhivanan

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    You must use an API call. Here is a code example:

    Code:
    Private Const SWP_SHOWWINDOW = &H40
    
    Private Declare Function _
            FindWindow Lib "user32" Alias "FindWindowA" _
            (ByVal lpClassName As String, _
            ByVal lpWindowName As String) As Long
    
    Private Declare Function _
            ShowWindow Lib "user32" _
            (ByVal hwnd As Long, _
            ByVal nCmdShow As Long) As Long
    
    Private sub LooseFocus()
        AppHandle As Long
    
        AppHandle= FindWindow(vbNullString, "Calculator")
        ShowWindow AppHandle, SW_SHOWNORMAL
    End Sub
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

  3. #3
    Join Date
    Oct 2003
    Posts
    357
    Thanks for your reply. When I am working with other applications the VB application window is not in focus. Still I have a problem.

    Madhivanan

Posting Permissions

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