Look up the Shell command in VBHelp or do a search on this forum
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'People who live in windowed environments shouldn't cast pointers.'
johnwm cc. CCLINT, correct answer - but gives you very little credit - Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
I have posted this in another thread, but i think it is relevent here aswell...
While using the shell function, make sure u have the right number of "/" s in the file path...
For example, the filepath "C:\windows\pp.exe" will work fine, but if App.path is "C:\, you can see there is already a "/" at the end.. so, App.path & "\.." will show an error.. u have to check for that too..
To reproduce the error, copy the file to root, and try it.
Use this to solve the error
'=============================================
If Mid(App.Path, Len(App.Path), 1) = "\" Then
FileName = App.Path & "MyApp.exe"
Else
FileName = App.Path & "\MyApp.exe"
End If
Shell (Filename,vbnormalfocus)
'============================================= All the Best
Praveen Menon
pcmin@rediffmail.com
The ShellExecute function opens or prints a specified file. The file can be an executable file or a document file.
Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Jyotiraditya Rath
Hi All,
My program creats a log file, the application is executed without any user interaction.
As soon as the application ends, i want to open teh log file in notepad. How will i do this. Please help me in this.
sunaj
Thank you for the comment
I feel that in a forum for professional programmers there should be some expectation of self-help for simple and straighforward procedures.
Although it's occasionally necessary to post code snippets to illustrate a particular point, I don't think it's particularly helpful in the long term to spoon feed and it's more useful to encourage people to do their own learning.
They may not be aware of the existence of (for instance) the Shell command and therefore I have no problem with pointing them in that direction, but it's a very simple command, well documented in VBHelp and in this forum, and I see no point in posting great wodges of code for this sort of example
In overview, I participate in this forum to help people to improve their programming skills, their research skills and self-development, not to re-type the contents of VBHelp pages!
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'People who live in windowed environments shouldn't cast pointers.'
sunaj, johnwm, so, let's show ** otherwise [/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
Thanks CCLINT - hugs and kisses all round - after posting my reply I read thread222-423469 - and smiled gently
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'People who live in windowed environments shouldn't cast pointers.'
I think there is a misconception in the post that u people have made. It definitely is a good idea to improve the research skills and knowledge of people, but i think a big percentage of people availing the services of tek-tips have a problem, that they need to solve, as early as they could. We as programmers have definitely been in similar situations, more than once, when the dead line is near, and we still have a big problem with us. I presume this is the point when summone decides to go for expert help, or try to get tips from people who have experience in coding similar kind of stuff. I said majority... may be there are people who are lazy and wants work to be done with lesser effort. But as a person, i would like to be with the majority, who are in real need of help. This is because, i have been in similar situations, where the client is waiting to accept the Setup CDs, and i've discovered a new bug, or a possiblity of a new bug in my application. At this point, when someone issues me with some ready to use code, i'll be more than happy to use it, and will definitely try to learn from it also. So my point is, if someone is looking for some help, let us give them the maximum help that we can provide them with, and lets hope someone will learn from it as well.. All the Best
Praveen Menon
pcmin@rediffmail.com
It is also a matter of helping your self....first, with simple tools at hand.
Problem being, some do not know how to use the available tools to help themselves....or are just too lazy.
To the first part, johnwm was just trying to do just that.
Not only that, but johnwm always has a reference to a FAQ in the footnote, saying just what to do first.
This forum is cluttered with repeated and easy-to-find threads on a certain subject.
Take this thread for instance.
Just doing a keyword search using "start notepad program" and the "all words" option reveals several threads and several of them have the answer.
Doing a keyword search on "Shell Notepad" brings even better results. The very first thread listed shows the answer.
And guess what? I would have had an answer alot faster than starting a new thread....and waiting for a response.
Using the keyword "Shell" which was also supplied by johnwm, typed in the VB IDE and pressing F1 brings up the exact syntax with optional parameters and an easily understood example.
Granted, there are times when each of us have posted answers instead of directing the questioner to another thread.
If we feel that the answers in Help or other threads are not clear enough, then more explaination or detailed/better written code may be needed.
But not all of us have the time to do the searching ourselves to see if the answer exists.
When we know that threads with good answers exist, then a direction to search can be made.
When we know that a clear answer is easily revealed using F1 in the VB IDE, then a reference can be made to that. Those are sufficient answers. [/b][/i][/u]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
PraveenMenon, this discussion keeps comming back...
I agree 100% with you - BUT I do not agree that a 'finished and ready to use code' is a better help than a 'look up this function in the help'
By looking up the function/do a search in this forum/search google the person will have a better chance of answering his next question using the same methods - It just like going to school - you have to learn how to figure things out yourself.
Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
I find nothing wrong with posting snippets of code to help someone out. For one, the VB help system isn't very good, and two, it's giving them a model to work by, not THE answer. I don't think a person is violating any code(put not intended) of conduct in here by helping to point someone in the right direction.
Thanks to everyone but John. I was going to get obnoxious but I just don't think it benefits anyone. John since you are so easily irritated feel free not to answer any of my posts.
I think some people got bent out of shape over NOTHING. John I take an issue with you went overboard by saying that someone giving a code snippet as a reply is spoon feeding. I can't recall once having someone complain to me about a code reply. As long as it helps the person out, that's what matters. Usually I find that you have varying skill levels in the forums and NO ONE is a programming genius here. However, I do think John and the others had a valid point of checking the faq's or doing a search before asking a question in the forum. It's useless for people to get mad at each other about something insignificant as this. A lot of the replies in here were by skilled programmers and I respect your abilities. Just different people are going to have different ways of answering the questions here. Let's all be friends on here.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.