Results 1 to 7 of 7

Thread: Functions

  1. #1
    Guest
    Hi,

    I'm in the process of writing a Function Library for common/everyday routines. I find it annoying when I have to write the same routine each time for a different project so I have decided to place them in a DLL.

    Basically it has things like...
    • Number Conversions (Bin2Dec, Hex2Bin etc. and vise versa)
    • String Manipulation (Find, InStrRev etc.)
    • Working with Hwnds (Many API's made easy)
    • Full Registry access
    • Extentions to current VB functions (IsNumberic = IsNumberEx)


    Anyhow, I would still like to add a lot more to that. So my questions is: What kind of functions/routines would you guys like to be added to this?

  2. #2
    Hyperactive Member MPrestonf12's Avatar
    Join Date
    Jun 1999
    Location
    NY
    Posts
    330

    Lightbulb Files

    You could add in file manipulation like creating directorys or moving files between directorys.
    Matt

  3. #3
    Guest

    Thumbs up Major one we do is...................

    decimal place conversion

    e.g

    cFixed_Costs = 1.0092

    cVariable_Costs = 1.8801


    cTotal_Cost = (cAmount * cFixed_Costs) + (cAmount * cVariable_Costs)


    display cTotal_Cost too two decimal places.

    Haven't got the display stuff with me, am on site and it's all compiled away in a dll. But use this stuff all the time, cos vb is pretty lame on maths functions.

  4. #4
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    Could you write a C++ Dll that subclassed a window procedure but rader than have its own window procedure it called yours (pass the address to the dll as a parameter, it would return a pointer to it's own procedure that called the function for you. So you're actually subclassing through 3 window procedures rather than one) This way you could subclass foreign window procedures easily in VB without having to write a seperate dll for each one, I'm not sure how possible this is, you may have to do some clever stuff in the dll to get it to work, and you may have to limit it to simple window procedures (using variables in them may be tricky) But give it a go, it would be a huge help to a lot of people if you got that to work.

  5. #5
    Guest
    Thanks for your suggestons everyone.

  6. #6
    Hyperactive Member Warmaster199's Avatar
    Join Date
    Aug 2000
    Location
    Canada
    Posts
    306
    Add INI file control to your super DLL. I've got a few Snippets I can give you for other functions. Here's some number functions for you.
    Code:
    'Changes a Radian to a Decimal
    Function Rad2Dec(rads As Long)
         Rad2Dec = ((rads * 180) / 3.141592654)
    End Function
    
    'Changes a Decimal to a Radian
    Function Dec2Rad(decs As Long)
         Dec2Rad = ((decs * 3.141592654) / 180)
    End Function
    There's some functions for converting Radians to Decimals and vice verca. Hope this will help you out. Try maybe an API Wrapper DLL for newbies. Declare the API in a module and in a class module, put the function that calls the API. That way, all the user has to do is call the function without declaring it. Maybe this Idea is hard to understand.
    Designer/Programmer of the Comtech Operating System(CTOS)

  7. #7
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    How about something so that we can access the Registry as if it were a treeview? You know:
    Code:
    Dim reg As clsRegistry
    reg.Root(HKEY_CLASSES_ROOT).Children.Count
    ...for the number of child keys under HKCR.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

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