NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
SeaNick
Posts: 1
0 Kudos

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.

 

Example:

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.

Active Participant
Makoto
Posts: 524

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 - http://support.microsoft.com/kb/164787/en-us

 

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 http://paulhollingsworth.com/Articles/ScriptAdapter.html

 

 

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page