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:
int render1(struct winampVisModule *this_mod) { long lb, pa; //map 'user32' into the address space of the calling process. lb = LoadLibrary("Project1.dll"); //retrieve the address of 'SetWindowTextA' pa = GetProcAddress(lb, "WinAmpVisTest"); // HOW TO CALL THE FOLLOWING PROCEDURE FROM MY DLL ? //Public Sub WinAmpVisTest(MemDC As Long, this_mod As WinAMPVisModule) //unmap the library's address FreeLibrary (lb); return 0; }
Here is WinAmpVisTest from my VB dll:
vb Code:
Public Sub WinAmpVisTest(MemDC As Long, this_mod As WinAMPVisModule) ' Draw on the memDC End Sub
And here is the WinAMPVisModule in VB
vb Code:
Public Type WinAMPVisModule 'Most comments here are verbatim from VIS mini-SDK. Description As String 'description of module hWndParent As Long 'parent window (filled in by calling app) hDLLInstance As Long 'instance handle to DLL (filled this in) sRate As Long 'sample rate (filled in by calling app) nCh As Long 'number of channels (filled in...) LatencyMs As Long 'latency from call of RenderFrame to actual drawing '(calling app looks at this value when getting data) DelayMs As Long 'delay between calls in ms 'the data is filled in according to the respective Nch entry SpectrumNch As Long WaveformNch As Long SpectrumData(0 To 575, 0 To 1) As Byte WaveformData(0 To 575, 0 To 1) As Byte 'These function pointers all get passed one argument -- a pointer to a 'winampVisModule struct (type). ConfigFP As Long 'configuration dialog function -- returns void InitFP As Long '0 on success, creates window, etc. -- returns int RenderFP As Long '0 on success, 1 if vis should end -- returns int QuitFP As Long 'call when done UserDataP As Long 'user data, optional End Type
PowerBasic version of SVIS.C code can be found here.
Thanks in advance for any kind of input.![]()





Reply With Quote