1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: VB6 Shell command - BACKGROUND

Discussion in 'Software Development' started by Hogskin, Apr 1, 2008.

Thread Status:
Not open for further replies.
Advertisement
  1. Hogskin

    Hogskin Thread Starter

    Joined:
    Apr 1, 2008
    Messages:
    2
    I have an application in VB6 that triggers a .BAT file a couple times a minute using the SHELL command. The function is working fine. But a problem occurs when I am trying to perform other functions on that computer. (Some of my source code development is done on this computer.) When the COMMAND.COM box gets triggered, it wrests control from my other application momentarily, then returns it. This results in very problematic lost keystrokes.

    Is there any way to keep the COMMAND.COM box from gaining foreground control? I have tried changing virtually all of the options on COMMAND.COM in the System32 directory with no success. I am hoping there may be a parameter for the SHELL command that can do this...

    Alternately, if there is a way in XP to direct an application to grab control and not relinquish it to other tasks (without otherwise affecting execution of those other tasks), that would work for me.

    This system is running Windows XP with SP2.

    Thanks.
     
  2. coderitr

    coderitr

    Joined:
    Oct 12, 2003
    Messages:
    3,015
    Use cmd.exe instead of command.com and in your Shell command, specify vbHide as the 2nd parameter. Command.com is a DOS emulator and works differently than cmd.exe which is a command interpreter. The vbHide as the 2nd parameter will keep the command prompt window from appearing.
     
  3. Squashman

    Squashman Trusted Advisor

    Joined:
    Apr 4, 2003
    Messages:
    19,786
    If you have TweakUI installed there is an option in there for keeping applications from Stealing Focus. There is a registry change you can make as well to keep applications from stealing focus. But I am sure the code above will probably solve your issue as well.

    http://www.onecomputerguy.com/windowsxp_tips.htm#focus
     
  4. Hogskin

    Hogskin Thread Starter

    Joined:
    Apr 1, 2008
    Messages:
    2
    Thanks VERY much, coderitr!!! The vbHide took care of it. Apparently the Shell command was already invoking cmd.exe, which I was unaware of. This is terrific after putting up with that aggravation and associated problems for over a year.
     
  5. coderitr

    coderitr

    Joined:
    Oct 12, 2003
    Messages:
    3,015
    You're welcome. You can mark this thread as solved by clicking the red & white triangle.

    Welcome to TSG
     
  6. cybertech

    cybertech Retired Moderator

    Joined:
    Apr 16, 2002
    Messages:
    72,115

    Actually you mark it solved with the Thread Tools at the top of the page. ;)
     
  7. coderitr

    coderitr

    Joined:
    Oct 12, 2003
    Messages:
    3,015
    Oops. Sorry Cy.
     
  8. cybertech

    cybertech Retired Moderator

    Joined:
    Apr 16, 2002
    Messages:
    72,115
    No problem! ;)
     
  9. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/699259

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice