Instrument Control (GPIB, Serial, VISA, IVI)

Showing results for 
Search instead for 
Did you mean: 

GPIB Commands via Rundll32.exe

GPIB Commands via Rundll32.exe

I was wondering if it is actually possible to issue simple commands accross the GPIB bus via the rundll32.exe option in a command prompt window. Ultimately what I am trying to accomplish is to issue generic GPIB commands via VBScript, however after searching high and low I have come to the conclusion that this not a simple function call type procedure. So my workaround is to use a command prompt to call rundll32 and use the gpib-32.dll library to issue my commands.



rundll32.exe gpib-32.dll,ibwrt <arguments>


When using the NI spy and calling this line without any arguments, the bus does recognize that an ibwrt command came across, however it does not have any argument values (obviously). However, I can find no syntactical way of specifying the arguments that I want that causes the bus to process them correctly. All of my write commands result in this:


ibwrt(?device?,"<Invalid Poin...",18(0x12))


Can someone point me in a general direction or explain to me what I might be doing wrong? Or if possible, is there a simpler way of issuing GPIB via VBScript that I am just not aware of? Any help is greatly appreciated.

0 Kudos
Message 1 of 2

Re: GPIB Commands via Rundll32.exe

I believe your attempt is impossible. Any DLL functions that can be invoked through rundll32 must be a specific function prototype as described in the following syntax. There is no such function in gpib-32.dll that matches with the syntax.


void _stdcall EntryPoint(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow);


See the MS document -


If you want to control GPIB from inside VB script, you should try using ActiveX (.OCX) version of GPIB DLL. I think it is available as a part of NI Measurement Studio. Other approaches are, 1)Use VISA COM DLL through the "Script Adapter" wrapper, or 2)Create your own COM DLL that supports IDispatch interfaces wrapping NI gpib-32.dll.  The DLLs that can be invoked from VB Script are IDispatch-based  COM DLLs.


As for Script Adapter, see



Message 2 of 2