Re: Registering DLL Question - Part 2

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



FYI, DllMain is the first thing that is called in any DLL. It's also called
when the DLL is unloaded with DLL_PROCESS_DETACH, so the developer is also
free to unregister the DLL at that time, which will make you scratch your
head if you closed your App without searching the registry, but I bet that
they leave the registry entries alone.



"boaz" <nospam@xxxxxxxxx> wrote in message
news:Oev09Qa2FHA.1576@xxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> After so many off topic posts, I am finally getting something.
> I tried what vbExp suggested. I checked the registry to see if there was
> any OCX there. It was not there. And then I ran my program. And
> somehow, the program added the OCX to the registry by some unknown force.
>
> Now I understand a little bit more about registering DLL.
>
>
>
>
>
>
>
>> I just copied the main EXE and the OCXs to the same folder without
>> registering anything. (just copy and paste). And it worked.
>
> The OCX may have been registered already. Try this instead: before
> installing on a new computer, search the registry for the OCX file, you
> will
> either find that it was registered before, or see my comments below about
> registering during DllMain call.
>
> Perhaps part of your confusion is that ActiveX files are called
> self-registering DLL's. This doesn't mean that they are magically
> registered, a setup program or an update utility must call
> DllRegisterServer() which is exposed by the DLL/OCX. Self-registering here
> means that the DLL/OCX will create the registry entries that it needs to
> function all by itself, i.e., self maintaining, however, an installer or
> updater must call DllRegisterServer() inside the DLL/OCX during
> installation
> time. Self-registering is actually self-maintaining, not auto register.
>
> Programs like "regsvr32.exe" and installers register a DLL by calling
> DllRegisterServer(), and unregister by calling DllUnregisterServer().
>
> Having said that, it's possible for a vendor(using C++), when the DLL is
> first loaded to check if the registry entries were present or not, and add
> them. However, many don't do that and it could be a big mistake, since
> only
> Administrators and Power Users can write to HKEY_LOCAL_MACHINE. The vendor
> may have added such a check in DllMain(), which is called when the DLL is
> first loaded. You can tell if the vendor is doing that by searching the
> registry for the OCX file, and if not found, just copy the OCX files and
> your EXE and run your EXE. While the EXE is open, search the registry
> again,
> if you find the OCX, then the vendor is registering the DLL if it was not
> registered during DllMain call, which is called by LoadLibrary API
> function.
>
> P.S.: OCX files are DLL's as far as the OS is concerned.
>
> Self Registration for Controls
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/html/0fff07e5-10bb-4052-8eb1-021efcb66d6c.asp
>
>> Just copy and paste the EXE and their own OCXs to their own folders.
>> (and
>> add the ".local" file there)
>
> I just double checked if the .local trick works with ActiveX files created
> with VB6 when they are not registered, and it doesn't. I created a test
> DLL
> "DotLocal.dll" and an EXE that uses it "DotLocalTest.exe". I used a
> "DotLocalTest.exe.local" file, but it doesn't work.
>
>
> "boaz" <nospam@xxxxxxxxx> wrote in message
> news:uvqf%23NQ2FHA.3420@xxxxxxxxxxxxxxxxxxxxxxx
>>
>>> Ok, that makes a bit more sense. You are quite stuck then I think. You
>>> can't
>>> have 2 copies of the same third party ocx on your machine and expect
>>> different apps to use different files. OCXs shouldn't be in your
>>> programs
>>> folder.
>>>
>>
>> Now this come to my second "Original" question. (yes it is going a
>> cycle)
>>
>> So, for the sake of it, I tested my new program on a brand new Win2K
>> computer. I just copied the main EXE and the OCXs to the same folder
>> without registering anything. (just copy and paste). And it worked. And
>> according to the previoues posts, if I didn't register the OCXs, the
>> program would not work. But this was not the case. I was confused. I
>> was thinking if I did the same thing for the rest of my programs, it
>> would
>> solve my problem. (i.e.) Not to register anythng. Just copy and paste
>> the EXE and their own OCXs to their own folders. (and add the ".local"
>> file there)
>>
>>
>>
>>> If I understand the problem, you have 2 or more apps that use the same
>>> third party OCX. By updating app B and releasing it with the new third
>>> party OCXs you are breaking app A? The only solution I can see is to go
>>> ahead and release app B and allow app A to be broken. You will then need
>>> to provide an update for app A. There's no other solution I can see
>>> because you are going to have to release a new version of A because
>>> another vendor might release an app with the updated ocxs anyway which
>>> would break A.
>>>
>>
>>
>> You are correct.
>> I installed the new program and all the old programs stoped working.
>>
>>
>
>
>
> --
>> There is no answer.
>> There has not been an answer.
>> There will not be an answer.
>> That IS the answer!
>> And I am screwed.
>> Deadline was due yesterday.
>>
>> There is no point to life.
>> THAT IS THE POINT.
>> And we are screwed.
>> We will run out of oil soon.
>
>


.



Relevant Pages

  • Re: VB6 executable accessing a .Net DLL with ComClass
    ... Your VB6 app is going to want to use the registry by default, ... regsvr32 in that it records the exact location of the dll. ... The VB6 dev environment wants a type-library, ...
    (microsoft.public.dotnet.framework.interop)
  • "Class not registered" when using DCOM to connect to an automation dll
    ... when both our app and the COM dll are installed on the same box. ... hoping that since the interface is standard (automation), ... automation dll using DCOM at all, by only changing some registry ...
    (microsoft.public.vc.atl)
  • Registering DLL Question - Part 2
    ... the program added the OCX to the registry by some unknown force. ... your EXE and run your EXE. ... By updating app B and releasing it with the new third ...
    (microsoft.public.vb.enterprise)
  • "Running DLL as an App" - warning after Administrator login
    ... and all possible updates & patches started to display warning about "Running ... DLL as an App" -- this only happens when I log in to the computer with the ... more protection for the registry, ...
    (microsoft.public.win2000.security)
  • Re: ATTN : TaurArian - register .dll files.
    ... with extension .DLL or .OCX and are distributed ... .OCX file, the system may have a memory lapse ... sometimes the misuse of Registry ... CD Writing Wizard, which obviously depends on this file, stops working ...
    (microsoft.public.windowsupdate)