Connecting Tech Pros Worldwide Forums | Help | Site Map

Ok, an extreme and humble peon requests unworthy aid in writing code for ShellExecute

Newbie
 
Join Date: Oct 2009
Posts: 1
#1: Oct 14 '09
I am completely and totally new to VB so any dumbing down and/or condescension is welcome and expected.

I have been charged with the task of creating a prompt window within a folder on our network that when said folder is double clicked or "open" is selected, it will pop up and request that the user open the readme.doc.

The user can then A) skip this option, B) read the file, and C) opt to not see this window again.

Based on the code below...how much work and specifically (oh good god, SPECIFICALLY) what code needs to be present in the form to accomplish ANY of the above?

Expand|Select|Wrap|Line Numbers
  1. Private Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" _
  2.   (ByVal hwnd As Long, _
  3.    ByVal lpOperation As String, _
  4.    ByVal lpFile As String, _
  5.    ByVal lpParameters As String, _
  6.    ByVal lpDirectory As String, _
  7.    ByVal nShowCmd As Long) As Long
  8.  
  9. Private Sub CommandButton1_Click()
  10.     ShellExecute "O:\Operations\ALLGROUPS\Shutdown Planning\Shutdown Maintenance Main Menu Screen Folder Structure HowTo.docx"
  11. End Sub
  12.  
  13. Private Sub CommandButton2_Click()
  14.     End
  15. End Sub
  16.  
And this is all literal....there is no intention of leaving anything out. So if any of the above is "dummy code" please help.

Dököll's Avatar
Moderator
 
Join Date: Nov 2006
Location: Upstate NY - US
Posts: 2,268
#2: 2 Weeks Ago

re: Ok, an extreme and humble peon requests unworthy aid in writing code for ShellExecute


Don't despair, newbess... you'll get it working! Thanks for posting part of your code.

Stay tuned for an expert!
Newbie
 
Join Date: Oct 2009
Posts: 31
#3: 2 Weeks Ago

re: Ok, an extreme and humble peon requests unworthy aid in writing code for ShellExecute


Okay, so you want to watch a directory, A directory on the server, and if it is opened (browsed by the user), then you want a dialog to come up with three options...

Okay watching a folder is possible...(See post by strongm...)

http://www.tek-tips.com/viewthread.cfm?qid=1568282

Now while the above if for watching changes to files, I think you can use it for watching the folder in question...

Then, more than likely you will need install this program on all the clients and run it as a service....

http://www.tek-tips.com/viewthread.cfm?qid=1471648

or if you don't want to install a vb program as a service, you may want it to run at startup and for such see...

http://www.tek-tips.com/viewthread.cfm?qid=1552522
http://www.tek-tips.com/viewthread.cfm?qid=930847



Good Luck
Reply