Results 1 to 3 of 3

Thread: [C] Calling function of another dll from my C dll (for WinAmp Vis Plugin)

Threaded View

  1. #1

    Thread Starter
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Arrow [C] Calling function of another dll from my C dll (for WinAmp Vis Plugin)

    Firstly, I'm NOT a Windows C programmer. Last time I used C was long time ago in college. I know only DOS based C programming with TurboC++.

    So, basically I'm asking you to give me some C0d.

    I'm making a visualization module for WinAmp. My base code is "\vis\vis_test\SVIS.C" from WinAmp SDK (237kb only).

    As I don't know C/CPP programming on Windows, my idea is to create a standard dll using VB and pass it memDC variable and WinAMPVisModule structure.

    That way, I can draw the graphics from inside my VB dll.

    Here is what I want in the render1 function of SVIS.C:
    C Code:
    1. int render1(struct winampVisModule *this_mod)
    2. {
    3.  
    4.     long lb, pa;
    5.  
    6.     //map 'user32' into the address space of the calling process.
    7.     lb = LoadLibrary("Project1.dll");
    8.  
    9.     //retrieve the address of 'SetWindowTextA'
    10.     pa =  GetProcAddress(lb, "WinAmpVisTest");
    11.  
    12.     // HOW TO CALL THE FOLLOWING PROCEDURE FROM MY DLL ?
    13.     //Public Sub WinAmpVisTest(MemDC As Long, this_mod As WinAMPVisModule)
    14.  
    15.     //unmap the library's address
    16.     FreeLibrary (lb);
    17.  
    18.     return 0;
    19. }

    Here is WinAmpVisTest from my VB dll:
    vb Code:
    1. Public Sub WinAmpVisTest(MemDC As Long, this_mod As WinAMPVisModule)
    2.      ' Draw on the memDC
    3. End Sub

    And here is the WinAMPVisModule in VB
    vb Code:
    1. Public Type WinAMPVisModule 'Most comments here are verbatim from VIS mini-SDK.
    2.  
    3.     Description  As String   'description of module
    4.     hWndParent   As Long         'parent window (filled in by calling app)
    5.     hDLLInstance As Long         'instance handle to DLL (filled this in)
    6.     sRate        As Long         'sample rate (filled in by calling app)
    7.     nCh          As Long         'number of channels (filled in...)
    8.     LatencyMs    As Long         'latency from call of RenderFrame to actual drawing
    9.     '(calling app looks at this value when getting data)
    10.     DelayMs      As Long         'delay between calls in ms
    11.     'the data is filled in according to the respective Nch entry
    12.     SpectrumNch As Long
    13.     WaveformNch As Long
    14.     SpectrumData(0 To 575, 0 To 1) As Byte
    15.     WaveformData(0 To 575, 0 To 1) As Byte
    16.     'These function pointers all get passed one argument -- a pointer to a
    17.     'winampVisModule struct (type).
    18.     ConfigFP As Long        'configuration dialog function -- returns void
    19.     InitFP As Long          '0 on success, creates window, etc. -- returns int
    20.     RenderFP As Long        '0 on success, 1 if vis should end -- returns int
    21.     QuitFP As Long          'call when done
    22.     UserDataP As Long       'user data, optional
    23. End Type

    PowerBasic version of SVIS.C code can be found here.


    Thanks in advance for any kind of input.
    Last edited by iPrank; May 29th, 2007 at 03:38 AM.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


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