I've put together a VB6 application that controls my workstation imaging using ImageX. I currently have a app written in AutoIT that control it but it's fiddly to update. One of the things the AutoIT script does is reads the output of ImageX so I can increment a progress bar. I'd like to be able to do the same in VB6 and have managed it to a point, in so far as I can read the output if there is an error (which was intentional so I could check that it worked!).
I found a piece of code called GetCommandOutput (written by Joacim Andersson) which I use to read the output. I run into problems when I try and run ImageX with a valid image so it will progress. Rather than incrementing my progress bar, it hangs the form because (I'm assuming) it doesn't reach the portion of the code where it does this task.
Looking at the code I found, Joacim suggests that in order to stop the form hanging, the GetCommandOutput class should be run as an ActiveX EXE asynchronously. Because there was no info on how to run an ActiveX app from a standard one (I've no experience in this) I found another article that explained. I followed the instructions and it worked in a STANDARD windows environment. When I ran the same app in WinPE (2.0) it complains that it can't create the ActiveX Object (Run-time error '429').
I've played around a bit to try and get this to work. One method was to create an OCX in VB6 as I figured that that might help as you can register the OCX using regsvr32. This got rid of the error but the form hung again (I'm assuming because the OCX would be properly embedded?).
So back to the ActiveX EXE.
Dim ProgLoad as commandoutput 'calls the ActiveX .. Set ProgLoad = New commandoutput .. .. ix = ProgLoad.GetCommandOutput("imagex.exe /apply i:\xpprep0.wim 1 c:", true, false,false) 'GetCommandOutput is the function inside commandoutput .. 'Loop through the output array which breaks down the output so I can find the %'ge figure.
If you need to see the GetCommandOutput code then I'll paste it, but since it works in a standard environment then I didn't see the point.
But that's where I'm at. Regardless of what I do, the form hangs or I get a 429 error.
Basically if someone could help me to get the ActiveX EXE running from the Standard app in a WinPE environment so the form doesn't hang and I can see the output then I'd be happy.