startup script to launch .swf file

This is a discussion on startup script to launch .swf file within the C Programming forums, part of the General Programming Boards category; Hi, My friend wants to launch upon booting windows an .swf file he created by creating an .exe that basically ...

  1. #1
    Registered User cDev's Avatar
    Join Date
    Jun 2006
    Posts
    26

    startup script to launch .swf file

    Hi,
    My friend wants to launch upon booting windows an .swf file he created by creating an .exe that basically says (launch whatever.swf in new window.) Is this something that can be done in C, or is it more along the lines of Windows shell scripting (something I know nothing about?) Thanks for any and all help.

  2. #2
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    .swf files aren't executable, and on my system, aren't associated with anything. What exactly are you wanting to do? Open it in a browser window?
    If you want to open it in say, IE, you could create a shortcut and place it in the Startup folder in the start menu so it runs on boot. Make the target something like:
    "C:\Program Files\Internet Explorer\Iexplore.exe" "Path\To\swf\file"

    To do it in a program, you could call CreateProcess() / or ShellExecute()(?) and then place the program in the start menu. (But the shortcut seems easier...)
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,439
    You mean like put the exe into the startup group ?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User cDev's Avatar
    Join Date
    Jun 2006
    Posts
    26
    Well, he has about 7 swf files, so he wants to make it so upon startup the exe will launch a certain swf file; I believe a different one every day of the week. Salem, you are correct, he wants to put the exe into the startup group. I think you are right Cactus_Hugger, that unless you have Flash then .swf won't be associated with anything. HMMM...
    Thanks for your help fellas

  5. #5
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    Even with flash, .swf files don't get an association. (At least not on my box.) IE/Firefox/Your browser here will open them, however. The above shortcut does run the swf file, it runs IE, and instructs IE to open the .swf file. To change out depending on the day, you could either create an HTML file with some fancy javascript to print out the corresponding .swf, or use a program and launch the swf from there.
    Code:
    SYSTEMTIME stime;
    char *filenames[] = {"Sunday.swf", "Monday.swf", "etc, etc" ... };
    
    GetLocalTime(&stime);
    CreateProcess("C:\\Program files\\Internet Explorer\\Iexplore.exe", filenames[stime.wDayOfWeek], NULL, NULL, FALSE, 0, NULL, "Path\\to\\swf\\files", NULL, NULL);
    Didn't test that, but hopefully you get the idea. filenames should have 7 strings.
    You can also make the current directory argument null and specify full filenames if that doesn't work. As always, read the manual.
    Last edited by Cactus_Hugger; 07-26-2006 at 12:31 PM.
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  6. #6
    Registered User cDev's Avatar
    Join Date
    Jun 2006
    Posts
    26
    Thanks Cactus_Hugger,
    I think my friend is going to go the IE shortcut route, but thanks for the code snippet; I will test it out myself what the heck it could come in handy

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File being filled with NULLs
    By Tigers! in forum Windows Programming
    Replies: 2
    Last Post: 06-30-2009, 05:28 PM
  2. Newbie homework help
    By fossage in forum C Programming
    Replies: 3
    Last Post: 04-30-2009, 04:27 PM
  3. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  4. Basic text file encoder
    By Abda92 in forum C Programming
    Replies: 15
    Last Post: 05-22-2007, 01:19 PM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21