[RESOLVED] Laoding commaon Dialog at run time
I recently read an rticle on mvps.org where the author created a progreesbar control at runtime without including the mscommcontrols activex control.
This can be quite helpful if we want to reduce the distribution size.
So i was wondering if its possible to load a commondialog object too at runtime in a similar way.
heres the link to the mvps site
http://btmtz.mvps.org/progressbar/
Can someone point to threads where this has been discussed before or to other online resources.
thanks
1 Attachment(s)
Re: Loading common Dialog at run time
many people have made class modules to add into your projects to replace an ocx, here is an old one that i found awhile back. there are newer and more advanced, this only includes the open and save dialogs. you just add it to your project and set it up as you would any class module. it uses api to open and save.
Re: Laoding commaon Dialog at run time
What you are refereing to can be done but the control still has to exist on the destination machine. So it has to have been deployed in some way. Using this method is very dangerous since you are counting on the controls being already having been installed. Not a bright idea. The best idea is to always deploy everything you need for your app to work. NO EXCEPTIONS...
Re: Laoding commaon Dialog at run time
but i think comdlg32.dll exists on any windows system,the only difference being the file versions( which matter the most).So i think the above class file should work.
Randem ,what u said is perfectly right .I just want to reduce my setup file by 150kb(the size of the comdlg32.ocx).So i asked
Re: Laoding commaon Dialog at run time
Depending on what you used to gather the dependencies... You may not even be deploying enough files and possibly some unsafe ones. You may need to deploy some SP's instead of just one dll, etc.... It is more likely that your deployment package will grow than shrink when it's done correctly.
Remember: Using less nails to build your house may get the job done but would you really want to live in it.
Re: Laoding commaon Dialog at run time
Quote:
Originally Posted by randem
What you are refereing to can be done but the control still has to exist on the destination machine.
Not for a common dialog, they are a part of the OS. The COM control is just a wrapper for the same API functions you can call yourself. Joacim Andersson has an ancient but good class wrapper for several common dialogs in the Codebank.
Re: Laoding commaon Dialog at run time
Quote:
Originally Posted by penagate
Not for a common dialog,
Then it still has to exist... Doesn't it???? Not all controls exist. That one happens to exist... It still doesn't change anything...
Re: Laoding commaon Dialog at run time
Yeah, it exists in a DLL (comdlg32.dll) that is part of all Windows distributions. Almost all applications use a form of the common dialog and only those written in VB use the .ocx control. If you write an application in C++ (ignoring MFC) it is easier just to call the API functions directly. The control just makes life easier for VB developers.
KB 161286.
Re: Laoding commaon Dialog at run time
Also what happens if an old version is on the target system and his app needs the newer one????
Re: Laoding commaon Dialog at run time
There is no "newer" one. The control simply wraps what is on the system already.
I agree you're completely correct when referring to controls that actually offer their own functionality, but this doesn't.
Re: Laoding commaon Dialog at run time
Re: Laoding commaon Dialog at run time
ohh thanks penagate and randem for that wonderful discussion .The reasion i asked for is because my original app is just 150 kb in size but because i'm using a cdlg and a scroll bar ,my distribution size has crossed 2mb for no reason(1 mb for mscommcontrol and 150 for this one).
I found the one for progress bar before itself and now i found one for this too.Thanks penagate and joacim(for his amazing class).
Randem, your arguments were really insightful, will keep them in mind before releasing the distributables.