Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cannot make window visible by activation
#1
I am using QM version 2.4.3 on Windows 8.1

QM will not always activate a window and make it visible on the screen.

Even though QM says the window is active (I checked using the command "win") the window is not visible?

(Note I have tried changing the option "Disable foreground lock option" and it does not work and the windows API function IsWindowVisible always report all windows visible even if they are not)

How do I ensure that when a windows is activated using "act" it definitely becomes visible on the screen?

Thank you
#2
Probably it is "cloaked". Or finds another cloaked window with same name.

Macro Macro2526
Code:
Copy      Help
int w=win("Start menu" "ImmersiveLauncher")
act w
int active(win=w) visible(IsWindowVisible(w)) cloaked(IsWindowCloaked(w))
out "active=%i visible=%i cloaked=%i" active visible cloaked
if cloaked
,cloaked=0
,if(DwmSetWindowAttribute(w 13 &cloaked 4)) out _s.dllerror ;;Try to uncloak. Error: Access is denied..
,

If you don't have IsWindowCloaked:

Function IsWindowCloaked
Code:
Copy      Help
function# hwnd

;Returns nonzero if the window is cloaked.
;Returns flags: 0 not cloaked, 1 cloaked by its application, 2 cloaked by Windows, 4 parent window is cloaked.

;REMARKS
;On Windows 8 and later, a window may be cloaked. Then it is invisible, although functions IsWindowVisible and hid say it is visible.
;On Windows 8, cloaked are inactive Windows store app windows. Also some inactive system windows, such as Start screen and Search.
;On Windows 10, cloaked are windows on inactive desktops. Also some system windows.

;Added in: QM 2.4.3.


if(_winver>=0x602 and !DwmGetWindowAttribute(hwnd 14 &_i 4)) ret _i
#3
Thank you.

I will try this and test.
#4
QM 2.4.2.2 does not have function "DwmGetWindowAttribute".
#5
dll- dwmapi #DwmGetWindowAttribute hwnd dwAttribute !*pvAttribute cbAttribute
#6
If I do not have the function DwmSetWindowAttribute what do I use?

is it:

dll- dwmapi #DwmSetWindowAttribute hwnd dwAttribute !*pvAttribute cbAttribute
#7
yes

Macro Macro2514
Code:
Copy      Help
dll- dwmapi
,#DwmGetWindowAttribute hwnd dwAttribute !*pvAttribute cbAttribute
,#DwmSetWindowAttribute hwnd dwAttribute !*pvAttribute cbAttribute
#8
Thank you
#9
I actually created a function from your Macro2526 (see above at top of thread) and it worked ok when called from a macro but not when called from another function?

I guess it cannot be used in this way?
#10
Please show the codes.
#11
It may not have anything to do with the fact that the function I coded was being called by another function rather than a macro but the code does not seem to be able to execute "act w" and I have also seen a pointer error from the line "cloaked=(IsWindowCloaked(w))".

The code worked ok when called from a macro and not a function.

Here is the code for the function "actuncloak"

Macro Macro17
Code:
Copy      Help
/
function str'chart int'&cloaked

int w=win(chart)

out "activating and uncloaking"

;tryagain
0.01
act w
err
,out "cannot activate window in actuncloak"
,goto tryagain
,
if win<>w or win=0
,out "trying to activate window in actuncloak again"
,goto tryagain

cloaked=(IsWindowCloaked(w))
int active(win=w) visible(IsWindowVisible(w))
out "active=%i visible=%i cloaked=%i" active visible cloaked
if cloaked
,cloaked=0
,if(DwmSetWindowAttribute(w 13 &cloaked 4))
,,out _s.dllerror ;;Try to uncloak. Error: Access is denied..
,,ret

ret
#12
How it is called from another function when does not work? Please show code.

Replace the beginning to
Function Function292
Code:
Copy      Help
;/
function str'chart int&cloaked
if(!&cloaked) out "bad argument 'cloaked', must be an int variable"
int w=win(chart)
if(!w) end "window not found"
#13
You made me realise thank you.

When I called the function from a macro I correctly sent the window name parameter as a string e.g. "Quick Marcos" but when I called the function from another function I incorrectly sent the window as an integer e.g. win="Quick Macros"

Problem solved with your help.

Thank you


Forum Jump:


Users browsing this thread: 1 Guest(s)