LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

LabWindows command line constantly stealing focus

Solved!
Go to solution

I used LabWindows to create some communication DLLs, and then some .exe command line tools that use it. I am not a Windows programmer, so I do not understand what causes my program to constantly steal focus while running. For example, I run my command:

 

PPLogGetter.exe -parameters -etc

 

...then while it is spinning and running (silent, no output), I cannot select anything else in Windows. The moment I click on another window, it pops back to the DOS CMD.EXE window.

 

What could I change to stop this from happening? Command line programs I write using GCC directly (Code::Blocks IDE) do not act this way. I expect a simple checkbox somewhere or something?

0 Kudos
Message 1 of 3
(75 Views)
Solution
Accepted by AllenInIowa

Hello,

that's a usual problem. There's 2 functions for that: SetStdioWindowVisibility() or SetStdioWindowOptions(... , BringToFrontWhenModified , ...)

Message 2 of 3
(33 Views)

@gdargaud wrote:

Hello,

that's a usual problem. There's 2 functions for that: SetStdioWindowVisibility() or SetStdioWindowOptions(... , BringToFrontWhenModified , ...)


Thank you! I implemented this in my command line tools today at the start of main() and it did the trick:

int main (int argc, char *argv[])
{
    // int SetStdioPort (int standardInputOutputPort); // HOST_SYSTEM_STDIO   
    // void SetStdioWindowVisibility (int visible);    
    // SetStdioWindowOptions (int maximumNumberOfLines, int bringToFrontWhenModified, int showLineNumbers);
    SetStdioWindowOptions (10000, 0, 0); // Not Used, No, Not Used

    printf ("\n"
            "%s v"_TARGET_PRODUCT_VERSION_" - "__DATE__" "__TIME__"\n\n", argv[0]);

 I left the various calls in comments so whoever touches this code in the future will know where to look.

0 Kudos
Message 3 of 3
(19 Views)