vb.net - Visual Basic: run specific codes from exe file -
how can run specific codes exe file?
for example;
target shortcut runs mp3 file; "c:/thing/something.exe -music"
target shortcut runs bmp file; "c:/thing/something.exe -picture"
what can read command line arguments inside program when starts parse inputs make decision.
for example:
private sub form1_load(sender object, e eventargs) handles mybase.load dim commandlineargs system.collections.objectmodel.readonlycollection(of string) = my.application.commandlineargs if (string.compare(commandlineargs(0), "-picture") = 0) 'desired code picture here elseif (string.compare(commandlineargs(0), "-music") = 0) 'desired code music here end if end sub
if gave input -music c:\filepath\filename.mp3 commandlineargs(0) -music , commandlineargs(1) c:\filepath\filename.mp3. pass commandlineargs(1) program of choice play file (or use built in method play it).
Comments
Post a Comment