AndyBarrow
asked on
Error 47 Permission Denied in IE6
Hi
Using Delphi 2005 Pro / Intraweb 7.2 / IE version 6.0.2900.2180 / XP Home SP2
I need to have a button on an Intraweb form that simply brings up the browser search window (i.e. emulates the CTRL-F keystrokes). The following code brings the window up fine but when I try to execute the search I get "Error 47 Permission Denied". I don't get the error when I just hit CTRL-F. I presume this is some IE automation security protection but is there a work around?
keybd_event(VK_CONTROL, 0, 0, 0);
keybd_event(70, 0, 0, 0);
keybd_event(70, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);
Many Thanks
Using Delphi 2005 Pro / Intraweb 7.2 / IE version 6.0.2900.2180 / XP Home SP2
I need to have a button on an Intraweb form that simply brings up the browser search window (i.e. emulates the CTRL-F keystrokes). The following code brings the window up fine but when I try to execute the search I get "Error 47 Permission Denied". I don't get the error when I just hit CTRL-F. I presume this is some IE automation security protection but is there a work around?
keybd_event(VK_CONTROL, 0, 0, 0);
keybd_event(70, 0, 0, 0);
keybd_event(70, 0, KEYEVENTF_KEYUP, 0);
keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0);
Many Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi
Apologies for delay. Haven't managed to find any JS to do this because of the obvious security implications of key emulation but find it hard to beleive that a browsers search function cannot be invoked somehow!? I will award points 'cos strictly speaking you answered my question (even though with hindsight it was a bit of a dumb one : )
regards
Andy.
Apologies for delay. Haven't managed to find any JS to do this because of the obvious security implications of key emulation but find it hard to beleive that a browsers search function cannot be invoked somehow!? I will award points 'cos strictly speaking you answered my question (even though with hindsight it was a bit of a dumb one : )
regards
Andy.
you can use something like this:
http://www.javascripter.net/faq/searchin.htm
<form name="f1" action=""
onSubmit="if(this.t1.value !=null && this.t1.value!='')
findString(this.t1.value); return false"
>
<input type="text" name=t1 value="" size=20>
<input type="submit" name=b1 value="Find">
</form>
<script language="JavaScript">
<!--
var TRange=null
function findString (str) {
if (parseInt(navigator.appVer sion)<4) return;
var strFound;
if (navigator.appName=="Netsc ape") {
// NAVIGATOR-SPECIFIC CODE
strFound=self.find(str);
if (!strFound) {
strFound=self.find(str,0,1 )
while (self.find(str,0,1)) continue
}
}
if (navigator.appName.indexOf ("Microsof t")!=-1) {
// EXPLORER-SPECIFIC CODE
if (TRange!=null) {
TRange.collapse(false)
strFound=TRange.findText(s tr)
if (strFound) TRange.select()
}
if (TRange==null || strFound==0) {
TRange=self.document.body. createText Range()
strFound=TRange.findText(s tr)
if (strFound) TRange.select()
}
}
if (!strFound) alert ("String '"+str+"' not found!")
}
//-->
</script>
http://www.javascripter.net/faq/searchin.htm
<form name="f1" action=""
onSubmit="if(this.t1.value
findString(this.t1.value);
>
<input type="text" name=t1 value="" size=20>
<input type="submit" name=b1 value="Find">
</form>
<script language="JavaScript">
<!--
var TRange=null
function findString (str) {
if (parseInt(navigator.appVer
var strFound;
if (navigator.appName=="Netsc
// NAVIGATOR-SPECIFIC CODE
strFound=self.find(str);
if (!strFound) {
strFound=self.find(str,0,1
while (self.find(str,0,1)) continue
}
}
if (navigator.appName.indexOf
// EXPLORER-SPECIFIC CODE
if (TRange!=null) {
TRange.collapse(false)
strFound=TRange.findText(s
if (strFound) TRange.select()
}
if (TRange==null || strFound==0) {
TRange=self.document.body.
strFound=TRange.findText(s
if (strFound) TRange.select()
}
}
if (!strFound) alert ("String '"+str+"' not found!")
}
//-->
</script>
ASKER
Many thanks for that. I'll give that a go asap.
ASKER