Solved

Small Footprint

Posted on 2002-04-19
4
149 Views
Last Modified: 2010-05-02
I'm creating a simple tray icon prg and want it to use as little of ram as possible.  What can i do to acheive this?

Does creating and killing everything on the form (text boxes, labels, ect) with code decrease the imprint vs setting it up visually?

Thx,
geo
0
Comment
Question by:geo90
  • 2
4 Comments
 
LVL 17

Accepted Solution

by:
inthedark earned 100 total points
Comment Utility
Best thing for SysTray apps is C++ as you can create an app. which depends on nothing else.

The problem with VB Systray Apps is when the users loads another VB app, you may get a DLL in use message.

You can load  VB objects, like text boxes, on the fly but it won't make any difference.

You can also create a formless VB app using Sub Main().  Using Windows API calls you can Regeister a callback to receive Windows messages.  You can define and created Windows API objects using WinAPI type declarations.  But your app will still utilise the VB runtime DLL.

Your best course of action is to Start up C++ and use the application wizard to create a "Hello World" application based on Windows API. You can then see what is required for a minimal app.  Once you understand what is going on you can create the App in VB using the same process handling. But once you understand what is going on you will create you systray in C++ and make it either launch VB exe apps. or create VB ActiveX DLL objects.

If you posted this question on the C++ section you may even get some code that you will just need to insert the name of your VB Activex progID to make it work.
0
 
LVL 8

Expert Comment

by:glass_cookie
Comment Utility
Hi!

> "Does creating and killing everything on the form (text boxes, labels, ect) with code decrease the imprint
vs setting it up visually?"

Regarding this, VB uses about 1KB of memory for each label, a little more than 1KB of memory for picture boxes, and for the pictures, it takes up the same memory as the size of the picture file (ie. 1 500KB picture uses 500KB of memory).

Thus, there's definitely a trade off between the display and memory usage.

Thus, using as little controls and pictures s possible would help decrease memory usage of your program.

That's it!

glass cookie : )
0
 
LVL 5

Expert Comment

by:gwgaw
Comment Utility
Like inthedark says C++ is the best for systray apps and, whether you use C++ or VB, your systray app
should do nothing more than sit in the tray and launch another VB app or what ever. Your tray app
should have no controls other than a menu.

'The problem with VB Systray Apps is when the users loads another VB app, you may get a DLL in use message.'

I've been using VB for systray apps since VB4 and never got a dll in use message regardless of how
many VB apps were running.
0
 
LVL 17

Expert Comment

by:inthedark
Comment Utility
gwgaw I hope you are right but dosen't it depend on what your systray app is doing?


0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now