Program behaves differently when run from C:\Program Files vs outside of that folder? - winapi

Have a strange issue using Win10 x64 Pro. My program main window hides itself, opens another window for an action, then closes that and the main window shows itself again and set as the foreground Window. All that works fine, but when the program is run from C:\Program Files the behavior of Windows is not as expected.
If I click on a window of a different process that is behind the main window, it gets the focus but is still visually behind my programs main window. I can click on another window then things start working as expected. I can also just click back on my main window then the one in the background and works (but only if I first click on the background window then my main window then the background window again). However, if I move the same .exe to say d:\test and run it, the problem doesn't occur (I can click on the background window and it shows over the top of my main window like expected).
I tried disabling norton auto-protect, it didn't make any difference.
What could this be, is there some trick I could use get Windows to give the expected results?
Thanks.

Related

After FlashWindow, click the window and the taskbar remains highlight (orange)

When I click the application shortcut, if the program is already open, I will show the program and enable FlashWindow. (FlashWindow(true);)
After blinking once, the taskbar is highlighted.
Theoretically, clicking on the application window would unhighlight the taskbar.
But it doesn't.
There is no problem when the window is minimized.
But it doesn't work when the window is already displayed.
I tried to get all the window handles of the application based on the process id and activated them one by one, but that didn't work either.
For this step I printed the log and used GetForegroundWindow to confirm that the change did happen.
How to solve this problem?
Is there any other way to make the taskbar blink only once without keeping it highlighted?

ollydbg - how to keep debugged program window open

Any way to keep debugged program window open while stepping the code in ollydbg? The program displays buttons in a loop in a dialog box. But its window stays minimized so I can't observe what effect each command has on visual display.
source: https://legend.octopuslabs.io/sample-page.html (tutorial 16A)
Since you are debugging this program, the program will be "stuck" before GUI components initialized and enter the main loop of GUI thread. You can just keep all window away of "hovering" the program's window, for example don't maximize your OllyDbg window.

How can I specify on which monitor the console window is opened?

I've currently connected two monitors via a dock to my notebook.
When I'm running my console application, the console window always pops up on the first monitor. How can I change that it's automatically opened on another monitor, e.g. on monitor 3? Maybe there is a property I need to modify?
It's very annoying to always drag the console window onto the monitor on which my IDE is opened.
Console applications (unlike GUI applications) don't create their own window; that's done by Windows, and in the case when you're running in an already created console, then you kinda inherit, e.g., cmd's window.
What you can do, though, is to find your window and move it to a different monitor.
Another option is to change the window manager settings for that application in the properties of the console window under Layout. Especially the check box »Let system position window«. To do so, first move the window where you'd like it to appear, then open the properties, go to the Layout tab, and just click »OK«.

How to keep a floating window from staying in front of screen

So I'm using double monitors to code in Visual Studio 2012, and I've been putting files on both windows.
So there will be the main window, where I have my Tools and Toolbars, and on my secondary monitor I have a floating window with only a view of some other files in my solution.
Whenever I click on my main window, it will force my floating window to the front of the screen.
This is a hassle if I am trying do research and apply it to my main window, if I try to click on my main window to make changes, it will force my floating window on my secondary monitor to come to the front and block out whatever page I was researching
Is there a setting I can change in visual studio to keep the floating window from coming to the front whenever I click on my main window?
Thanks!
Not possible as far as I found :(

Program window not viewable during debug pause

When my program is paused in Visual Studios 2010 during debugging, like from reaching a break point and me doing a manual step through, the program window becomes impossible to view.
It is a GUI window not a console window, which I run simultaneously with my program and am still able to view. The window seems to be open it's just that when I click its icon on the taskbar it doesn't come to the front of all the other windows. When I minimize all the windows in front of it, I see the outline of the window but it is either blacked out or showing the remnants of previously expanded windows.
I've noticed this with using Visual Studio's before (various versions of it), and after trying other IDE's that didn't have this behavior I notice it more. It would be really helpful to view the program's change's as I step through the program. Anyone know how I can do this?
I searched a long while and couldn't find a single reference to this matter.
The reason the window doesn't display is that the window paint message won't be processed if the main thread has been paused. Which other IDEs let you do this? I haven't come across any native code debuggers that do this on Windows.
If you are stepping through code that is run by the main thread, then the main thread can't simultaniously poll the message pump, which is needed for the GUI to work.
If you debug a different thread, the GUI will work while you are debugging.

Resources