Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Popup window open link
#1
Question 
Hi

I have encountered a problem. In the previous postings, through the help of many enthusiastic friends, I can implement the IE browser control in the dialog box.

However, clicking on a web link from within the browser opens with a browser installed on the system, for example, Google Chrome...

I want to implement the following function Idea

Let the link open from the popup window (do not open it from other browsers installed on the system). In addition, the popup window closes to close. When I close the main window, the popup window closes automatically.

I hope someone can help me with guidance. Thank you very much. Any suggestions and opinions are welcome.

Macro BS
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90CB0AC8 0x0 0 0 448 262 "bs"
;2 Button 0x54030000 0x4 376 236 48 14 "Cancel"
;1 Button 0x54030001 0x4 308 236 48 14 "OK"
;3 ActiveX 0x54030000 0x0 12 8 424 216 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

str controls = "3"
str ax3SHD
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam
SHDocVw.WebBrowser we3
we3._getcontrol(id(3 hDlg))

sel message
,case WM_INITDIALOG
,;SHDocVw.WebBrowser we3
,;we3._getcontrol(id(3 hDlg))
,we3.Navigate("www.google.com")
,DT_SetAutoSizeControls(hDlg "3s 1m 2m")
,max hDlg
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#2
Macro dialog web browser open link in new dialog etc
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90CF0AC8 0x0 0 0 586 262 "bs"
;2 Button 0x54030000 0x4 376 236 48 14 "Cancel"
;1 Button 0x54030001 0x4 308 236 48 14 "OK"
;3 ActiveX 0x54030000 0x0 12 8 344 216 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;4 ActiveX 0x54030000 0x0 364 8 218 216 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040701 "*" "" "" ""

str controls = "3 4"
str ax3SHD ax4SHD
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam
SHDocVw.WebBrowser we3
int- t_mainDlg

sel message
,case WM_INITDIALOG
,t_mainDlg=hDlg
,DT_SetAutoSizeControls(hDlg "3s 4mh 4sv 1m 2m")
,max hDlg
,
,we3._getcontrol(id(3 hDlg))
,we3._setevents("sub.we3")
,
,we3.Navigate("www.google.com")
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1


#sub we3_NewWindow3
function IDispatch&ppDisp @&Cancel dwFlags BSTR'bstrUrlContext BSTR'bstrUrl SHDocVw.IWebBrowser2'we3

;out bstrUrl
;out bstrUrlContext

int- t_mainDlg
sel ListDialog("1 Main control[]2 Another control[]3 New dialog[]4 Web Browser" "Where to open the link?" "" 2 t_mainDlg)
,case 0
,Cancel=1
,
,case 1
,Cancel=1
,we3.Navigate(bstrUrl)
,
,case 2
,SHDocVw.WebBrowser we4._getcontrol(id(4 t_mainDlg))
,ppDisp=we4
,
,case 3
,int hDlg2=sub.Dialog2(t_mainDlg)
,SHDocVw.WebBrowser d2_we3._getcontrol(id(3 hDlg2))
,ppDisp=d2_we3


#sub Dialog2
function# [hwndOwner]

str dd=
;BEGIN DIALOG
;0 "" 0x90CF0AC8 0x0 0 0 344 214 "Dialog2"
;3 ActiveX 0x54030000 0x0 0 0 344 214 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040701 "*" "" "" ""

str controls = "3"
str ax3SHD
ret ShowDialog(dd &sub.DlgProc2 &controls hwndOwner 1) ;;modeless dialog


#sub DlgProc2
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DT_SetAutoSizeControls hDlg "3s"
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

Shift+click a link to test.
#3
(04-20-2018, 08:41 AM)Gintaras Wrote: Macro dialog web browser open link in new dialog etc
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90CF0AC8 0x0 0 0 586 262 "bs"
;2 Button 0x54030000 0x4 376 236 48 14 "Cancel"
;1 Button 0x54030001 0x4 308 236 48 14 "OK"
;3 ActiveX 0x54030000 0x0 12 8 344 216 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;4 ActiveX 0x54030000 0x0 364 8 218 216 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040701 "*" "" "" ""

str controls = "3 4"
str ax3SHD ax4SHD
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam
SHDocVw.WebBrowser we3
int- t_mainDlg

sel message
,case WM_INITDIALOG
,t_mainDlg=hDlg
,DT_SetAutoSizeControls(hDlg "3s 4mh 4sv 1m 2m")
,max hDlg
,
,we3._getcontrol(id(3 hDlg))
,we3._setevents("sub.we3")
,
,we3.Navigate("www.google.com")
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1


#sub we3_NewWindow3
function IDispatch&ppDisp @&Cancel dwFlags BSTR'bstrUrlContext BSTR'bstrUrl SHDocVw.IWebBrowser2'we3

;out bstrUrl
;out bstrUrlContext

int- t_mainDlg
sel ListDialog("1 Main control[]2 Another control[]3 New dialog[]4 Web Browser" "Where to open the link?" "" 2 t_mainDlg)
,case 0
,Cancel=1
,
,case 1
,Cancel=1
,we3.Navigate(bstrUrl)
,
,case 2
,SHDocVw.WebBrowser we4._getcontrol(id(4 t_mainDlg))
,ppDisp=we4
,
,case 3
,int hDlg2=sub.Dialog2(t_mainDlg)
,SHDocVw.WebBrowser d2_we3._getcontrol(id(3 hDlg2))
,ppDisp=d2_we3


#sub Dialog2
function# [hwndOwner]

str dd=
;BEGIN DIALOG
;0 "" 0x90CF0AC8 0x0 0 0 344 214 "Dialog2"
;3 ActiveX 0x54030000 0x0 0 0 344 214 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040701 "*" "" "" ""

str controls = "3"
str ax3SHD
ret ShowDialog(dd &sub.DlgProc2 &controls hwndOwner 1) ;;modeless dialog


#sub DlgProc2
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DT_SetAutoSizeControls hDlg "3s"
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

Shift+click a link to test.

Wow! Tongue QM is too great, less than a hundred lines of code, implementing four functions,

I really need to study hard QM programming

I found in the test, sometimes weird Huh , choose new dialog, will open from the web browser and new dialog at the same time

(04-20-2018, 08:41 AM)Gintaras Wrote: Macro dialog web browser open link in new dialog etc
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90CF0AC8 0x0 0 0 586 262 "bs"
;2 Button 0x54030000 0x4 376 236 48 14 "Cancel"
;1 Button 0x54030001 0x4 308 236 48 14 "OK"
;3 ActiveX 0x54030000 0x0 12 8 344 216 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;4 ActiveX 0x54030000 0x0 364 8 218 216 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040701 "*" "" "" ""

str controls = "3 4"
str ax3SHD ax4SHD
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam
SHDocVw.WebBrowser we3
int- t_mainDlg

sel message
,case WM_INITDIALOG
,t_mainDlg=hDlg
,DT_SetAutoSizeControls(hDlg "3s 4mh 4sv 1m 2m")
,max hDlg
,
,we3._getcontrol(id(3 hDlg))
,we3._setevents("sub.we3")
,
,we3.Navigate("www.google.com")
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1


#sub we3_NewWindow3
function IDispatch&ppDisp @&Cancel dwFlags BSTR'bstrUrlContext BSTR'bstrUrl SHDocVw.IWebBrowser2'we3

;out bstrUrl
;out bstrUrlContext

int- t_mainDlg
sel ListDialog("1 Main control[]2 Another control[]3 New dialog[]4 Web Browser" "Where to open the link?" "" 2 t_mainDlg)
,case 0
,Cancel=1
,
,case 1
,Cancel=1
,we3.Navigate(bstrUrl)
,
,case 2
,SHDocVw.WebBrowser we4._getcontrol(id(4 t_mainDlg))
,ppDisp=we4
,
,case 3
,int hDlg2=sub.Dialog2(t_mainDlg)
,SHDocVw.WebBrowser d2_we3._getcontrol(id(3 hDlg2))
,ppDisp=d2_we3


#sub Dialog2
function# [hwndOwner]

str dd=
;BEGIN DIALOG
;0 "" 0x90CF0AC8 0x0 0 0 344 214 "Dialog2"
;3 ActiveX 0x54030000 0x0 0 0 344 214 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040701 "*" "" "" ""

str controls = "3"
str ax3SHD
ret ShowDialog(dd &sub.DlgProc2 &controls hwndOwner 1) ;;modeless dialog


#sub DlgProc2
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DT_SetAutoSizeControls hDlg "3s"
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1

Shift+click a link to test.
thank you !!!

This link(http://static.flipbuilder.com/demo/sysco...index.html) is a Flash eBook page. I added it to the above code and it can display normally, but I want to implement the following two functions:

1. When the e-book is opened, the default full-screen display (without title bar and border)

2. When I press hot key F11, I can switch between full screen and standard mode

I found some flash full-screen code but I don't know how to add it to QM

//Open sets focus on full-screen Stage.focus
fscommand("fullscreen","true");//Close the code fscommand("quit");
//Or add a right-click menu control
var myMenu:ContextMenu = new ContextMenu();
myMenu.hideBuiltInItems();
var item:ContextMenuItem = new ContextMenuItem("full");
myMenu.customItems.push(item);
function fullScreen(evt:ContextMenuEvent):void
{
    if (item.caption == "full")
    {
        fscommand("fullscreen","true");
        item.caption = "quit full";
    }
    else
    {
        fscommand("fullscreen","false");
        item.caption = "full";
    }
}
item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,fullScreen);
contextMenu = myMenu;

I hope to give me some examples or suggestions, thanks in advance
  Heart
#4
Huh
http://fs.focusky.com.cn/wmindmap/jhgh/ftkf/index.html
IE browser control can not load the web page, but can be opened directly in IE browser, the problem is very strange, I hope the developers can help me verify, thanks



Macro Macro1
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90CF0AC8 0x0 0 0 586 262 "bs"
;2 Button 0x54030000 0x4 376 236 48 14 "Cancel"
;1 Button 0x54030001 0x4 308 236 48 14 "OK"
;3 ActiveX 0x54030000 0x0 12 8 564 216 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

str controls = "3"
str ax3SHD
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam
SHDocVw.WebBrowser we3
int- t_mainDlg

sel message
,case WM_INITDIALOG
,t_mainDlg=hDlg
,DT_SetAutoSizeControls(hDlg "3s 4mh 4sv 1m 2m")
,max hDlg
,
,we3._getcontrol(id(3 hDlg))
,we3.Navigate("http://fs.focusky.com.cn/wmindmap/jhgh/ftkf/index.html")

,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#5
The provided link opened in web browser control for me .. Took a long time but it opened . You May need to run this function since the website is flash based as the browser control runs by default in ie7 compatibility mode

try this function

Function WebBrowserControlDisableIE7Emulation
Code:
Copy      Help
;/

;Ensures that web browser controls of this program (QM or your QM-created exe) can use features of current Internet Explorer version (CSS3, HTML5 etc).

;REMARKS
;By default, web browser controls work in compatibility mode with Internet Explorer 7. IE 8/9/10/11 features are unavailable.
;This function sets this registry value, if it is missing or different:
;;;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION:<ThisProgram.exe>=<CurrentInternetExplorerVersion>
;Error if this process is not running as administrator.
;You can call this function before ShowDialog if the dialog contains an ActiveX control SHDocVw.WebBrowser. Or call it once.


if(_iever<8) ret
str e.getfilename(ExeFullPath 1)
;out e
int t v=_iever>>8*1000
;out v
lpstr k="SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"
if(rget(t e k HKEY_LOCAL_MACHINE) and t=v) ret
;out t
if(!rset(v e k HKEY_LOCAL_MACHINE)) end ERR_ADMIN
forum topic is here http://www.quickmacros.com/forum/showthr...er+version
#6
(04-20-2018, 04:28 PM)Kevin Wrote: The provided link opened in web browser control for me .. Took a long time but it opened . You May need to run this function since the website is flash based as the browser control runs by default in ie7 compatibility mode

try this function

Function WebBrowserControlDisableIE7Emulation
Code:
Copy      Help
;/

;Ensures that web browser controls of this program (QM or your QM-created exe) can use features of current Internet Explorer version (CSS3, HTML5 etc).

;REMARKS
;By default, web browser controls work in compatibility mode with Internet Explorer 7. IE 8/9/10/11 features are unavailable.
;This function sets this registry value, if it is missing or different:
;;;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION:<ThisProgram.exe>=<CurrentInternetExplorerVersion>
;Error if this process is not running as administrator.
;You can call this function before ShowDialog if the dialog contains an ActiveX control SHDocVw.WebBrowser. Or call it once.


if(_iever<8) ret
str e.getfilename(ExeFullPath 1)
;out e
int t v=_iever>>8*1000
;out v
lpstr k="SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"
if(rget(t e k HKEY_LOCAL_MACHINE) and t=v) ret
;out t
if(!rset(v e k HKEY_LOCAL_MACHINE)) end ERR_ADMIN
forum topic is here http://www.quickmacros.com/forum/showthr...er+version

Thank you for your help, after adding the above function, generate exe file, I can open the link

1. When the e-book is opened, the default full-screen display (without title bar and border)

2. When I press hot key F11, I can switch between full screen and standard mode

Now that only the full screen of the two issues is not resolved, I can not control the flash full screen before loading the dialog box? Undecided  I hope someone can provide some suggestions and ideas, thanks

#7
Flash by design does not allow fullscreen when loading(security risk)
you can however do a couple things to achieve the desired effect
this adds keyboard hotkey F11 to dialog itself and will toggle between full screen and programmed size
opens in full screen
all the functions needed  listed below
you have some of these already but listed here for complete example


Function dialog_full_screen2
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90CC0AC8 0x0 0 0 224 136 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 224 136 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""
WebBrowserControlDisableIE7Emulation

str controls = "3"
str ax3SHD="http://static.flipbuilder.com/demo/sysco-seafood/index.html#p=1"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DT_SetAutoSizeControls hDlg "3s"
,int- t_hdlg t_kh
,t_hdlg=hDlg
,t_kh=SetWindowsHookEx(WH_KEYBOARD_LL &DAKH_HookProc _hinst 0)
,,,SetWinStyle hDlg WS_CAPTION 2            
,,,max hDlg
,case WM_APP+10
,FormatKeyString lParam 0 &_s
,if _s = "F11"
,,if max(hDlg)
,,,SetWinStyle hDlg WS_CAPTION 1
,,,res hDlg
,,else
,,,SetWinStyle hDlg WS_CAPTION 2            
,,,max hDlg            
,case WM_DESTROY
,,UnhookWindowsHookEx t_kh
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1


Function DAKH_HookProc
Code:
Copy      Help
;/dialog_and_keyboard_hook
function nCode wParam KBDLLHOOKSTRUCT&h

/FormatKeyString h.vkCode 0 &_s; out "%s %s" _s iif(h.flags&LLKHF_UP "up" "down") ;;disable this

;Example of triggers for keys F11
;With Ctrl etc need more work, eg reliably remember key state.

if(h.flags&(LLKHF_INJECTED|LLKHF_UP)) goto gr

int- t_hdlg
sel h.vkCode
,case [VK_F11] SendMessage t_hdlg WM_APP+10 0 h.vkCode

;gr
ret CallNextHookEx(0 nCode wParam &h)

Function DT_AutoSizeControls
Code:
Copy      Help
;/
function hDlg message $controls

;Moves or resizes dialog controls when you resize the dialog.
;Call this function from dialog function, before sel message.

;hDlg, message - hDlg, message.
;controls - space-separated list of controls.
;;;Syntax for a control: IdActionDirection
;;;;;Id - control id.
;;;;;Action - m (move) or s (resize).
;;;;;Direction - h (horizontally) or v (vertically) or none (horizontally and vertically).

;EXAMPLE
;;...
;;messages
;DT_AutoSizeControls hDlg message "1m 2m 3sh 4mv 5s"
;sel message
,;case WM_INITDIALOG
,;;...


type ASC_CONTROL hwnd !action !direction horz vert
ASC_CONTROL* p
int i j k x y
RECT r rc

sel message
,case WM_INITDIALOG
,GetClientRect hDlg &rc
,
,ARRAY(lpstr) a
,tok controls a
,p._new(a.len)
,SetProp hDlg "asc_controls" p
,
,for i 0 a.len
,,ASC_CONTROL& c=p[i]
,,lpstr s=a[i] ;;out s
,,j=val(s 0 k); s+k
,,c.hwnd=id(j hDlg); if(!c.hwnd) out "Warning: control %i not found." j; continue
,,c.action=s[0]; c.direction=s[1]
,,
,,GetWindowRect c.hwnd &r; MapWindowPoints 0 hDlg +&r 2
,,sel c.action
,,,case 'm' c.horz=rc.right-r.left; c.vert=rc.bottom-r.top
,,,case 's' c.horz=rc.right-r.right; c.vert=rc.bottom-r.bottom
,
,case WM_SIZE
,GetClientRect hDlg &rc
,
,p=+GetProp(hDlg "asc_controls")
,
,for i 0 p._len
,,&c=p[i]
,,j=0; sel(c.direction) case 'h' j|2; case 'v' j|1
,,sel c.action
,,,case 'm'
,,,x=rc.right-c.horz; y=rc.bottom-c.vert
,,,mov x y c.hwnd j; err
,,,
,,,case 's'
,,,GetWindowRect c.hwnd &r; MapWindowPoints 0 hDlg +&r 2
,,,x=rc.right-r.left-c.horz; y=rc.bottom-r.top-c.vert
,,,siz x y c.hwnd j; err
,
,case WM_DESTROY
,p=+RemoveProp(hDlg "asc_controls")
,p._delete

Function WebBrowserControlDisableIE7Emulation
Code:
Copy      Help
;/

;Ensures that web browser controls of this program (QM or your QM-created exe) can use features of current Internet Explorer version (CSS3, HTML5 etc).

;REMARKS
;By default, web browser controls work in compatibility mode with Internet Explorer 7. IE 8/9/10/11 features are unavailable.
;This function sets this registry value, if it is missing or different:
;;;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION:<ThisProgram.exe>=<CurrentInternetExplorerVersion>
;Error if this process is not running as administrator.
;You can call this function before ShowDialog if the dialog contains an ActiveX control SHDocVw.WebBrowser. Or call it once.


if(_iever<8) ret
str e.getfilename(ExeFullPath 1)
;out e
int t v=_iever>>8*1000
;out v
lpstr k="SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"
if(rget(t e k HKEY_LOCAL_MACHINE) and t=v) ret
;out t
if(!rset(v e k HKEY_LOCAL_MACHINE)) end ERR_ADMIN
#8
(04-20-2018, 07:19 PM)Kevin Wrote: Flash by design does not allow fullscreen when loading(security risk)
you can however do a couple things to achieve the desired effect
this adds keyboard hotkey F11 to dialog itself and will toggle between full screen and programmed size
opens in full screen
all the functions needed  listed below
you have some of these already but listed here for complete example


Function dialog_full_screen2
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90CC0AC8 0x0 0 0 224 136 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 224 136 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""
WebBrowserControlDisableIE7Emulation

str controls = "3"
str ax3SHD="http://static.flipbuilder.com/demo/sysco-seafood/index.html#p=1"
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DT_SetAutoSizeControls hDlg "3s"
,int- t_hdlg t_kh
,t_hdlg=hDlg
,t_kh=SetWindowsHookEx(WH_KEYBOARD_LL &DAKH_HookProc _hinst 0)
,,,SetWinStyle hDlg WS_CAPTION 2            
,,,max hDlg
,case WM_APP+10
,FormatKeyString lParam 0 &_s
,if _s = "F11"
,,if max(hDlg)
,,,SetWinStyle hDlg WS_CAPTION 1
,,,res hDlg
,,else
,,,SetWinStyle hDlg WS_CAPTION 2            
,,,max hDlg            
,case WM_DESTROY
,,UnhookWindowsHookEx t_kh
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1


Function DAKH_HookProc
Code:
Copy      Help
;/dialog_and_keyboard_hook
function nCode wParam KBDLLHOOKSTRUCT&h

/FormatKeyString h.vkCode 0 &_s; out "%s %s" _s iif(h.flags&LLKHF_UP "up" "down") ;;disable this

;Example of triggers for keys F11
;With Ctrl etc need more work, eg reliably remember key state.

if(h.flags&(LLKHF_INJECTED|LLKHF_UP)) goto gr

int- t_hdlg
sel h.vkCode
,case [VK_F11] SendMessage t_hdlg WM_APP+10 0 h.vkCode

;gr
ret CallNextHookEx(0 nCode wParam &h)

Function DT_AutoSizeControls
Code:
Copy      Help
;/
function hDlg message $controls

;Moves or resizes dialog controls when you resize the dialog.
;Call this function from dialog function, before sel message.

;hDlg, message - hDlg, message.
;controls - space-separated list of controls.
;;;Syntax for a control: IdActionDirection
;;;;;Id - control id.
;;;;;Action - m (move) or s (resize).
;;;;;Direction - h (horizontally) or v (vertically) or none (horizontally and vertically).

;EXAMPLE
;;...
;;messages
;DT_AutoSizeControls hDlg message "1m 2m 3sh 4mv 5s"
;sel message
,;case WM_INITDIALOG
,;;...


type ASC_CONTROL hwnd !action !direction horz vert
ASC_CONTROL* p
int i j k x y
RECT r rc

sel message
,case WM_INITDIALOG
,GetClientRect hDlg &rc
,
,ARRAY(lpstr) a
,tok controls a
,p._new(a.len)
,SetProp hDlg "asc_controls" p
,
,for i 0 a.len
,,ASC_CONTROL& c=p[i]
,,lpstr s=a[i] ;;out s
,,j=val(s 0 k); s+k
,,c.hwnd=id(j hDlg); if(!c.hwnd) out "Warning: control %i not found." j; continue
,,c.action=s[0]; c.direction=s[1]
,,
,,GetWindowRect c.hwnd &r; MapWindowPoints 0 hDlg +&r 2
,,sel c.action
,,,case 'm' c.horz=rc.right-r.left; c.vert=rc.bottom-r.top
,,,case 's' c.horz=rc.right-r.right; c.vert=rc.bottom-r.bottom
,
,case WM_SIZE
,GetClientRect hDlg &rc
,
,p=+GetProp(hDlg "asc_controls")
,
,for i 0 p._len
,,&c=p[i]
,,j=0; sel(c.direction) case 'h' j|2; case 'v' j|1
,,sel c.action
,,,case 'm'
,,,x=rc.right-c.horz; y=rc.bottom-c.vert
,,,mov x y c.hwnd j; err
,,,
,,,case 's'
,,,GetWindowRect c.hwnd &r; MapWindowPoints 0 hDlg +&r 2
,,,x=rc.right-r.left-c.horz; y=rc.bottom-r.top-c.vert
,,,siz x y c.hwnd j; err
,
,case WM_DESTROY
,p=+RemoveProp(hDlg "asc_controls")
,p._delete

Function WebBrowserControlDisableIE7Emulation
Code:
Copy      Help
;/

;Ensures that web browser controls of this program (QM or your QM-created exe) can use features of current Internet Explorer version (CSS3, HTML5 etc).

;REMARKS
;By default, web browser controls work in compatibility mode with Internet Explorer 7. IE 8/9/10/11 features are unavailable.
;This function sets this registry value, if it is missing or different:
;;;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION:<ThisProgram.exe>=<CurrentInternetExplorerVersion>
;Error if this process is not running as administrator.
;You can call this function before ShowDialog if the dialog contains an ActiveX control SHDocVw.WebBrowser. Or call it once.


if(_iever<8) ret
str e.getfilename(ExeFullPath 1)
;out e
int t v=_iever>>8*1000
;out v
lpstr k="SOFTWARE\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION"
if(rget(t e k HKEY_LOCAL_MACHINE) and t=v) ret
;out t
if(!rset(v e k HKEY_LOCAL_MACHINE)) end ERR_ADMIN
Thank you very much, this is a great example Exclamation

I don't understand some of the code. I need a period of programming learning. Thank you again for your kind help. Heart Heart Heart
#9
After pressing the F11 hot key, the window is not completely full screen, there are borders around, how to set the border style to none? thanks  Smile

The flash control has a border around it, I didn't find the property of this control  Huh

QM can run java script  in the code?  I did not find in the template, help is not found, is there a relevant example? I want to learn Java script and QM script

If QM can support it would be great Idea


Attached Files Image(s)
           
#10
fullscreen for me has no border perhaps its your windows version (win10 here)
try this loads the page through javascript
small dialog window has a sizing border so can resize with mouse.
Function dialog_full_screen3
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90CF0AC8 0x0 0 0 224 136 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 224 136 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

WebBrowserControlDisableIE7Emulation
str controls = "3"
str ax3SHD=
;<html>
;<head><script type="text/javascript">document.location.href="http://static.flipbuilder.com/demo/sysco-seafood/index.html#p=1";</script></head>
;<body style="border: 0px; margin: 0px; overflow: hidden;">
;</body>
;</html>
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DT_SetAutoSizeControls hDlg "3s"
,int- t_hdlg t_kh
,t_hdlg=hDlg
,t_kh=SetWindowsHookEx(WH_KEYBOARD_LL &DAKH_HookProc _hinst 0)
,SetWinStyle hDlg WS_CAPTION 2
,SetWinStyle hDlg WS_BORDER 2
,max hDlg
,case WM_APP+10
,FormatKeyString lParam 0 &_s
,if _s = "F11"
,,if max(hDlg)
,,,SetWinStyle hDlg WS_CAPTION 1
,,,SetWinStyle hDlg WS_BORDER 1
,,,res hDlg
,,else
,,,SetWinStyle hDlg WS_CAPTION 2
,,,SetWinStyle hDlg WS_BORDER 2
,,,max hDlg            
,case WM_DESTROY
,,UnhookWindowsHookEx t_kh
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#11
I use the system is windows 7, after running the above code, the window still has a small border around
#12
try this if this doesn't work may have to disable windows theme on the dialog possible may not work as well.
I cannot test on win7 today will try tomorrow


Function dialog_full_screen3a
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90CF0AC8 0x0 0 0 224 136 "Dialog"
;3 ActiveX 0x54030000 0x0 0 0 224 136 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040700 "*" "" "" ""

WebBrowserControlDisableIE7Emulation
str controls = "3"
str ax3SHD=
;<html>
;<head><script type="text/javascript">document.location.href="http://static.flipbuilder.com/demo/sysco-seafood/index.html#p=1";</script></head>
;<body style="border: 0px; margin: 0px; overflow: hidden;">
;</body>
;</html>
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DT_SetAutoSizeControls hDlg "3s"
,int- t_hdlg t_kh
,t_hdlg=hDlg
,t_kh=SetWindowsHookEx(WH_KEYBOARD_LL &DAKH_HookProc _hinst 0)
,SetWinStyle hDlg WS_CAPTION 2
,SetWinStyle hDlg WS_BORDER 2
,int bco= id(3 hDlg)
,SetWinStyle bco WS_BORDER 2
,max hDlg
,case WM_APP+10
,FormatKeyString lParam 0 &_s
,if _s = "F11"
,,if max(hDlg)
,,,SetWinStyle hDlg WS_CAPTION 1
,,,SetWinStyle hDlg WS_BORDER 1
,,,res hDlg
,,else
,,,SetWinStyle hDlg WS_CAPTION 2
,,,SetWinStyle hDlg WS_BORDER 2
,,,max hDlg            
,case WM_DESTROY
,,UnhookWindowsHookEx t_kh
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1
#13
The problem of the border, there is always a thin border under win7, so I have time to install windows10 and try again, thank you

In addition:

I commented out a few lines of the list dialog and now I can open the page directly from the modal window.

I do not understand the following code, there is no short code to achieve the same function? Huh

Macro bs
Code:
Copy      Help
str dd=
;BEGIN DIALOG
;0 "" 0x90CF0AC8 0x0 0 0 586 262 "bs"
;2 Button 0x54030000 0x4 376 236 48 14 "Cancel"
;1 Button 0x54030001 0x4 308 236 48 14 "OK"
;3 ActiveX 0x54030000 0x0 12 8 344 216 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;4 ActiveX 0x54030000 0x0 364 8 218 216 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040701 "*" "" "" ""

str controls = "3 4"
str ax3SHD ax4SHD
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam
SHDocVw.WebBrowser we3
int- t_mainDlg

sel message
,case WM_INITDIALOG
,t_mainDlg=hDlg
,DT_SetAutoSizeControls(hDlg "3s 4mh 4sv 1m 2m")
,max hDlg
,
,we3._getcontrol(id(3 hDlg))
,we3._setevents("sub.we3")
,we3.Navigate("http://www.quickmacros.com/help/QM_Help/IDH_OVERVIEW.html")
,;we3.Navigate("http://static.flipbuilder.com/demo/sysco-seafood/index.html")
,;we3.Navigate("http://fs.focusky.com.cn/thasm/jcwz/index.html?flash")

,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1


#sub we3_NewWindow3
function IDispatch&ppDisp @&Cancel dwFlags BSTR'bstrUrlContext BSTR'bstrUrl SHDocVw.IWebBrowser2'we3

;out bstrUrl
;out bstrUrlContext

int- t_mainDlg
;sel ListDialog("1 Main control[]2 Another control[]3 New dialog[]4 Web Browser" "Where to open the link?" "" 2 t_mainDlg)
,;case 0
,;Cancel=1
,;
,;case 1
,;Cancel=1
,;we3.Navigate(bstrUrl)
,;
,;case 2
,;SHDocVw.WebBrowser we4._getcontrol(id(4 t_mainDlg))
,;ppDisp=we4
,;
,;case 3
,int hDlg2=sub.Dialog2(t_mainDlg)
,SHDocVw.WebBrowser d2_we3._getcontrol(id(3 hDlg2))
,ppDisp=d2_we3


#sub Dialog2
function# [hwndOwner]

str dd=
;BEGIN DIALOG
;0 "" 0x90CF0AC8 0x0 0 0 344 214 "Dialog2"
;3 ActiveX 0x54030000 0x0 0 0 344 214 "SHDocVw.WebBrowser {8856F961-340A-11D0-A96B-00C04FD705A2}"
;END DIALOG
;DIALOG EDITOR: "" 0x2040701 "*" "" "" ""

str controls = "3"
str ax3SHD
ret ShowDialog(dd &sub.DlgProc2 &controls hwndOwner 1) ;;modeless dialog


#sub DlgProc2
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,DT_SetAutoSizeControls hDlg "3s"
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1


Attached Files Image(s)
   
#14
Hi

How to insert the code of the second dialog box? I have no way to create the second dialog code directly Thanks Heart


Attached Files Image(s)
   
#15
the code your using only fires when a new window is created either by shift+click a link or right click a link and select open in new window. it will not work the way your wanting in its current state.

Need to have a better idea what you're trying to accomplish. Your all over the map trying to use different examples and not understanding how they work.

What is your goal exactly? not the short term. I'm trying to understand what is your idea you have in mind.
#16
Hi thanks for your reply,

I want to learn scripting language to improve learning and work efficiency. I have seen autohotkey on the Internet but I feel that QM is easier to learn.

My question, somewhat random, is to verify whether QM can achieve certain functions. It looks great now

In addition, I often use AutoText. QM does not have global hotkeys. I hope to add hotkeys in the future. I am using the following free AutoText software. I can only edit the script with a purchase license. The price is a little expensive. QM If you can add some AutoText settings dialogs, it will be more convenient, QM is very cost-effective, when I am familiar with the use, I will buy a license.
Https://www.phraseexpress.com/
#17
@Win

Maybe these tutorials might help you:

Quick Macros - Tutorial 1 - chapter 1/25:
https://www.youtube.com/watch?v=SN5q5Al1yjY

For the other chapters, search in google, for example for chapter 2:
 Quick Macros - Tutorial 1 - chapter 2/25
#18
Photo 
there are several ways to create hotkeys depending on your needs.

1. function/macro triggers
 
   

keyboard hooks
 
File->New->Templates->Hook->Hook_WH_KEYBOARD_LL

creates a template you can use to create the hotkey you need
there is examples on the forum and in the archive file
 can register hotkeys
 example in archive file
archive file found here 
http://www.quickmacros.com/forum/showthr...p?tid=2852

can create them yourself other ways
their are many possibilities

this is just a simple example
Macro HotKey
Code:
Copy      Help
rep
,int vk=wait(0 K (VK_F11))
,out "F11 pressed"
,int w=win()
,str exe.getwinexe(w)
,out exe
#19
hi  @rOn  @Kevin 
Thank you very much for your reply Smile

 I mean  QM is not very convenient for defining AutoText. There is no hotkey, setting dialog for AutoText.

For example, I have in a word document or in the Google browser, select some text, I would like to quickly define them as AutoText, press ctrl + alt + t hotkey will pop up  settings dialog for AutoText 

In software phraseexpress, have hotkeys and dialogs is very convenient. I hope QM developers can enhance the capabilities of AutoText.

I think: The AutoText feature is very useful for most people, adding a settings dialog is very necessary


Attached Files Image(s)
       
#20
I'm sorry can't really help you with autotext features of Qm. That is one area of qm that i don't use but probably should . I'm sure Gintaras can help you further.
#21
@Kevin

Anyway thank you very much ! you helped me a lot


Forum Jump:


Users browsing this thread: 1 Guest(s)