flash a screen

This is a discussion on flash a screen within the Windows Programming forums, part of the Platform Specific Boards category; hi all, i want to flash a screen with picture for few mins in mfc program, is there any method ...

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    74

    flash a screen

    hi all,
    i want to flash a screen with picture for few mins in mfc program, is there any method can do that? thanks!!

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,420
    What does "flash a screen" mean? Pop up a typical splash window or something?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,592
    I think so.

    So just set a timer in the flash window after creating it for how ever long you want it up, then make the timer message kill the window.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  4. #4
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    You writing adware?
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  5. #5
    Registered User
    Join Date
    Nov 2007
    Posts
    74
    thanks for reply, actually i'm writing mfc smart device that i want to have a splash screen before the application start, but i found that traditional mfc splash screen code which just splash bitmap can't work on smart device, so i think using dialogue to set timer is right, but i dun know how to use timer on this issue, can any body help me? thanks!!

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Use mfc's CWnd::SetTimer() and use OnTimer to "catch" the timer - at that point, close the window and kill the timer (CWnd::KillTimer()). Make sure you pick a unique timer ID, in case there are other timers running in the system.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Registered User
    Join Date
    Nov 2007
    Posts
    74
    Quote Originally Posted by matsp View Post
    Use mfc's CWnd::SetTimer() and use OnTimer to "catch" the timer - at that point, close the window and kill the timer (CWnd::KillTimer()). Make sure you pick a unique timer ID, in case there are other timers running in the system.

    --
    Mats
    yes thanks, but where should i place the settimer and killtimer in the class? i 'd tried to put the functions call in the oninitdialog but it does not work as expected...can anyone tell me where should i put them? thanks!!

  8. #8
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,420
    It doesn't matter.
    SetTimer will initiate a timer of n seconds. It will then either send a message or do a callback to a function of choice.
    All you need to do is catch that message. MFC will call the OnTimer function when it receives such a message.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  9. #9
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    Assuming you want modless splash dlg to allow app to continue and do not want to ownerdraw image.

    I would try......

    Add the splash image as a bitmap resource.
    Open bitmap in resource editor
    Set the ID.

    Insert a new dialog into project.
    Open dialog in resource editor
    Remove the buttons from dialog and set style required (Border = none, application window = false, topmost = true).
    Set the ID.
    Add a Picture control over all of dialogs client area.
    In Picture boxes properties set style (type = bitmap and Image = to your images ID)

    Create a class derived from CDialog for your splash screen (ie CSplashDlg) using the new dialogs ID
    Add handlers for OnTimer() [WM_TIMER] and OnInitDialog() [WM_INITDIALOG]
    Add header to main app

    Either call CSplashDlg as local or member (in main apps InitInstance() or as required)
    [edit: I would call it from the main apps InitInstance().
    Remove the calls to ShowWindow(SW_MAXIMIZE) and UpdateWindow()]

    [This example is CSplashDlg killing itself, you could also have the main app kill CSplashDlg when required. The running CSplashDlg would have to be a member of the main app.]

    CSplashDlg::OnInitDialog()
    StartTimer()

    CSplashDlg::OnTimer()
    //kill this one
    KillTimer() [best not to leave it hanging round]
    DestroyWindow() (or EndDialog if used DoModal)
    [edit:
    //show main app
    GetParent()->ShowWindow()
    GetParent()->UpdateWindow()]
    Last edited by novacain; 05-02-2008 at 02:58 AM.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Feedback: Functional Specification Wording
    By Ragsdale85 in forum C++ Programming
    Replies: 0
    Last Post: 01-18-2006, 03:56 PM
  2. char copy
    By variable in forum C Programming
    Replies: 8
    Last Post: 02-06-2005, 09:18 PM
  3. i am not able to figure ot the starting point of this
    By youngashish in forum C++ Programming
    Replies: 7
    Last Post: 10-07-2004, 02:41 AM
  4. Converting from Screen to World Coordinates
    By DavidP in forum Game Programming
    Replies: 9
    Last Post: 05-11-2004, 12:51 PM
  5. Flash display in DOS screen
    By lordkrishna in forum C++ Programming
    Replies: 9
    Last Post: 02-23-2004, 02:10 AM

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