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 4
(336 Views)
Solution
Accepted by topic author AllenInIowa

Hello,

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

Message 2 of 4
(294 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 4
(280 Views)

Since these command line tools are not making use of anything LabWindows-specific, I am planning to migrate them and my DLL to a generic GCC or something. I found that not only was it stealing focus (fixed), but if I had the CMD window resized, it would pop back to default size when the app runs! No idea how to fix that one, but it’s just going to be easier to get away from this compiler I think.

0 Kudos
Message 4 of 4
(27 Views)