Every ActiveX OCX file and DLL are supposed to have their own DLL Base Address which specifies a location in the memory where it can be loaded. If a program has the same DLL Base Address, windows will move your application to a different location, which obviously damages performance as your app loads up. That is why you should always change it from its default base address by going to Project|Properties|Compile. Once you are there, however, you need to know a valid value to enter! The code below will generate a random base address for you. Read the comments to find out how!
'// 65536 * 256
'// DLL Base Addresses must be a multiple of 64K (65536)
'// LowerBound = 16777216 (which is 64K * 256)
'// UpperBound = 2147483648 (which is 64K * 32768)
'// 1) Generate Random Number between 256 and 32768
'// 2) Multiply by 64K
'// 3) Convert generated value to a Long value
'// 4) Convert generated value to Hex
'// 5) Convert generated string to lowercase (so that the letters are lower case)
'// 6) Add &H in front of string
Randomize
Debug.Print = "DLL Base Address: &H" & LCase(Hex(CLng((32768
- 256 + 1) * Rnd + 256) * 65536))
Comments