This is a bit difficult to explain as it concerns a large project, so I extracted the important parts to try to explain my question.
I have in a "SHDocVw.WebBrowser" control and a button that does the following:
1. navigate to a folder path
2. focus on an specific folder using a subfunction
Part I: is how the "SHDocVw.WebBrowser" is set up
Part II: The code under the button that FIRST navigates to a "folder" then executes a subfunction
Part III: contents of the subfunction
The actual question regards, Part II.
If I use a "wait 2" (wait 2 seconds) then the dialog first waits 2 seconds then navigates to the "folder" and thus I run into an error
subfunction (described at Part III) get's executed to soon.
However if I use the code specified at Part II with just "wait" only, the code works perfect!.
* QUESTION: Is it allowed to use just "wait" below in Part II or do I need to use "opt waitmsg"?
* QUESTION: If the "wait" below in Part II is not correct then how do I use opt waitmsg?
EDIT: If found this to be working, dont't know if it is actually correct (maybe 300 is to much but would result in max 3 seconds)?
rep(300) opt waitmsg 1; 0.01; if(!we1.Busy) break
In the help it states:
PART I , very briefly describes how the 'SHDocVw.WebBrowser' is setup
PART II (button code)
PART III contents of the subfunction
"sub.focus_on" subfunction contains code very similair to (https://www.quickmacros.com/forum/showth...p?tid=6878):
I have in a "SHDocVw.WebBrowser" control and a button that does the following:
1. navigate to a folder path
2. focus on an specific folder using a subfunction
Part I: is how the "SHDocVw.WebBrowser" is set up
Part II: The code under the button that FIRST navigates to a "folder" then executes a subfunction
Part III: contents of the subfunction
The actual question regards, Part II.
If I use a "wait 2" (wait 2 seconds) then the dialog first waits 2 seconds then navigates to the "folder" and thus I run into an error
subfunction (described at Part III) get's executed to soon.
However if I use the code specified at Part II with just "wait" only, the code works perfect!.
* QUESTION: Is it allowed to use just "wait" below in Part II or do I need to use "opt waitmsg"?
* QUESTION: If the "wait" below in Part II is not correct then how do I use opt waitmsg?
EDIT: If found this to be working, dont't know if it is actually correct (maybe 300 is to much but would result in max 3 seconds)?
rep(300) opt waitmsg 1; 0.01; if(!we1.Busy) break
In the help it states:
timeS 0 or omutted: Just process messages that possibly are waiting in thread's message queue, regardless of opt waitmsg.
Note: If the thread has windows/dialogs or uses COM events or some Windows API functions that use Windows messages, you should avoid wait commands in it. Or use small time (<0.1). By default, messages are not processed while waiting, and your thread may temporarily hang. To process messages while waiting, use opt waitmsg.
Note: Don't use Windows API wait functions, because then QM cannot properly end the thread on user request. QM then terminates thread, which causes a big memory leak and possibly more bad things. Also, opt waitmsg is not applied.
PART I , very briefly describes how the 'SHDocVw.WebBrowser' is setup
str dd:
...
3 ActiveX 0x54030000 0x0 5 36 194 190 "SHDocVw.WebBrowser"
...
#sub DlgProc:
...
SHDocVw.WebBrowser- we1
Shell32.ShellFolderView- fv1
Shell32.FolderItem- fi1
we1._getcontrol(id(3 hDlg))
we1._setevents("sub.we1") ;;need DocumentComplete event
...
PART II (button code)
PART III contents of the subfunction
"sub.focus_on" subfunction contains code very similair to (https://www.quickmacros.com/forum/showth...p?tid=6878):