News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

BHO to search local HTML files

Started by sba4rmbm, June 07, 2005, 04:00:59 PM

Previous topic - Next topic

sba4rmbm


How would we go about writing a Browser Helper Object for MSIE that would look something like the google search bar, but would search HTML files on the local drive, and then serve up HTML pages of links to the files with short quotes from them with links to the full HTML files.  (Yes, searching local files and generating HTML is trivial, but writing a BHO is not, for me at least.)

On the face of it, this sounds perhaps overly specific, but I think that the question actually has great general application, especially for exotic languages with fancy formated text (that is, the usual RichEdit display is much less rich than the MSIE's display of languages such as Arabic, Hebrew, and Farsi written jusitifed and right to left, for example), and one hardly wants to write a display mechanism like MSIE's from scratch in MASM32.


chep

Instead of writing a BHO, wouldn't it be simpler to integrate MSIE's ActiveX in your own application ?

It has also the advantage that you could easily switch to the Mozilla Firefox engine (at compile time or even at runtime if this is done correctly), as someone already made an ActiveX implementing the basic functionnalities of MSIE ActiveX for the Firefox engine.

Just my 2 cents...

sba4rmbm

That might be easier, but I don't know how to do that, either.  How would that be done?

In any event, FireFox's rendering engine is broken for the languages that interest me, and justified text of these RTL languages is simply UNREADABLE!


sluggy

You really do not want to be doing this in asm until you really know what you are doing. Your app will be COM based, it will have to implement certain interfaces (check the IE SDK), and then you need to "install" it in the registry, which means registering all the classes it implements and then inserting a GUID in another spot in the registry so IE knows to start up your BHO. BHOs are also active any time you have IE or windows file explorer open, or if you have active desktop enabled. Because of this, a BHO may be overkill for what you want to do.
There is actually no reason why you can't just scan for your files, generate an HTML page, then use ShellExecute to open it in the default browser, this means it will also work in all browsers.

sba4rmbm


I would not have asked the question if I really did not want a BHO for MSIE. And  I have been writing ASM since 1960 and know no other language (never managed to get into any higher level language like C or C++).  I have written programs that search and load the default browser, which is trivial, of course.

But there are problems in this:

what if the default browser is not IE (as it is on my system and many others), and it could even be the crippled FireFox that cannot display my RTL pages readably.

what if one wants to run more than one instance, searching for different things or in different places at the same time (I often have several copies of MSIE with the Google search bar doing different searches).

is the opened default browser (if MSIE) going to be an existing window or a new window (and one new window after another!).  If one uses an existing window, it is possible that the user will resent that (this often happens to me!); and if one uses a new window for each search, one can get a messy bunch of browsers going.

There is, then, a distinct advantage of having a BHO in any MSIE instance (or instances) that one wants (and it can be turned on and off like the Google searchbar).

It is clearly harder to program a BHO, but easier for the user to use, in my opinion.  Why not program more and give a better user experience?  (My other programs are already in use by thousands of people all over the world for many years, and they have been slowly and carefully made, not just quickly thrown together to get something that does  half of what I wanted to do.)

If this Forum has no one who can help, I guess I can do a BHO on my own, but with more difficulty.  Hoped to find help here, though.


sluggy

sba,
there are certainly people in this forum who can help you. And nobody was questioning your asm programming skills. All i did was point out that your app will have to be COM based, and that is not the prettiest of things to do in asm.

As for your info, check my post in this thread.

sba4rmbm


I take it that you think that if we work through the com info in masm32 and those 3 MSDN links, it should be possible to work this out?

Thank you very much!  I'll give it a try and ask permission to come back when stuck.  That is what I came here for!   :U

And I see from the other thread that I am not alone in my interest in a BHO using MASM32.


Robert Collins

Quote from: sluggy on June 08, 2005, 09:34:16 AM
.....BHOs are also active any time you have IE or windows file explorer open.......

You can put code in the DLLMain to bypass windows explorer so that your BHO will only be launched when IE is launched.

In 'C' it would look like this:

BOOL APIENTRY DllMain(HINSTANCE hInstance, DWORD  dwReason, LPVOID lpReserved)
{
  if(dwReason == DLL_PROCESS_ATTACH)
  {
    TCHAR pszLoader[MAX_PATH];                         
   
    GetModuleFileName(NULL, pszLoader, MAX_PATH);       

    _tcslwr(pszLoader);                                 

    if(_tcsstr(pszLoader, _T("explorer.exe")))         
      return FALSE;                                   
    else                                               
      :
      :  // Add your code here to continue with this BHO for IE
      :
  }
  else if(dwReason == DLL_PROCESS_DETACH)
    :
    :
    :

  return TRUE;   
}


And I agree with sluggy, writing a BHO COM DLL is not a practical task in Assembly. Better do it in 'C' using ATL if you can. After you become quite experienced in COM programming and know the correct functions to use for IE then try your skills at it in Assembly.