VB6 - Installer program for Process Explorer-VBForums
Results 1 to 16 of 16

Thread: VB6 - Installer program for Process Explorer

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Aug 2008
    Location
    Between the keyboard and the chair.
    Posts
    122

    VB6 - Installer program for Process Explorer

    Hello VBForums!
    I have seen some very awesome works posted on this forum, and hope to add to as well as learn from what has been posted here.

    Getting to the subject at hand, I have created a small installer for Sysinternals' Process Explorer, which can be found at www.sysinternals.com. A very useful techspert tool, but usable by the average joe, that takes the taskmanager to new levels.
    I felt that a quick oneclick installer would be nice, one that sets PE as the
    default task manager, as well as installing the files to the Windows directory, as WELL as providing an autostart-as-minimized option, and this is the result of my work.

    As I am not a complete newb to programming itself (I have worked with QBasic before, as well as programmed in UnrealScript for the game DeusEx), but new to the symantics of VB6, I know my code could use some tips, tweaks, and tuneups, as i consider myself a fairly sloppy coder.

    Therefore, I submit my code on this installer to those who know better than I, hoping to get a shred more of guidelines, errortrapping, logics, et cetera.

    A few notes about this download...
    -The res file DOES contain 2 files: the main EXE, as well as the helpfile. If you do not trust my package, download the ProcessExplorer package from Sysinternals' Site, and create your own.
    -Due to the size of the download, due to the embedded resource file, this download is hosted at rapidshare. I can also MSN or email the file, if Rapidshare is a problem for some users.
    -You -MAY- use any of this code in any application you design, without asking, provided you mention me (EntityReborn) as the (partial) source, in one form or another. This goes for any code I post at anytime, anywhere, unless otherwise stated (in which case, exceptions could possibly be made).
    -All code is 99% my own.

    Feel free to rip this source to shreds. For the count, I am currently not prepared to launch into VB.NET, so please keep it to VB6.

    Source Link: Click Here
    -Link removed as I have deleted the file.
    Last edited by EntityReborn; Sep 9th, 2008 at 10:32 PM.

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    37,230

    Re: VB6 - Installer program for Process Explorer

    This post contains several links, all of which are to articles in our Classic VB FAQs (in the FAQ forum, which is shown near the top of our home page)


    In most cases you have used the default name for your controls, rather than something more specific and obvious - which means that you have to go back and forth between the form and the code to find out what they are - it's not a massive issue in a project of this size, but even so does mean you are wasting effort.

    For example, rather than "Command1" I would use "cmdInstall", and rather than "FilesStatus" I would use "lblFilesStatus".



    In the form you have consts for HKEY_CURRENT_USER etc, but I would recommend putting them in the module instead (and making them Public), as that is what use the values - the module is no use without them, and the form has no use for them except when calling the routines in the module.

    ..even better, also change them from separate Const's to an Enum, so that when you write code to use the routines the values will be automatically listed for you.


    Take a look at What is wrong with using "On Error Resume Next"?, which applies here, and links to an explanation of the method you should be using instead.

    edit: now I've seen you attempted to use the proper method in the Install routine, but made some mistakes that the FAQ article should help with.
    Note that the line If (Err = 70) Then will never be any use, as Err will only have a value in the error handler.


    You have lots of repetition of long strings for the registry paths (for example, "Software\Microsoft\Windows\CurrentVersion\Run" is used 8 times), and arguably should be using Consts for them instead, as it will make the code easier to read. I would do that one like this:
    Code:
    cRegStartup = "Software\Microsoft\Windows\CurrentVersion\Run"
    ..which among other things would allow you to reduce this long line:
    Code:
    AutoStartupAll = GetSZValue(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", "ProcExplorer")
    to this:
    Code:
    AutoStartupAll = GetSZValue(HKEY_LOCAL_MACHINE, cRegStartup, "ProcExplorer")
    You aren't closing the program in a good way... see Why is using the 'End' statement (or VB's "stop" button) a bad idea? and How should I close my form/program/class?


    Your program will not work at all on many computers (but those with Windows XP or Vista should be fine), and could well have bugs on others. You should consider using some kind of installation.


    There might be other things too, but I think this will be enough to keep you busy for a while! (or scare you off! )

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Aug 2008
    Location
    Between the keyboard and the chair.
    Posts
    122

    Re: VB6 - Installer program for Process Explorer

    Heh, I doubt you could scare me off for these problems.
    In reguards to the labelling scheme, you are by all means correct. The main reason I didn't change the current default labels was due to just wanting to get the main framework up and running, then do troubleshooting and tweaks later, when I have a more refined idea of how it will all turn out. I'll change that now.

    Also did the constant to enum as well as moved it to the Registry Module.

    Ok, Error handling. I have always lacked in this area, so I WILL ask for advice in this area. I suppose I could just insert a 'on error goto functionname_err' and have that label have a msgbox stating some information about the error, until I can develop a more intelligent errorhandling system. (Side note, does VB have a errorline variable?) Ill put this onto the todo list.

    Registry entry shrinkage. Sounds good, and I was going to say that Ill expand on it by enum'ing it as well, but couldn't do a 'valuename = "stringvalue"' inside of an enum. Oh well :P

    Ive switched all (1) End commands to Unload Me.

    As for an installer for an installer... well, kind of ironic don't you think? As far as I know, the Process Explorer will only replace the taskmanager in any windows NT version (NT/2000 and up), due to the regkey used being under Windows NT. I COULD be wrong, so don't quote me on that, as 95/98/ME could have an equivalent. Another point, is I do believe the APIs Im using are available on all NT platforms. Once again, could be wrong.

    For the most part, I've read most of the articles you have posted, I just hadn't thought of implementing the info there. Thank you for your info! I really appreciate all this forum has to offer, and I do eagerly await the ability to help others, as well as recieve more help :P.

    One side note: It seems to me that all new threads are Mod reviewed before arriving on the scene... am I correct? If so, I looked as soon as my thread didn't show, and I found no note or post indicating this, thus my attempt to repost, thinking the forum had burped. :S

    Notes:
    -Added function to kill running Process Explorer processes before Uninstalling.
    -Added Common Controls support (XP style windows)

    New source package:
    Click Here
    -Once again, Removed
    Last edited by EntityReborn; Sep 9th, 2008 at 10:35 PM.

  4. #4
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    37,230

    Re: VB6 - Installer program for Process Explorer

    Quote Originally Posted by EntityReborn
    In reguards to the labelling scheme, you are by all means correct. The main reason I didn't change the current default labels was due to just wanting to get the main framework up and running, ...
    I can understand that, but the way I see it you can rename a new control in a few seconds - and by having a 'proper' name (even if it needs to be changed again later) you tend to save more time than you spent.

    For example, if you are writing code to interact with a label you could type lbl and press Ctrl-Space to see an auto-complete list of all your label controls - and select the relevant name quicker than you could type it (and without having to think "was it label6 or label7?").
    Also did the constant to enum as well as moved it to the Registry Module.

    Ive switched all (1) End commands to Unload Me.
    Good stuff.
    Registry entry shrinkage. Sounds good, and I was going to say that Ill expand on it by enum'ing it as well, but couldn't do a 'valuename = "stringvalue"' inside of an enum. Oh well :P
    Yeah that's annoying, it would be nice to be able to group them easily, but Consts are a reasonable method.

    An decent way to group them would be to use a Collection, but that would require extra code (in Form_Load and Form_UnLoad) and the code to use them would be slower.

    Another way would be arrays, but that again takes extra code, and would make the code hard to read unless you also use an Enum to specify elements.
    As for an installer for an installer... well, kind of ironic don't you think? ...
    Indeed!

    You should check what OS's are supported, by Process Explorer (should be explained on the download page, etc), and by the API's you are using (official documentation - designed for C programmers, so the code samples are hard to read but the rest is OK).

    If they all support Win2000 and earlier, and you want to allow that, you will need to make an installation package to be sure your program will work (or just hope that they already have VB6 programs installed).

    The alternative would be to not use a VB6 program at all - but instead create an installation package using one of the programs designed for that purpose (there are links to downloads and documentation in our Application Deployment FAQ). Several of them allow scripting of some kind, but generally not as easy/powerful as VB.
    One side note: It seems to me that all new threads are Mod reviewed before arriving on the scene... am I correct?
    Sort of... it happens for your first few posts (if decided by our automated anti-spam system), and you are past that now.

    It also always happens in the sub-forums that are set up that way - here it is just the FAQ forum, which we want to keep "clean" due to how often those threads are read and the purpose of them (giving answer(s) as clearly as possible, rather than lots of discussion etc).
    Ok, Error handling. I have always lacked in this area, so I WILL ask for advice in this area. ...
    I'll have a look at your current code later (I'm not thinking clearly enough at the moment!), and give advice after that.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Aug 2008
    Location
    Between the keyboard and the chair.
    Posts
    122

    Re: VB6 - Installer program for Process Explorer

    As for OS, PE itself works on 2000 SP4R1 and up, and as for the APIs, API-Guide says "Requires Windows NT 3.1 or later; Requires Windows 95 or later" for all except the IsNTAdmin, which it says is Undocumented :P
    Then again, The official documation says 2000 and up, so I guess I shouldn't rely on API-Guide too much for that.

    Ctrl-Space... thanks for the tip, didn't know that.

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    37,230

    Re: VB6 - Installer program for Process Explorer

    While API-Guide is a great source of examples, the information isn't always totally accurate (and it isn't kept up to date either, unlike the MS site).

    In terms of installing your program, the good news is that according to dilettante (who is very good at researching that kind of thing) Win2000 SP4 has a newer version of the VB runtime than WinXP, so basic VB programs are supported.

    The bad news comes from the References/Components you have selected. Previously you only had scrrun.dll, which should not be distributed anyway (it is specific for each version of Windows, and is pre-installed), so that was OK... but now you have added extra components (SysInfo and two sets of Common Controls) which are likely to be a source of problems. However, you don't actually seem to use any of those components - so I'd recommend simply deselecting them (and if you intended to make use of them later, try to find alternative methods using the standard controls instead).


    I spotted something that I missed before, you use "New" in the declaration of the FSO variable, which isn't the best idea.. time for yet another article! Why shouldn't I use "Dim .. As New .."?


    In terms of error handling, each routine that could get errors (which includes all of them that call the registry routines, etc) should ideally have an error handler of some sort - otherwise an error will crash your program. In many cases what you have in the Install routine is enough, but I would recommend changing it to something like this:
    Code:
    ...
    Err_handlr:
          'while the Error function gives the description, the Err object
          'gives more info to help you solve it
        Select Case MsgBox("Error " & Err.Number & ": " & Err.Description, _
                           vbAbortRetryIgnore, _
                           "Error in: Install")
        Case vbAbort:    '(do nothing - this routine will automatically end)
        Case vbRetry:    Resume
        Case vbIgnore:   Resume Next
        End Select
    End Function
    ...or better still, make a function that you pass the routine name to, which shows the MsgBox and returns the value. That way you can easily change or extend all of your error handling later if you want (such as logging errors to a text file, etc) just by changing one routine.
    (Side note, does VB have a errorline variable?)
    It does, but you need to manually enter line numbers on each line of code - unless you use an addin like MZTools, which can do that automatically at the press of a button, and can also write error handlers for you (auto-typing relevant info based a template you make).

    You can see an explanation of my template etc here (but without my return values, which are basically as I described above).


    Note that you should only use "On Error Resume Next" for specific parts that you really don't care about, and as soon as possible afterwards return to normal error handling (by using "On Error Goto ...").

    In your Uninstall routine I don't think you should use it at all (except perhaps for the registry part, but only if you don't mind those lines not working). Your "Access Denied" message should be moved into the error handler, perhaps as a special case (so if that err.number occurs show that message, otherwise use the normal MsgBox/Function).

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Aug 2008
    Location
    Between the keyboard and the chair.
    Posts
    122

    Re: VB6 - Installer program for Process Explorer

    -edit: deleted skipped dbl post-
    Ill get on those right now!

    Quick Question... How would you critique my general coding?
    Last edited by EntityReborn; Sep 1st, 2008 at 03:11 AM.

  8. #8
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    37,230

    Re: VB6 - Installer program for Process Explorer

    Apart from the issues we've gone thru, I don't think there's anything wrong with your coding - only things that I would have done differently due to personal style (and I can say that about almost any code!).

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Aug 2008
    Location
    Between the keyboard and the chair.
    Posts
    122

    Re: VB6 - Installer program for Process Explorer

    Wow. First of all... MZ-Tools... Yum. I love it already.

    New update:
    -added testing if running from IDE (uninstaller not created if true, as no EXE is made.)
    -changed order of functions, and moved basic installer classes to new module
    -added better error notification
    -added 'status bar' for more convenient notifications
    -removed unneeded references/components (were in place due to testing ideas)
    -small touchups, fixes and cleanups

    Link: Click Here

    Quick side note: How could I design a addon, similar to MZTools, but its function would be to zip up all project files? It may get annoying if you have a big project, and you have all your modules in a seperate folder than your project folder...
    Last edited by EntityReborn; Sep 2nd, 2008 at 12:52 PM.

  10. #10
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    37,230

    Re: VB6 - Installer program for Process Explorer

    MZTools is great, I would hate to code without it.

    To create your own addin, start a new project and select the "Addin" template. I can't remember the details after that, but it is more complex than a normal program, and probably isn't the best idea for the kind of thing you want - as you will need to copy the files (having them open in VB will sometimes stop you from doing that).

    Note that you can probably find pre-written code for a project like that on FreeVBCode.com or PlanetSourceCode.com (be more careful on PSC, as the majority of code there is low-quality, even when the ratings are good).


    On to your project... you've proved that a project-zipper would be a good idea, as you missed Installer.bas

    I like the changes, and the NewStatus routine (and statusbar, etc) is a good idea, but in btnInstall_MouseUp you don't call it "correctly" - you use the value 0 rather than the Enum.

    You don't need "On Error GoTo 0" just before ending/exiting a routine, as the error handler only affects that routine anyway.

    You could do with adding error handlers to the Form_ events, as they all have potential for error. I wouldn't bother using Form_Terminate, as I've never known a situation where Form_Unload isn't run (but it might be possible, so if you can remember where you read that I can check).


    I see you chose not to do a function for the error handling, but I would recommend it - as it means later you can easily change the style/content of the message (such as adding the program version number etc), or add extra functionality like logging to a file. I use one in its own module (thus easy to add to projects), which includes an Enum for the return values (and lots of extra routines that help my very complex error handler!).

    For what you have so far, the function could be like this:
    Code:
    'Standard error handler - shows error info to the user
    Public Function ErrorHandler(pstrRoutine As String) As VbMsgBoxResult
    
    'if you want, add code here to log errors 
    '(but save Err.Number etc to variables first, in case you get extra errors!)
    
      ErrorHandler = MsgBox("Error " & Err.Number & ": " & Err.Description & vbCrLf & _
                            "Line " & Erl & " of routine " & pstrRoutine, _
                            vbAbortRetryIgnore, _
                            "Error in: " & pstrRoutine)
    
    End Function
    ..and the usage would be like this:
    Code:
    ...
    chkAutoStartALL_Click_Error:
        Select Case ErrorHandler("chkAutoStartALL_Click")
        Case vbAbort:
    ...

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Aug 2008
    Location
    Between the keyboard and the chair.
    Posts
    122

    Re: VB6 - Installer program for Process Explorer

    Hehe... moved Installer.bas into the project directory to be included in zips.

    As for the files being in use by the IDE, I was able to open the files in Notepad, when open in the IDE... should be fine, methinks. Not too sure how to tackle

    Step ahead of you on the Error Function, I wrote that in this morning before heading out, exactly as you have posted, with the exception that the procedure name and type are included as global strings. Guess i could save some memory and just include them in the error call, as you did.

    The On Error Goto 0 was in the errorhandler addin routine by default. As I hadn't known that errorhandling was a scoped element, I left it as is. LOL, Ive seen some code with the same error.

    I think when a program's Form_Unload isn't called, is when the program has been terminated directly (ie not code terminated, but killed with taskman or something), is what the article was mentioning. Not 100% sure.

    The Enums I also fixed, changed them to BLACK instead of 0 (which equals BLACK anyway, which was why I did that... Didn't have BLACK in the enum at the time)

    The Form_ procedures... Besides the ones that make registry calls, how would Errorhandling be needed?

    One question (well, ANOTHER one, :P) is their a way to group certain controls? IE, if i want to move ALL my controls at once, without doing them one by one, I send a command to one object, and it does the rest? I can think of examples in a 3D art program, where you can set several objects as children to a base. If you move or rotate the base, the children move as well, staying in formation.

  12. #12
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    37,230

    Re: VB6 - Installer program for Process Explorer

    Quote Originally Posted by EntityReborn
    As for the files being in use by the IDE, I was able to open the files in Notepad, when open in the IDE...
    It depends what the IDE is doing at the time - you will be OK if it isn't writing to those files and hasn't locked them, otherwise you will either get an error or copy a file that doesn't contain the right data (eg: is missing 90% of the file, or contains the current first 10% and the rest of the previous version).
    Step ahead of you on the Error Function, I wrote that in this morning before heading out, exactly as you have posted, with the exception that the procedure name and type are included as global strings. Guess i could save some memory and just include them in the error call, as you did.
    When it comes to Global/Public variables, it's not just memory to worry about - there is also a much higher chance of bugs (as you can write to them from more than one place), and the inconvenience of extra items in the dropdown lists when writing code.

    It also takes less code to pass them as parameters.
    The On Error Goto 0 was in the errorhandler addin routine by default. ..
    That doesn't surprise me, it's a common misunderstanding!
    I think when a program's Form_Unload isn't called, is when the program has been terminated directly (ie not code terminated, but killed with taskman or something), is what the article was mentioning. Not 100% sure.
    When I write FAQ articles I try to ignore my previous beliefs (just in case the evidence for them was wrong/misleading), so as part of writing the "How should I close ..." article I did extensive testing, and didn't find anything of that nature - the closest I could get is nothing running at all (just an immediate halt). I may have missed something, but as yet I haven't seen a description of how to get any different.
    The Form_ procedures... Besides the ones that make registry calls, how would Errorhandling be needed?
    There are other things that could potentially cause errors. Error handling shouldn't just be used to patch the parts you know errors can occur in, but also for things you aren't certain about - otherwise even "pointless" errors will be fatal to your program.

    In _Initialize I suspect that FileExists could give an error in some circumstances, as the equivalents like Dir can (not sure, I don't use FSO much, and the help doesn't say either way). I haven't checked, but from what I've read before, I think InitCommonControls can have errors too.

    In _Load I think you might be OK, as my checks indicate that the API calls and the Environ function wont give errors. The only issue is whether UpdateWindow deals with errors (assuming it could have any), because if it doesn't you'll get an error on that line (while error handlers are scoped, the errors are not - they keep "bubbling up" the call stack until they are dealt with).

    In _Unload and _Terminate, you are actually OK, as FreeLibrary wont give an error.
    One question (well, ANOTHER one, :P) is their a way to group certain controls? IE, if i want to move ALL my controls at once, without doing them one by one, I send a command to one object, and it does the rest? I can think of examples in a 3D art program, where you can set several objects as children to a base. If you move or rotate the base, the children move as well, staying in formation.
    If you want to do something manually as a one-off: Select one then hold Ctrl while selecting the others, and then do what you want (eg: move them, set properties, use the Format menu, etc).

    If it is just moving (either manually & frequent, or easily via code): Put a container control (Frame/PictureBox/...) on your form, then Cut/Paste the other controls onto it, and set the properties of the container (eg: Border) so it doesn't show anything itself. The downside is that you now have a background behind those controls, which will hide anything it goes in front of.

    There are several code alternatives, but which to use depends on what you want to achieve.

  13. #13

    Thread Starter
    Lively Member
    Join Date
    Aug 2008
    Location
    Between the keyboard and the chair.
    Posts
    122

    Re: VB6 - Installer program for Process Explorer

    Ah ok, thanks for the info! I won't individually reply to your responses, as before. Ive added a sort of log, implemented by extending the form's edge, when a new commandbutton is pressed. Still working on some things, so I won't post the source yet.
    Another note, Ill exclude the resource file from now on, as my RapidShare account expired and I can't be bothered to upload 3 megs each time I tweak something, being on a wireless connection fueled by a slow DSL line.

    si, could I ask you a favor? Just for laughs, Id love to see how you would design, from the ground up, an installer that achieves the same goal as mine, once I post up the next generation of code. I'd like to learn how to tighten up my code, and as you mentioned, clear up the global variable thing. Im sure I overdid it in some areas, while lacking in others, or implemented something in a more complicated way than was needed.
    If not, no worries

    Ive actually been thinking it may be better to include the program's files (exe and chm) outside of the installer exe, so that if an update is made to the program, a new installer doesn't need to be made. Which adds another idea... automatically download the package?

    Updated source soon to come.

  14. #14
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    37,230

    Re: VB6 - Installer program for Process Explorer

    Quote Originally Posted by EntityReborn
    Ill exclude the resource file from now on ...
    That's fair enough, and doesn't really affect me (I always delete 'compiled' files from downloads anyway). I hadn't recommended that earlier as other people might have wanted to see it.
    si, could I ask you a favor? Just for laughs, Id love to see how you would design, from the ground up, an installer that achieves the same goal as mine, ...
    To be honest it's not worth it - what I would create is similar to the kind of thing you've got now, so you wouldn't learn much (if anything) from it.

    Not doing it also means that I can spend more time giving you specific advice & explanations.
    Ive actually been thinking it may be better to include the program's files (exe and chm) outside of the installer exe, so that if an update is made to the program, a new installer doesn't need to be made. Which adds another idea... automatically download the package?
    I don't think it's a good idea to have the files outside (as that would make download etc harder), but automatically downloading the files is a good idea - as long as it is optional behaviour (as some people download things for use on other PC's without internet access).

    Depending on how you set that up, you could extend it so that it is easy to update the installed copy of PE to the latest version (perhaps even a kind of auto-update feature).

  15. #15

    Thread Starter
    Lively Member
    Join Date
    Aug 2008
    Location
    Between the keyboard and the chair.
    Posts
    122

    Re: VB6 - Installer program for Process Explorer

    Quote Originally Posted by si_the_geek
    That's fair enough, and doesn't really affect me (I always delete 'compiled' files from downloads anyway). I hadn't recommended that earlier as other people might have wanted to see it.
    Heh, you have been the only one downloading the packages I upload. Im surprised no-one has really checked this out too much.
    To be honest it's not worth it - what I would create is similar to the kind of thing you've got now, so you wouldn't learn much (if anything) from it.
    Not doing it also means that I can spend more time giving you specific advice & explanations.
    Gotcha.
    I don't think it's a good idea to have the files outside (as that would make download etc harder), but automatically downloading the files is a good idea - as long as it is optional behaviour (as some people download things for use on other PC's without internet access).
    The file is zipped, so ill need an api to unzip it, as well as use the winsock control to make the connection, correct? (or use an API... API Guide shows two, DoFileDownload, and possibly URLDownloadToFile). I'd probably get the program to check the current directory, and then if the files are absent, Ask the user if the files should be downloaded, then automatically d/l, unpack and install the files.

    Depending on how you set that up, you could extend it so that it is easy to update the installed copy of PE to the latest version (perhaps even a kind of auto-update feature).
    If Im correct, that would require:
    1. Either having a program check at startup, or "stubing" ProcessExplorer
    2. Having that program load the website and look around for the version numbers
    3. Redoing the download
    4. Error handling for possible changes in the package (EG new FileNames, additional files). Could cause problems, not to mention that the program COULD become a installer, not a click and run app (extreme case, obviously)

    At this moment, unless their is an easy way to accomplish all that, which seems to be alot in my green eyes, I'll add that to the To-Do list, for a later date. I especially don't like the idea of adding yet ANOTHER item to the startup list, as I am already incorperating the addition of this program to the users run list.

    Ok here is the latest source...
    -Made a few logic adjustments, especially to the forced uninstaller
    -Added the logging system i mentioned earlier, including saving the log to text file.
    -Little more error handling
    Attached Files Attached Files
    Last edited by EntityReborn; Sep 8th, 2008 at 04:47 PM.

  16. #16
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    37,230

    Re: VB6 - Installer program for Process Explorer

    Apologies for the delay - I didn't have enough time when I first saw your reply, and then forgot about it for a few days.
    Quote Originally Posted by EntityReborn
    The file is zipped, so ill need an api to unzip it, as well as use the winsock control to make the connection, correct? (or use an API... API Guide shows two, DoFileDownload, and possibly URLDownloadToFile).
    For downloading, URLDownloadToFile would probably be best (but check it is supported for the OS's you are supporting).

    Unfortunately unzipping is more complex, as there are no API's for it pre-XP, so you'd need an extra DLL for it. There are several threads on the forums that explain where to get one, and how to use/install them.
    If Im correct, that would require: ...
    Absolutely, so I can completely understand delaying it, or leaving it out entirely!
    Ok here is the latest source...
    I notice you have now given the items in your Color enum the same name as VB's enums (vbBlack etc), which is not a good idea even if they contain the same values as the original (while that would avoid errors, it doesn't stop confusion/worries when reading the code). What I do is use my own prefixes, whatever seems relevant to the enum itself (so for ErrorReturns I might use er_Abort ).

    For the error handling, the PostErrorOther function returns the value from MsgBox, which is actually different to your Enum. You could either use a Select Case to convert to the Enum values, or in the declaration of the Enum specify the values to be equal to the ones that MsgBox returns (I would personally use Select Case).

    In btnInstall_MouseUp you have messages that include "(Un)Install", rather than having separate messages.. while that is understandable, it isn't ideal. What I would do is create a variable to store the apt word (which you set in the earlier If's) that you can simply append into he message.

    I've only had a quick look through Installer.bas, but didn't see anything 'bad' in there.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.