Sign in to follow this  
Followers 0
LonPete67

ShellExecute memory leak?

5 posts in this topic

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

Share this post


Link to post
Share on other sites



Why don't you create a test case with a fake vbscript ?

Also, there are other ways to launch/run.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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 :)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0