Results 1 to 6 of 6

Thread: Set Focus To Another Window using vb6 on windows 7

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Posts
    340

    Question Set Focus To Another Window using vb6 on windows 7

    hi, Greetings all of the member of this forum.

    i am stuck..

    i tried to set focus and activate another window by window handle.., it's work on XP (SetforegroundAPI) while my app not on forground (call api using timer)

    but on windows7 it is not working.. it's just flash the taskbar icon but not set the focus to the window and don't activate it..

    i tried :
    SetForeGraound Api
    BrintToTop Api
    setFocus API
    even with AppActivate Command (with process id)

    but none of these work. just flash the taskbar window?

    any one know how to bypass/fix this?

    best regards
    kamrul hassan

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Set Focus To Another Window using vb6 on windows 7

    Suggest looking at the MSDN documentation. It might describe why you're having the problem
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Set Focus To Another Window using vb6 on windows 7


  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Posts
    340

    Question Re: Set Focus To Another Window using vb6 on windows 7

    please checkout the attached file it may help you out.. to solve this..
    Attached Files Attached Files

  5. #5
    New Member
    Join Date
    Feb 2012
    Posts
    5

    Re: Set Focus To Another Window using vb6 on windows 7

    I had a very similar problem when calling Microsoft Word from my application. On Windows 7 it would start but stay on the task bar. The user would have to either Alt Tab or Click on the task bar for the window to come forward.

    I solved my problem by using the following API

    CoAllowSetForegroundWindow

    Hope this helps.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Posts
    340

    Re: Set Focus To Another Window using vb6 on windows 7

    ok here is the details what i need :

    i am working on a project, where my client ask to lock his user to a fixed program (for example notepad/ms word).. for a certain, user are not allow to use others program while he is in that time frame. so, i use a timer to check the time and if it is in time frame and user not using the same software he is allowed to, i tried to set focus back to that software. but it works on xp, while not on windows 7?

    please anyone help me out?

    best regards

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