RUNDLL32 and STRPCCMD

I want ot open a cash drawer through AS/400.So  iam using this code

            STRPCO     PCTA(*NO)                        
            MONMSG     MSGID(IWS4010)                    
            STRPCCMD   PCCMD('C:\RMS400\CDK') PAUSE(*NO)

this CDK is an EXE file. While running this I am getting a DOS prompt, to avoid this popup can i use RUNDLL32. If yes, how it can be used. what are the parameters i need to send in STRPCCMD.



 
GayathriadithyaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gary PattersonVP Technology / Senior Consultant Commented:
This trick works for me under Vista Business to launch a DOS program without the annoying flashing DOS box.  Assumes CDK is an EXE.

Create a VBscript that starts the desired program in a hidden window (code below).
Use Wscript to launch the Vbscript

STRPCCMD PCCMD('wscript c:\runhidden.vbs') PAUSE(*NO)

Code for runhidden.vbs is below.
Const HIDDEN_WINDOW = 12
 
strComputer = "."
 
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
 
Set objStartup = objWMIService.Get("Win32_ProcessStartup")
Set objConfig = objStartup.SpawnInstance_
objConfig.ShowWindow = HIDDEN_WINDOW
 
Set objProcess = GetObject("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
 
objProcess.Create "C:\RMS400\CDK.EXE", null, objConfig, intProcessID

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tliottaCommented:
Gayathriadithya:

The [ RunDLL32.EXE Shell32.DLL,ShellExec_RunDLL ] shell functions work very well. As always with STRPCCMD, the 123-char limit on the command string still must be watched. The alternative RUNRMTCMD can often be more useful than STRPCCMD, particularly when you don't know if the remote system is a Windows PC.

Tom
Gary PattersonVP Technology / Senior Consultant Commented:
Tom's right - RUNRMTCMD is a nice solution where you can use it.  It runs as a service on Windows.

When I run a command-window program (as opposed to a Windows program) on Vista Business using

STRPCCMD 'RunDLL32.exe SHELL32.DLL,ShellExec_RunDLL ipconfig.exe') PAUSE(*NO)

I still get the annoying flashing DOS box that pops and quickly disappears.  Using the WSCRIPT technique above, there is no visible artifact shown on the user's screen, plus with the 123 character limit, that long call really eats up your workspace.

Of course, you may see different behavior on other versions of Windows.  Just thought I'd mention my results.

-Gary Patterson

GayathriadithyaAuthor Commented:
Thanks for your suggesstion, Excellent solution you have given.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Operating Systems

From novice to tech pro — start learning today.