Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Jan 2001
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How does one use the SetFocus API in VB? (VB API)

    How does one use the SetFocus API in VB?

    Here is the declare string derived from the API viewer;

    Private Declare Function SetFocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As Long

    When I use this declare string, I get an "object member already exists ina object module from which this object derives" error; I think this is because the function name is the same as a VB command; I have tried changing the alias to other things that might work but still get errors;

    What alias can I use, or is this a "no-deal" API for VB?

    Thanks,

    --Llyal

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: How does one use the SetFocus API in VB? (VB API)

    What are you trying to set the focus to that requires an API call?
    Charlotte

  3. #3
    Star Lounger
    Join Date
    Jan 2001
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How does one use the SetFocus API in VB? (VB API)

    Charlotte,

    I have a form focus problem (the details are in another post I made a few days ago under the title "Weird Form Focus Problems With the Mouse (VB6 SP5 and Windows2K)"); I want to try using the windows focus API to see if this might fix the problem; I have found that using the APIs are straightforward, but I am having problems with this Setfocus API;

    Any help is appreciated,

    --Llyal

  4. #4
    New Lounger
    Join Date
    Mar 2001
    Location
    Chicago, Illinois, USA
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How does one use the SetFocus API in VB? (VB API)

    <P ID="edit" class=small>Edited by Andrew Cronnolly on 09-Nov-01 16:57.</P>Edited to include Hyperlink

    From www.vbapi.com: <A target="_blank" HREF=http://www.vbapi.com/ref/s/setfocus.html>www.vbapi.com</A>

    "Visual Basic-Specific Issues:
    This function behaves exactly like the SetFocus method of many VB controls.
    However, because this function shares its name with this method, it must be
    renamed to something like SetFocusAPI when you use it in a VB program,
    or else the compiler will give you an error. See the example for a demonstration
    of this."

    Hope this helps.
    -RL
    <A target="_blank" HREF=http://www.vbapi.com/ref/s/setfocus.html>www.vbapi.com</A>

  5. #5
    Star Lounger
    Join Date
    Jan 2001
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How does one use the SetFocus API in VB? (VB API)

    RL,

    Thanks for the tip. I have found that both the SetFocus in API and VB exibit weird flickering behavior when used in a specific way with a form. I described the problem in a related post. This problem occurs on the Windows2000 platform- does not occur on WIn98 or WinNT (don't know about other platforms);

    --Llyal

Posting Permissions

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