Results 1 to 3 of 3

Thread: Dll Base Adress??

  1. #1

    Thread Starter
    Hyperactive Member onerrorgoto's Avatar
    Join Date
    Aug 1999
    Location
    Sweden
    Posts
    330

    Post

    I helped a friend who developed a usercontrol in vb6 to "convert" it to vb5 whitch I use. but he wrote and told me not to use the dll base adress that vb gives me.

    When you create a new project, VB will use a standard DLL Base Address. You must not use the one provided, as many people forget to change it, and if a conflict occurs, your program will be moved to a new location in the memory (degrading performance). To create a random DLL base Address, use the following code:
    '// 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
    txtBaseAddress = "&H" & LCase(Hex(CLng((32768 - 256 + 1) * Rnd + 256) * 65536))
    Why should I not use the standard base adress that vb give me? Isnt there as much chance that there will be a conflict when I use a random number??
    I thougt that each vb was assigned a set of unique dll base adresses, that no oter vb program devolped in vb uses.
    Of course there is other tools that can assing dll base addresses but the chance that to programs will use the same base adress must be rather small.

    ------------------
    On Error Goto Bed =:0)
    [email protected]

  2. #2
    Guest

    Post

    The DLL will always trie to put it on the base adress first, if i can't allocate the base adress first. The resaon not tho use the base adress is because it might be in use and needs to find a place wich isn't in use.

    So by giving it a random number it will just do the same, check base adress if it isn't available put it in some other place.



    ------------------

    Vincent van den Braken
    EMail: [email protected]
    ICQ: 15440110
    Homepage: http://www.azzmodan.demon.nl




  3. #3

    Thread Starter
    Hyperactive Member onerrorgoto's Avatar
    Join Date
    Aug 1999
    Location
    Sweden
    Posts
    330

    Post

    But the dll will use the adress stated in project properties?(My own or the standard one provided by VB) Then if that adress is in use by another program when i run my dll then it will set a new temporary adress to my dll?

    Did I understand you correct?

    ------------------
    On Error Goto Bed =:0)
    [email protected]

Posting Permissions

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



Click Here to Expand Forum to Full Width