Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

BBCoder tool available 7

Status
Not open for further replies.
I searched MSDN a bit and it looks you need to use the OnBeforeNavigate2 event. this is what MSDN has to say about this subject:

Remarks

The BeforeNavigate2 event replaces the BeforeNavigate and FrameBeforeNavigate events, which should no longer be used. The pDisp parameter that specifies the corresponding WebBrowser object clearly identifies where the navigation is to occur. Microsoft Internet Explorer 3.0 required the FrameBeforeNavigate and a target frame name to identify the target of navigation. However, this solution was potentially ambiguous as frame names are not unique.

Note Internet Explorer 4.0 and later continue to fire the BeforeNavigate and FrameBeforeNavigate events for compatibility with Internet Explorer 3.0.
The pDisp parameter specifies the WebBrowser object of the top-level frame corresponding to the navigation. Navigating to a different URL could happen as a result of external automation, internal automation from a script, or the user clicking a link or typing in the address bar. The processing of this navigation can be modified by setting the Cancel parameter to True and either ignoring or reissuing a modified navigation method to the WebBrowser object.

When reissuing a navigation for the WebBrowser object, the Stop method must first be executed for pDisp. This prevents the display of a web page that declares a cancelled navigation from appearing while the new navigation is being processed.



-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
So from what I can read from MSDN, you use the beforenavigate event to set Cancel:=True; and then you need to reissue a browser.navigate with the new postdata...

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
here's another example using postdata :


-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
got it working [smile] awesome. I've updated the download above with it, and instructions etc. But - it's currently causing Internet Explorer to crash when you close it. That's no big deal because you're not losing anything, and it doesn't upset anything else.

Be sure to read the readme.txt in the archive for details on using it. I've only given it a small amount of testing, coz I gotta go (work party). If you find internet explorer is hanging using up all your CPU, just use the Task Manager to kill it, and then uninstall the BHO so it doesn't stop you doing anything. And let me know what you were doing at the time. If possible, turn logging on (instructions in the readme.txt), try again, and e-mail it to me via the FAQ topic.

Thanks for all your help whosrdaddy - star for you.
 
awesome Griffyn, I'll give it a try!

[2thumbsup]

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
small BHO test:

Code:
[navy]// for automatic syntax highlighting see faq102-6487[/navy]
[b]unit[/b] u_svc_main;

[b]interface[/b]

[b]const[/b] test=[purple]1[/purple];
 
[b]uses[/b]
  Windows, Messages, SysUtils, Classes, Graphics, Controls, SvcMgr, Dialogs;

[b]type[/b]
  TSvc_autoupdater = [b]class[/b](TService)
  [b]private[/b]
    [navy]{ Private declarations }[/navy]
  [b]public[/b]
    [b]function[/b] GetServiceController: TServiceController; [b]override[/b];
    [navy]{ Public declarations }[/navy]
  [b]end[/b];

[b]var[/b]
  Svc_autoupdater: TSvc_autoupdater;

[b]implementation[/b]

[navy]{$R *.DFM}[/navy]

[b]procedure[/b] ServiceController(CtrlCode: DWord); stdcall;
[b]begin[/b]
  Svc_autoupdater.Controller(CtrlCode);
[b]end[/b];

[b]function[/b] TSvc_autoupdater.GetServiceController: TServiceController;
[b]begin[/b]
  Result := ServiceController;
[b]end[/b];

[b]begin[/b]
 VarStr:=[teal]'string'[/teal];
 VarInt:=[purple]10[/purple];
[b]end[/b].


-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
this is so nice, If I could I would give you another star!!


[wavey]


-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Code:
[navy]// for automatic syntax highlighting see faq102-6487[/navy]
[b]function[/b] FeedbackForGriffyn: [b]String[/b]
[b]begin[/b]
  Result := [teal]'Excellent job Griffyn! (tested in IE7)'[/teal];
[b]end[/b];


Clive
Runner_1Revised.gif

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
 
Code:
[navy]// for automatic syntax highlighting see faq102-6487[/navy]
[b]function[/b] ForgotToTell: [b]String[/b];
[b]begin[/b]
 Result:=[teal]'IE7 works also here'[/teal];
[b]end[/b];

[wiggle]

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Thanks guys.

I've just updated the archive again. Couple of little fixes, haven't found what's causing the AV on close bug yet, and I've changed the use of the DisableSH tag. Instead, include the tag '#DisableSH' (no quotes) anywhere in your post to entirely disable processing by the BHO. Beforehand, posts that included a [ignore]
Code:
[/ignore] tag would try to be processed, even in text like this.
 
Awesome, Griffyn!

And ya know, if you just added quote-char and comment-char to your .ini file (and applicable program support) your prog could be made to work for loads of languages, and garner you excesses of laurels!
 
Thanks harebrain.

Multi-language and multi-forum support is something I've been thinking of, but I don't use many other languages like java or C, so I'm not sure what I'd need to change to properly do syntax highlighting for them.
 
I have a multi-language, syntax-highlighting editor that works using the following elements:
[ul][li]reserved words[/li]
[li]symbols[/li]
[li]brackets[/li]
[li]string literals[/li]
[li]comments[/li][/ul]
I also tried using your BBCoder with VB by loading the reserved words and properties into the respective text files: it works fine except for string literals and comments.

I can provide the above info for several languages if you're interested.
 
I've updated the archive again with a new version that should allow multi-language setups. Have a look at the config.ini for an idea of the different sections required. I've also added support for an additional formatting code for each code 'type', so comments can now appear in navy, as well as in italics. The reserved words for each language are now embedded in the config.ini, so you can throw away the reserved.txt and reservedproperty.txt files.

There's only one or two things still hardcoded for Delphi in the program, hopefully they won't conflict with other languages - let me know if things aren't working.

I've updated the readme.txt with a brief description on how to set up the comment IDs.

The automatic comment referring to the FAQ will remain the same regardless of the language being used.

Give that a try harebrain, modify the config.ini to your liking with the reserved words, colors and formatting, and post the config.ini back here.

Thanks.
 
Griffyn, did you find the AV bug (on closing IE) yet?

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
the AV hasn't been happening to me recently, so I was thinking it had gone away. I rejigged things slightly in this new version so that there's no code being run as the library is unloaded - I can't think of anything else that could be causing it. Try this latest version, and let me know if it's still happening. I'm not sure how I could go about narrowing down what to look for.
 
Griffyn,

I'm blowing up with an access violation. The log file just shows: getting details from config.ini

Here's the config.ini I'm using. (I tried the factory supplied version too, but same problem.
Code:
[Colors-VB]
string=navy
comment=green
reserved=

[Formats-VB]
comment=i
reserved=b

[Reserved-VB]
normal=abs,and,appactivate,as,asc,atn,base,beep,begintrans,byval,call,
case,ccur,cdbl,chdir,chdrive,choose,chr,chr$,cint,clng,close,command,
command$,committrans,compactdatabase,compare,const,cos,createdatabase,
csng,cstr,curdir,curdir$,cvar,cvdate,date,date$,dateadd,datediff,datepart,
dateserial,datevalue,day,ddb,declare,deftype,dim,dir,dir$,do,doevents,
double,else,end,environ,environ$,eof,eqv,erase,erl,err,error,error$,exit,
exp,false,fileattr,filecopy,filedatetime,filelen,fix,for,format,format$,
freefile,freelocks,function,fv,get,getattr,global,gosub,goto,hex,hex$,hour,
if,iif,imp,input,input$,inputbox,inputbox$,instr,int,integer,ipmt,irr,is,
isdate,isempty,isnull,isnumeric,kill,lbound,lcase,lcase$,left,left$,len,
let,like,line,load,loadpicture,loc,lock,lof,log,long,loop,lset,ltrim,
ltrim$,me,method,method,method,mid,mid$,minute,mirr,mkdir,mod,month,
msgbox,name,new,next,not,now,nper,npv,oct,oct$,on,open,opendatabase,
operator,option,or,partition,pmt,ppmt,print,private,put,pv,qbcolor,
randomize,rate,redim,registerdatabase,rem,repairdatabase,reset,resume,
return,rgb,right,right$,rmdir,rnd,rollback,rset,rtrim,rtrim$,savepicture,
second,seek,select,sendkeys,set,setattr,setdataaccessoption,
setdefaultworkspace,sgn,shell,sin,single,sln,space,space$,spc,sqr,static,
step,stop,str,str$,strcomp,string,string,string$,sub,switch,syd,tab,tan,
then,time,time$,timer,timeserial,timevalue,to,trim,trim$,true,type,ubound,
ucase,ucase$,unload,unlock,val,variant,vartype,weekday,wend,while,width,
write,xor,year
property=additem,addnew,append,appendchunk,arrange,circle,clear,clone,
close,cls,createdynaset,createquerydef,createsnapshot,delete,
deletequerydef,drag,edit,enddoc,execute,executesql,fieldsize,findfirst,
findlast,findnext,findprevious,getchunk,getdata,getformat,gettext,hide,
line,linkexecute,linkpoke,linkrequest,linksend,listfields,listindexes,
listparameters,listtables,move,movefirst,movelast,movenext,moveprevious,
newpage,openquerydef,opentable,point,popupmenu,print,printform,pset,
refresh,removeitem,rollback,scale,setdata,setfocus,settext,show,textheight,
textwidth,update,updatecontrols,updaterecord,zorder

[IDs-VB]
string="
comment=',REM

[URLs]
tektipsdelphi=Delphi,[URL unfurl="true"]http://www.tek-tips.com/submitpost.cfm?pid=102[/URL]
tektipsvb56=VB,[URL unfurl="true"]http://www.tek-tips.com/submitpost.cfm?pid=222[/URL]
tektipsvba=VB,[URL unfurl="true"]http://www.tek-tips.com/submitpost.cfm?pid=707[/URL]

[Options]
Logging=c:\temp.txt
Here's the sample code module I'm trying.

Code:
Private Sub Form_Click()
    Static i As Integer

    If i < 4 Then
        Unload txtMoney(i + 2)
        i = i + 1
    End If
End Sub

Private Sub Form_Load()
    Dim i As Integer
    Const SPACING = 10

    With txtMoney(0)
        .Move 0, 0
        .Text = "Text Box in control array #0."
        .Width = TextWidth("  TextBox in control array #0.  ")
    End With
    With txtMoney(1)
        .Move 0, txtMoney(0).Top + txtMoney(0).Height + SPACING
        .Text = "Text Box in control array #1."
        .Width = TextWidth("  TextBox in control array #1.  ")
    End With

    For i = 2 To 5
        Load txtMoney(i)
        txtMoney(i).Text = "Text Box in control array #" & Str$(i)
        txtMoney(i).Move 0, txtMoney(i - 1).Top + txtMoney(i - 1).Height + SPACING
        txtMoney(i).Visible = True
    Next
End Sub

'Private Sub txtMoney_Change(Index As Integer)
'    If Index = 0 Then
'        MsgBox "You typed in text box[0]."
'    Else
'        MsgBox "You typed in text box[1]."
'    End If
'
'     MsgBox "You typed in text box " & Index
'End Sub
 
doh. One of my coding weaknesses is not properly handling converting a empty string to a Char variable. Fixed, updated and including your VB modifications to config.ini

That's a whole lotta reserved words there... And the property value is there primarily for Delphi where property declarations within a class have a few extra reserved words, but which aren't reserved outside of that scope.
 
this thread has been continued here thread102-1316579
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top