Old 30th October 2003, 09:39   #1
dRaakje
Junior Member
 
Join Date: Oct 2003
Location: Netherlands
Posts: 23
Send a message via ICQ to dRaakje
Plugin for controlling Internet Explorer

Hi,

I've created a plugin for controlling Internet Explorer. I haven't found anything like it yet. Or anyway, that has the ability to make toolbars visible in Internet Explorer.

I know, it's a bit big (51K) but I couldn't get it to compile/link smaller

Anyway, it does the following, not much, but it can easily be expanded upon:

- Open an internet explorer instance
- Surf to an URL
- Make a toolbar visible (you need to know its CLSID)
- Close the browser.

source files included.

Remco Lam
Attached Files
File Type: zip iefunctions.zip (27.8 KB, 718 views)
dRaakje is offline   Reply With Quote
Old 30th October 2003, 12:26   #2
DrO
 
Join Date: Sep 2003
Posts: 27,873
can't look at your code at the moment but have a look at the source code for the plugin here which may be of use in showing how you can cut the dll size down

the code has a similar feature to you're plugin i guess and when i put the code in it only added 1k to 1.5k to the plugin's size (was thinking of coding a similar plugin myself but don't need to now i guess )

hope this is of some help

-daz
DrO is offline   Reply With Quote
Old 30th October 2003, 13:30   #3
dRaakje
Junior Member
 
Join Date: Oct 2003
Location: Netherlands
Posts: 23
Send a message via ICQ to dRaakje
I've downloaded and compiled that plugin and compared all the settings.

I could copy almost all settings and it still worked. All except the entrypoint, if I set that I get the following error:

libcmt.lib(crt0.obj) : error LNK2001: unresolved external symbol _main

Besides, I think most of the filesize probably comes from the my inclusion of COM pointers... (comdef.h) But if anyone manages in creating a smaller dll, I'd be very interested
dRaakje is offline   Reply With Quote
Old 30th October 2003, 16:18   #4
DrO
 
Join Date: Sep 2003
Posts: 27,873
the reason for the size is because of 'libcmt.lib' which is the c run time (crt) library. had a look and you're using things like sprintf, memset and using the default 'new' and 'delete' operators.

in my code i redefine the 'new' and 'delete' operators to not use the crt and if you put in you're own memset function and to use wsprintf(..) then that should cut things down

if you don't beat me to it i'll post a modified version for you

-daz
DrO is offline   Reply With Quote
Old 30th October 2003, 19:56   #5
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
Quote:
Make a toolbar visible
It can't be done using the registry?

And the other features:

- Open the Internet Explorer: Using the function "Wait file execution registry based" and just renaming the part that says (like) ExecWait "$..." to Exec "$...".
- Close the Internet Explorer: Have some functions in Archive for it.
- Opening an URL: Executing (i.e.) http://www.test.com using "Wait file execution registry based" (see Open the Internet Explorer).

(to get the function "Wait file execution registry based", see it in my signature)

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Old 31st October 2003, 05:42   #6
dRaakje
Junior Member
 
Join Date: Oct 2003
Location: Netherlands
Posts: 23
Send a message via ICQ to dRaakje
Quote:
Originally posted by deguix
[B]It can't be done using the registry?
It probably can, but I've looked into that, and it looks like IE stores its active toolbars in a binary registry setting. Good luck deciphering that!

And of course, you could use other functions to open IE and surf to an URL. But my point was this one can easily be extended for all sorts of functions. You can even receive IE events (although I don't know why you'd need that in an installer)

Dr0:
Much obliged if you'd post that updated version. I'm pretty goed at high level programming, but don't ask me about low level code optimizations... Although I'll certainly take a look at your code and play around with it. Always good to learn something new. Why, just this week I learned how to make an installer using NSIS

Remco
dRaakje is offline   Reply With Quote
Old 31st October 2003, 12:09   #7
DrO
 
Join Date: Sep 2003
Posts: 27,873
here's what i've done (only 4.5k now ) i have stripped some bits from the project (exdll dependancies which weren't needed) and a few other bits.

the link error was to do with the crt being included i've altered the Navigate and Toolbar functions (the Navigate definitely works but you'll need to check the toolbar one out)

for interest it is related to the _bstr_t (taken from an msdn example)
Quote:
Favorites Reader uses some of the new C++ smart pointers and new types available in Visual C++ 5.0 such as _bstr_t. These features clean up the code significantly but unfortunately they do require the C Run-time. This does increase the size of the DLL a bit.
40k is a bit (bigger than a basic nsis installer )

-daz
Attached Files
File Type: zip iefuncs.zip (30.3 KB, 610 views)
DrO is offline   Reply With Quote
Old 31st October 2003, 13:17   #8
dRaakje
Junior Member
 
Join Date: Oct 2003
Location: Netherlands
Posts: 23
Send a message via ICQ to dRaakje
Quote:
Originally posted by DrO
here's what i've done (only 4.5k now ) i have stripped some bits from the project (exdll dependancies which weren't needed) and a few other bits.
Wow! I'm impressed. As I said before, I've never really looked at how to optimize my code for size.

Unforunately, showbar doesn't work anymore...

Which is really weird, since I've stepped through the execution and the BSTR variant looks exactly the same whether I fill it using your functions or whether I use _bstr_t as a cast. (I put it back in just to test)



Remco
dRaakje is offline   Reply With Quote
Old 31st October 2003, 13:23   #9
dRaakje
Junior Member
 
Join Date: Oct 2003
Location: Netherlands
Posts: 23
Send a message via ICQ to dRaakje
Just relalized something. I think the problem is with bstr ownership.
When I do this:
vtBandGUID1.bstrVal = _bstr_t(szBarCLSID);

the _bstr_t class knows its being assigned to another BSTR and so relinguishes control over the BSTR (Or allocates a new BSTR)

When I do:
vtBandGUID2.bstrVal = bBarCLSID;

Nothing special is done and the call of ShowBandObject doesn't have access to the bstr that is being passed on.
VariantClear() afterwards isn't even necessary...

Or am I completely off track here... I have to admit, I've been bluffing my way through COM without really understanding it :P

Remco
dRaakje is offline   Reply With Quote
Old 31st October 2003, 13:31   #10
dRaakje
Junior Member
 
Join Date: Oct 2003
Location: Netherlands
Posts: 23
Send a message via ICQ to dRaakje
Well, I was right, I've solved it.

I just needed to add SysAllocString

So the call now is:
vURL.bstrVal = SysAllocString(bstrUrl);

Thanx for the downsizing help daz!

Give me sec and I'll upload a new working version
dRaakje is offline   Reply With Quote
Old 31st October 2003, 13:45   #11
dRaakje
Junior Member
 
Join Date: Oct 2003
Location: Netherlands
Posts: 23
Send a message via ICQ to dRaakje
Well, here it is. The dll is now 4.5K

Actually the bug is pretty obvious, once you see it

Again, thanks daz

Remco
Attached Files
File Type: zip iefunctions.zip (6.7 KB, 600 views)
dRaakje is offline   Reply With Quote
Old 31st October 2003, 13:52   #12
DrO
 
Join Date: Sep 2003
Posts: 27,873
just seen this has changed.

it was no problem plus a 4.5k is a lot nicer

-daz

[edit]
just checked out the new version and i see you haven't updated the text file -> still refers to a 56k file size. pointing it out in case you haven't noticed it already
[/edit]

Last edited by DrO; 31st October 2003 at 15:52.
DrO is offline   Reply With Quote
Old 3rd November 2003, 09:05   #13
dRaakje
Junior Member
 
Join Date: Oct 2003
Location: Netherlands
Posts: 23
Send a message via ICQ to dRaakje
Quote:
Originally posted by DrO

just checked out the new version and i see you haven't updated the text file -> still refers to a 56k file size. pointing it out in case you haven't noticed it already
Does this justify uploading it again? I think I'll just leave it this way. I'll change it locally in case I ever need to distrtibute it again. Thanks for the tip

<edit>
Well, I'll upload it again, I've made some changes anyway
>/edit>

Remco

Last edited by dRaakje; 3rd November 2003 at 09:42.
dRaakje is offline   Reply With Quote
Old 3rd November 2003, 09:44   #14
dRaakje
Junior Member
 
Join Date: Oct 2003
Location: Netherlands
Posts: 23
Send a message via ICQ to dRaakje
Here's a new version. The attached zip contains the 2 dll's, one real small one (3.5K) that works just fine. And a slightly bigger one (5.1K) that displays some messageboxes when an error occurs.

Of course I've also updated the included text file.

Greets

Remco
Attached Files
File Type: zip iefunctions.zip (8.4 KB, 2243 views)
dRaakje is offline   Reply With Quote
Old 5th November 2003, 19:15   #15
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
No Archive page?

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 6th November 2003, 05:31   #16
dRaakje
Junior Member
 
Join Date: Oct 2003
Location: Netherlands
Posts: 23
Send a message via ICQ to dRaakje
Quote:
Originally posted by kichik
No Archive page?
Is that something I should do? I'm still new to all this

Remco
dRaakje is offline   Reply With Quote
Old 6th November 2003, 10:12   #17
DrO
 
Join Date: Sep 2003
Posts: 27,873
archive is here

you will need to register as a user for the archive (is up at the top of the page to do that). once your registered then go down to 'contribute' (or similar worded) and follow the instructions.

as a note you should probably link to the most current version you have in this thread on the page you create.

-daz
DrO is offline   Reply With Quote
Old 6th November 2003, 10:22   #18
dRaakje
Junior Member
 
Join Date: Oct 2003
Location: Netherlands
Posts: 23
Send a message via ICQ to dRaakje
Quote:
Originally posted by DrO
as a note you should probably link to the most current version you have in this thread on the page you create.
Ah, that last one, I didn't think of that... I'd already checked the contrib part of the archive, but since I wasn't allowed to upload I didn't see the point in submitting anything

I'll make a page right away...

<EDIT>
It is done!
</EDIT>
Remco
dRaakje is offline   Reply With Quote
Old 27th June 2008, 01:48   #19
wacki
Junior Member
 
Join Date: Jun 2008
Posts: 7
I downloaded the plugin and put it in:

C:\Program Files\NSIS\Plugins

And then I tried compiling this:


outFile "installer.exe"
section
IEFunctions::OpenBrowser /NOUNLOAD
sectionEnd


only to get this error:

Invalid command: IEFunctions::OpenBrowser
Error in script "C:\Documents and Settings\jnowacki\Desktop\NSIS\link.nsi" on line 7 -- aborting creation process


Suggestions?
wacki is offline   Reply With Quote
Old 27th June 2008, 15:01   #20
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Make sure you put IEFunctions.dll not IEFunctionsDbg.dll in there. Also what are you doing exactly? If you want to just open a web page, just use ExecShell open `http://...`

Stu
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump