Example visual basic .net code – Rockwell Automation ControlFLASH Firmware Upgrade Kit User Manual User Manual
Page 46
 
46
Rockwell Automation Publication 1756-UM105E-EN-E - October 2012
Appendix B Create a Custom Interface to Process Firmware Downloads
The tool then uses the System.Diagnostics.Process.Start function of the .NET 
framework to launch ControlFLASH software, giving as the arguments the path 
to the script file with a -T flag in front of it.
Example:
fileName = "C:\Program Files\ControlFLASH\ControlFLASH.exe"
arguments = "-T C:\samplescript.txt"
The tool then monitors the ControlFLASH process to detect when it has 
finished running so the tool can move on to the next step.
The easiest way to view the status of the flash upgrade by using this method is to 
edit the ControlFLASH script file and set SilentMode = 0 to use 
ControlFLASH software’s built in status display. 
If developers want to show the progress themselves, as the example tool does, they 
can use the registered window messages to show progress with external 
applications. Some knowledge of Microsoft Windows messages is needed.
ControlFLASH registers two Windows messages: WM_CFPROGRESS and 
WM_CFCOMPLETE. The WM_CFPROGRESS message is sent whenever 
ControlFLASH needs to report a change in progress of flashing a device. The 
WM_CFCOMPLETE message is sent whenever ControlFLASH finishes 
flashing a device. These messages can be received by any application that also 
registers messages of the same name.
Refer to MSDN:
http://msdn.microsoft.com/en-us/library/
ms644947(VS.85).aspx
where lpString is WM_CFPROGRESS or
WM_CFCOMPLETE
Example Visual Basic .NET Code
Private Declare Function RegisterWindowMessage Lib "user32" Alias 
"RegisterWindowMessageA" _
(ByVal lpString As String) As Integer
Dim WM_CF_PROGRESS As Integer = 
RegisterWindowMessage("WM_CFPROGRESS")
Dim WM_CF_COMPLETE As Integer = 
RegisterWindowMessage("WM_CFCOMPLETE")
WM_CF_PROGRESS and WM_CF_COMPLETE are simply variable names 
used to store the integer values associated with the messages.