Hi,
First you need to include the windows.h

#include <windows.h>

then you need to set up some needed structs:

Code:
typedef struct { 
	UINT wXpos; 
	UINT wYpos; 
	UINT wZpos; 
	UINT wButtons; 
} JOYINFO; 

typedef struct { 
    WORD wMid; 
    WORD wPid; 
    char szPname[32]; 
    UINT wXmin; 
    UINT wXmax; 
    UINT wYmin; 
    UINT wYmax; 
    UINT wZmin; 
    UINT wZmax; 
    UINT wNumButtons; 
    UINT wPeriodMin; 
    UINT wPeriodMax; 
    UINT wRmin; 
    UINT wRmax; 
    UINT wUmin; 
    UINT wUmax; 
    UINT wVmin; 
    UINT wVmax; 
    UINT wCaps; 
    UINT wMaxAxes; 
    UINT wNumAxes; 
    UINT wMaxButtons; 
    char szRegKey[32]; 
    char szOEMVxD[260]; 
} JOYCAPS;



Then you need to declare the methods you want to use from the Windows API, because windows.h only has a fraction declared.

Code:
UINT WINAPI joyGetPos(UINT uJoyID, JOYINFO* pji);
UINT WINAPI joyGetNumDevs(VOID); 
UINT WINAPI joyGetDevCaps(UINT uJoyId, JOYCAPS* pjc, UINT cbjc);



These are some methods I used.
You need to test the for joiIds, save them somewhere and use the controller id with joyGetPos. You can read about it on msdn.

Of course there are other (perhaps better) ways to capture jostick input. (I think directinput is better but in my experience it is not that nice to use directx interface methods with acknex, but as I said, I never used it).