Results 1 to 2 of 2

Thread: VB6 - how can i create\use macros?

  1. #1

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,955

    VB6 - how can i create\use macros?

    i have 1 nice Add-in with several tools\classes(adding the DLL auto on references ).
    my question is how can i add\create macros?
    i need create a similar '#define'(like C)..
    pratical exemple:

    your wrote:
    Code:
    SubName(...) 'VB6 give a syntax error
    so the macro just add the 'call':
    Code:
    call SubName(...) 'VB6 now accepts
    is why i need macros on VB6
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    5,262

    Re: VB6 - how can i create\use macros?

    Quote Originally Posted by joaquim View Post
    VB6 - how can i create\use macros?
    You don't.

    there are 3 common uses of #define in c
    1) defining constants --> IIRC, typeless, but you can cast the value to a specific type to force byte-width. Optional: With value (the "classic")/without value (e.g. the famous "Header"-Define to prevent multiple loading of header-files)
    2) defining TypeDefs --> "renaming" of a Datatype (My personal opinion: Whoever invented that deserves Jail-Time)
    3) defining "macros" --> short, usually typeless, piece of "code"

    alle 3 have in common:
    a) It gets resolved at compile-time
    b) the c-compiler "inserts" (replaces) the "caller"-Symbol(s) inline at all calling positions
    The "worst" for Number 3 i've ever seen, are those "stringify"-macros
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

Tags for this Thread

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