LonPete67 Posted May 27, 2009 Share Posted May 27, 2009 I've written a very simple program that detects when a user locks/unlocks their PC and fires off a VBScript (with a parameter) via the ShellExecute method. It works very well except I've noticed that every time I fire the ShellExecute command I loose memory. The first time about 3Mb and then about 50k thereafter. I've recompiled the program without using ShellExecute (not much use but it proved a point) and memory usage was solid. Wouldn't be a problem but some of our customers won't restart or logoff their PCs for weeks at a time. Before anybody suggests it, I can't put the code in the VBScript in to the complied application for "political" reason Many thanks, Pete Link to comment Share on other sites More sharing options...
Inverted Posted May 27, 2009 Share Posted May 27, 2009 Why don't you create a test case with a fake vbscript ? Also, there are other ways to launch/run. Link to comment Share on other sites More sharing options...
LonPete67 Posted May 27, 2009 Author Share Posted May 27, 2009 I've tried ShellExecute with a blank VBScript and notepad with the same result. I thought ShellExecute was the only way to launch an application with a parameter. I'm new to this, what are the other methods? Link to comment Share on other sites More sharing options...
Inverted Posted May 27, 2009 Share Posted May 27, 2009 You can pass parameters to the Run function after the filename. Try this : Run ("notepad.exe c:\whatever.txt") I don't know if it's just a wrapper for the ShellExecute API Link to comment Share on other sites More sharing options...
LonPete67 Posted May 27, 2009 Author Share Posted May 27, 2009 That is hugely better!! Not perfect, but such an improvement that I don't think it'll cause a problem. I also tried complying with the beta version and that also helped a bit. Thanks for your help. P. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now