11-21-2024 09:27 AM
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?
Solved! Go to Solution.
11-26-2024 02:51 AM
Hello,
that's a usual problem. There's 2 functions for that: SetStdioWindowVisibility() or SetStdioWindowOptions(... , BringToFrontWhenModified , ...)
11-26-2024 09:08 AM
@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.