Re: Re: Register DLL Question

Tech-Archive recommends: Speed Up your PC by fixing your registry



All programs are distributed via SMS. I don't know what the difference is
though. I have never used SMS to roll out anything.




"vbexp" <nobody@xxxxxxx> wrote in message
news:%23DpIOkZ2FHA.2312@xxxxxxxxxxxxxxxxxxxxxxx
> It seems that your only solution is to break the old apps and send an
> updated version. However, you could make it easier on your customer by
> making an update utility in VB6. This utility would be run from a login
> script so the admin doesn't have to visit each computer.
>
> This utility would check a registry entry, like "Update=1", and if not
> found, it creates it after a successful update so the update is not done
> again.
>
> Here is how I do it if I were you:
>
> - Update.exe accepts "/admin" and "/doupdate" command line arguments.
> - It has Public Sub Main and Form1. Main runs first.
> - Add "VB 6 Resource Editor" to the project, and add a new resource file
> from the project menu.
> - When started, it checks for "/admin" using VB's Command Function, and
> when specified, it shows Form1.
> - Form1 lets the admin enter a user name, password, and a domain that is a
> member of Administrators.
> - I would use UpdateResource() API call to save the info in the EXE.
> - Admin puts "update" in a login script, such as a batch file.
> - When "update" runs without command line arguments, it uses
> CreateProcessWithLogonW() API call to start "update /doupdate" with the
> more privileged credentials so the update can be done successfully.
> - When "/doupdate" is used, the actual update is done. VB's LoadResString
> can be used to get the previously stored username/password/domain from the
> EXE file.
> - If the admin is worried about his/her password, either you could encrypt
> it, or tell him/her to change his/her password to a temporary one and then
> change it back after everything was done.
>
> Note that CreateProcessWithLogonW requires Windows 2000+, if the user has
> NT4, then you have to use CreateProcessAsUser which is slightly more
> difficult to use. Note that these functions refer to HKEY_CURRENT_USER as
> the user's profile, so you have to load it if you need to access it.
>
> If the Admin doesn't have Windows 9x clients, then he or she could use
> "RUNAS" in a batch file so you save a programming step. Also, if all users
> are members of Power Users, then RUNAS is not needed. The difference
> between an Administrator and a Power User in regard to installation is
> that under a Power User the installer cannot tell the OS to replace a file
> during reboot(if it was in use at the time). In your case, the OCX is not
> in use since your App is not running because the user has just logged in
> and no other Apps are running(except services), so this issue does not
> effect you(unless your VB6 app runs as a service).
>
> If you want to register a DLL using VB6, you could declare
> DllRegisterServer as follows:
>
> Public Declare Function DllRegisterServer1 Lib "One.ocx" Alias
> "DllRegisterServer" () As Long
> Public Declare Function DllRegisterServer2 Lib "Two.ocx" Alias
> "DllRegisterServer" () As Long
> Public Declare Function DllUnregisterServer1 Lib "One.ocx" Alias
> "DllUnregisterServer" () As Long
> Public Declare Function DllUnregisterServer2 Lib "Two.ocx" Alias
> "DllUnregisterServer" () As Long
>
>
> To call it, use:
>
> ChDrive OCXPath
> ChDir OCXPath
> result = DllRegisterServer1()
>
> The first 2 would change the current directory so the OCX that is
> registered is the one at OCXPath, since LoadLibrary would check the
> current directory before checking the SYSTEM folder. I would suggest that
> you check if the OCX was registered first before calling
> DllRegisterServer. I think there is a counter somewhere that counts how
> many times a DLL was installed so it's only removed after the last
> application that uses it was uninstalled, so try not to install the DLL
> repeatedly, I am not sure how this works or where it's stored in the
> registry, nor if the counter is incremented by an installer or
> DllRegisterServer.
>
> Since you are going to need to find what OS version the utility runs on,
> you may want to check this sample:
>
> Obtaining Windows' Version Information
> http://vbnet.mvps.org/index.html?code/system/getversionex.htm
>
>
>
> "boaz" <nospam@xxxxxxxxx> wrote in message
> news:uTuzySQ2FHA.924@xxxxxxxxxxxxxxxxxxxxxxx
>> "...I would contact the OCX vendor to see if they have any
>> solution."
>>
>>
>> They told me to recompile all my old programs.
>> This is not possible. This will freak out the IT guy over there. And he
>> already freaked out... people, lotz of people, were calling him to ask
>> why the old programs didn't work... And he was redirecting all the calls
>> to me... And this was very BAD to my mortal soul!!!!
>>
>> And he just installed the new program to.. <g> god knows how many
>> computers... When I told him to update all old programs to the new
>> versions, he was... just... DAM#####... you know what...
>>
>>
>>
>>
>>
>>>
>>>
>>>
>>>
>>> "boaz" <nospam@xxxxxxxxx> wrote in message
>>> news:e8NSV4P2FHA.400@xxxxxxxxxxxxxxxxxxxxxxx
>>>>I don't have any problem with the OCXs from ComponentOne.
>>>>
>>>> So... if I not to register any of the new OCXs, and just copy the new
>>>> OCXs to the same Program Folders of my application (which is just 1 EXE
>>>> file), will it be ok to do so?
>>>>
>>>> As I said before, if I copy the OCXs to my Program Folders and register
>>>> the OCXs, all my old programs will look for the new OCXs in the Program
>>>> Folders of my new program. This is not ok.
>>>>
>>>> P.S.
>>>> This is going nowhere.
>>>> I am thinking that I am not describing my problem clearly.
>>>>
>>>>
>>>>
>>>>
>>>> "vbexp" <nobody@xxxxxxx> wrote in message
>>>> news:%23dZ4coP2FHA.1188@xxxxxxxxxxxxxxxxxxxxxxx
>>>>> If you are using OCX's from ComponentOne by any chance, they are not
>>>>> flawless. You may want to search their KB articles:
>>>>>
>>>>> http://helpcentral.componentone.com/Search.aspx?Refresh=1
>>>>>
>>>>> They have their own newsgroups:
>>>>>
>>>>> http://helpcentral.componentone.com/Newsgroups.aspx
>>>>>
>>>>>
>>>>> "boaz" <nospam@xxxxxxxxx> wrote in message
>>>>> news:eFXuFWP2FHA.1416@xxxxxxxxxxxxxxxxxxxxxxx
>>>>>> Hi,
>>>>>>
>>>>>> This is the part that I don't understand.
>>>>>> My project doesn't have any DLL/OCX of my own.
>>>>>> My project consists of only 1 EXE (the main program) and couple of
>>>>>> third party OCXs.
>>>>>>
>>>>>> I only have a third party grid and some other third party OCXs.
>>>>>>
>>>>>> All my other projects use the same third party OCXs.
>>>>>> My old projects used to work fine until the other companies upgraded
>>>>>> their OCXs to support W2K/XP.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> "Michael C" <mculley@xxxxxxxxxxxxxxxxxxxxxx> wrote in message
>>>>>> news:eNHIxFP2FHA.3716@xxxxxxxxxxxxxxxxxxxxxxx
>>>>>>> "boaz" <nospam@xxxxxxxxx> wrote in message
>>>>>>> news:u%23qU%23fN2FHA.1100@xxxxxxxxxxxxxxxxxxxxxxx
>>>>>>>>I know. Just like one of my projects. They are running some sort
>>>>>>>>of database system on VMS or something like that. Need to Telnet to
>>>>>>>>the server to get the records.
>>>>>>>>
>>>>>>>> But... I am still confused about registering DLL. Most of the
>>>>>>>> reply are off topic.
>>>>>>>
>>>>>>> Ok, if you're using vb6 I would forget about even attempting to run
>>>>>>> the dlls 'side by side'. If you really need both apps to have a
>>>>>>> seperate copy of the dlls then I would break them into 2 seperate
>>>>>>> projects and run them as if they are completely seperate components.
>>>>>>> To do this you compile your dll to a new filename with No
>>>>>>> Compatibility and then go back to project or binary compatibility. I
>>>>>>> think you should also rename the project before doing this. This way
>>>>>>> they are no longer the same dll but 2 completely different dlls that
>>>>>>> just happen to have all the same source code and both will run
>>>>>>> happily on the users machine.
>>>>>>>
>>>>>>> Regards,
>>>>>>> Michael
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


.



Relevant Pages

  • Re: API equivillent of RegSvr32.exe ?
    ... If you want to register a DLL using VB6, you could declare DllRegisterServer ... Public Declare Function DllUnregisterServer1 Lib "One.dll" Alias ...
    (microsoft.public.vb.winapi)
  • Re: Hiding my COM interfaces (newbie).
    ... > failure with my installer that worked before. ... and change the implementation of DllRegisterServer ... Kim Gräsman ...
    (microsoft.public.vc.atl)