Command-Line Arguments in CAB

Topics: CAB & Smart Client Software Factory
Jan 26, 2007 at 7:39 PM
Does anyone have an example of using command-line arguments in a CAB application? I know how to retrieve them in my Main() method, but I'm not sure how to pass them along to the rest of the app. From Main(), my program goes to the ModuleInit, then to the WorkItem.Run, but there doesn't seem to be anywhere to pass along the command-line arguments.

Thank you!
Jan 26, 2007 at 8:53 PM
Store the arguments in a local variable/datastructure when you capture them in Main(). Then override the AfterShellCreated method. From there, you could add the arguments to the RootWorkItem's Item collection. Once they are in the RootWorkItem's Item collection, any other objects down the hierarchy should be able to get them via Dependency Injection.

Jan 29, 2007 at 12:15 PM
Thank you, Chris! I'll give it a try.