Re: Adding an item to R-Click context menu

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Randy Birch (rgb_removethis_at_mvps.org)
Date: 09/02/04


Date: Wed, 1 Sep 2004 22:20:04 -0400


aw, what the heck ..

-- 
Randy Birch
MVP Visual Basic
http://vbnet.mvps.org/
Please respond only to the newsgroups so all can benefit.
"Randy Birch" <rgb_removethis@mvps.org> wrote in message 
news:eMcs4JJkEHA.2908@TK2MSFTNGP10.phx.gbl...
: For the simple example, this is the entire code ...
:
: Private Sub Main()
:
:   Shell "rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,1",
: vbNormalFocus
:
: End Sub
:
: Done. Fini.
:
: As long as you remove the default form (select in project explorer, right
: click, remove, don't save changes) and set project>properties>startup to 
Sub
: Main in your newly-added BAS module you're in business.
:
: -- 
:
: Randy Birch
: MVP Visual Basic
: http://vbnet.mvps.org/
: Please respond only to the newsgroups so all can benefit.
:
:
: "LuckyStrike" <LS@smokedamagedfurniture.youcandriveitawaytoday.com> wrote 
in
: message news:OMepGDJkEHA.2680@TK2MSFTNGP15.phx.gbl...
:: Aha! See? I knew it would be complex... more than you initially let on.
:: <vbg> OK Randy, it's going to take me a while to translate that into a
:: language I can understand (English. hehe). You've put a lot of effort 
into
:: explaining it to me. Inasmuch as I haven't really got a clue, it's going
: to
:: take me a lot longer than the time it took you compiling it for me to
:: understand it. I will return as soon as I *Think* that I may have an
:: inkling... <vbs>
::
:: Now, what do I need to start a VB project? You mean to put that command
: into
:: WordPad and saving it as an executable I think. Oh .... I am lost. I
: better
:: take some time to read that which you've written before looking 
completely
:: dumb. (I'm ashamed to admit that I'm inept in this field.)
::
:: Thanks anyway,
:: -- 
::
:: LuckyStrike
:: LS@smokedamagedfurniture.youcandriveitawaytoday.com
::
:: How to make a good newsgroup post:
:: http://www.dts-l.org/goodpost.htm
:: ------------------------------------------------------------
:: "Randy Birch" <rgb_removethis@mvps.org> wrote in message
:: news:%2355LH6IkEHA.3348@TK2MSFTNGP12.phx.gbl...
:: > Yea, that first link is pretty well all you need. Start a new VB
: project,
:: > remove the form, add a bas module, open the bas module in code view, go
: to
:: > tools > add procedure and add a new sub and name it Main (important),
: then
:: > past into Sub Main (all on one line)
:: >
:: > Shell "rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,1",
:: > vbNormalFocus
:: >
:: > That's it.  Run the app (Run > start with full compile) and the control
:: > panel should open to the security page (1=security, 0=general, etc).
: Then
:: > just make an exe (File > make exe), and be sure to set the startup
: object
:: as
:: > Sub Main, and save the exe wherever (I use a \windows\utils folder for
:: stuff
:: > like this), and create a shortcut to the exe and place it on your
: desktop.
:: > Done.  Double clicking will execute Sub Main, which will launch the
:: control
:: > panel applet. If you want to assign your own icon you could add a
: resource
:: > file, or a form with the icon assigned to the Icon property and set 
that
:: > icon in the make exe dialog.
:: >
:: > If you want to go further -- place an icon in the systray and on
: clicking
:: it
:: > show the panel -- the concept is the same but you'd require a form in
: the
:: > app as well as the bas module (it can remain hidden) in order to 
receive
:: the
:: > mouse events over the systray icon -- see the subclassing section on my
:: site
:: > for the minimal code to place an icon in the systray
:: > (http://vbnet.mvps.org/code/subclass/shellnotifybasic.htm).
:: >
:: > The changes you would make to the app is (and I'm going of the top of 
my
:: > head here ...):
:: >
:: > - in Sub Main call the code to Load Form1, but don't show it (eg no
: Form1
:: > show)
:: > - move the Shell code to a new procedure in the bas module, Private Sub
:: > ShowPanel
:: > - in the load event of the form call the routine that adds the icon to
: the
:: > systray
:: > - in the form unload event, call the routine that removes the icon
:: > - in the bas module's WindowProc subclassing routine, where the mouse
:: click
:: > code is use:
:: >   Call ShowPanel
:: >   ... rather than the menu code that's in the site demo
:: >
:: > When you make the app keep Sub Main as the startup object - it's only
: code
:: > would be:
:: >
:: >   Load Form1
:: >
:: > Form1's only code would be:
:: >
:: > Private Sub Form_Load()
:: >    If ShellTrayAdd = 1 Then
:: >       SubClass Form1.hwnd
:: >    End If
:: > End Sub
:: >
:: > Private Sub Form_Unload(Cancel As Integer)
:: >    ShellTrayRemove
:: >    UnSubClass
:: > End Sub
:: >
:: > ... plus the ShellTrayAdd and ShellTrayRemove routines.
:: >
:: > The code change in WindowProc would be
:: >
:: >   Call ShowPanel
:: >
:: > instead of
:: >
:: >    Form1.PopupMenu .zmnuDemo
:: >
:: > I suggest - if you want to go the systray route - you first construct
: the
:: > site demo exactly as it is shown, then once you get the hang of what's
:: going
:: > on you can start to make changes.  This is a 10 minute app once you've
: got
:: > the basics down.
:: >
:: > The only thing (with the subclassed demo) that you **have** to pay
:: attention
:: > to is:
:: >
:: >  - in the WindowProc routine ensure all Form1 references are changed to
:: the
:: > name you decide to use for the your form
:: >
:: > - **always** use start with full compile to run the app -- this will
: catch
:: > errors before you run into them executing the app.  Subclassed apps die
:: > horrible deaths when an error occurs while the subclassing is active!
:: >
:: > -- 
:: >
:: > Randy Birch
:: > MVP Visual Basic
:: > http://vbnet.mvps.org/
:: > Please respond only to the newsgroups so all can benefit.
:: >
:: >
:: > "LuckyStrike" wrote in
:: > message news:%23GO1QhIkEHA.2696@TK2MSFTNGP10.phx.gbl...
:: > : Hi Randy,
:: > :
:: > : Well, you make it sound so simple. Of course as simple as it is, it
:: isn't
:: > as
:: > : simple as I am. <g> The only script I've ever done was in Outlook2002
: to
:: > : make an AVG antivirus scan button. So, as you can see, my skills - if
:: you
:: > : want to call 'em that -  are less than adequate to fully understand
: the
:: > : means by which to implement that which you've offered.
:: > :
:: > : So, if I may ask, would I need to install or use something like this
: to
:: > : accomplish that which I seek to do?
:: > : http://www.mvps.org/vb/index2.html?tips/shellcpl.htm
:: > : http://www.mvps.org/vb/samples.htm#Shell32
:: > :
:: > : Please be so kind as to excuse my ignorance in such matters.
:: > :
:: > : Thanks again,
:: > : -- 
:: > : LuckyStrike
:: > : ------------------------------------------------------------
:: > : "Randy Birch" <rgb_removethis@mvps.org> wrote in message
:: > : news:%23aIedvHkEHA.2140@TK2MSFTNGP15.phx.gbl...
:: > : > How about making a tiny VB exe on your desktop or system tray that
:: > simply
:: > : > executes:
:: > : >
:: > : > Shell "rundll32.exe shell32.dll,Control_RunDLL inetcpl.cpl,,1",
:: > : > vbNormalFocus
:: > : >
:: > : > -- 
:: > : >
:: > : > Randy Birch
:: > : > MVP Visual Basic
:: > : > http://vbnet.mvps.org/
:: > : > Please respond only to the newsgroups so all can benefit.
:: > : >
:: > : >
:: > : > "LuckyStrike" wrote in
:: > : > message news:uc%23RIjHkEHA.1040@TK2MSFTNGP10.phx.gbl...
:: > : <snipped>
:: > : > :
:: > : > : OS: W98se/IE6-SP-1 fully patched.
:: > : > :
:: > : > : Is it possible to add (a pointer to) the *Security Tab* from IE
:: > Options
:: > : to
:: > : > : the R-Click context menu? I am surfing with Active Scripting
:: disabled
:: > : 99%
:: > : > of
:: > : > : the time. It is a hassle when having to enable active scripting
: even
:: > : > though
:: > : > : I have made a IE Options shortcut on the Quick Launch Toolbar. It
:: > still
:: > : > : involves a few motions and clicks too many as far as I am
: concerned.
:: > : > :
:: > : <snipped>
:: > : > :
:: > : > : Thanks,  LuckyStrike
:: > : > : ------------------------------------------------------------
::
::
: 





Quantcast