none
How to put Macro to Sleep or pause or Wait RRS feed

  • Question

  • I am creatnig a fancy Project professional macro for a demo. I want it to change the background colors.  I need a macro to pause for a second before going to the next cell and changing the background color.

    Any suggestions on how to implement a timer within project?

    Touche!

    Michael Wharton, MBA, PMP, MCT


    Sincerely, Michael Wharton, MBA, PMP, MCT, MCSD, MCSE+I, MCDBA www.WhartonComputer.com
    Monday, August 23, 2010 4:04 PM
    Moderator

Answers

  • Never mind.  Find the answer in the project help.

    Dim PauseTime, Start, Finish, TotalTime
    If (MsgBox("Press Yes to pause for 5 seconds", 4)) = vbYes Then
      PauseTime = 5  ' Set duration.
      Start = Timer  ' Set start time.
      Do While Timer < Start + PauseTime
        DoEvents  ' Yield to other processes.
      Loop
      Finish = Timer  ' Set end time.
      TotalTime = Finish - Start  ' Calculate total time.
      MsgBox "Paused for " & TotalTime & " seconds"
    Else
      End
    End If
    

    Thanks

     


    Sincerely, Michael Wharton, MBA, PMP, MCT, MCSD, MCSE+I, MCDBA www.WhartonComputer.com
    Monday, August 23, 2010 4:08 PM
    Moderator

All replies

  • Never mind.  Find the answer in the project help.

    Dim PauseTime, Start, Finish, TotalTime
    If (MsgBox("Press Yes to pause for 5 seconds", 4)) = vbYes Then
      PauseTime = 5  ' Set duration.
      Start = Timer  ' Set start time.
      Do While Timer < Start + PauseTime
        DoEvents  ' Yield to other processes.
      Loop
      Finish = Timer  ' Set end time.
      TotalTime = Finish - Start  ' Calculate total time.
      MsgBox "Paused for " & TotalTime & " seconds"
    Else
      End
    End If
    

    Thanks

     


    Sincerely, Michael Wharton, MBA, PMP, MCT, MCSD, MCSE+I, MCDBA www.WhartonComputer.com
    Monday, August 23, 2010 4:08 PM
    Moderator
  • I add this to provide color macros and template headers for Desktop Apps and Console Apps.

    Macro

    ypedef struct tagRGBA {
    INT rgbBlue;
    INT rgbGreen;
    INT rgbRed;
    INT rgbAlpha;
    } RGBA;

    template<class RGBA>
    inline void
    GetRGBValue(RGBA **ppInterfaceToRelease)
    {
    if (*ppInterfaceToRelease != NULL)
    {
    (*ppInterfaceToRelease)->Release();

    (*ppInterfaceToRelease) = NULL;
    }
    }

    RGBA *rgb1 = new RGBA();
    delete rgb1;

    Headers

    // stdafx.h : include file for standard system include files,
    // or project specific include files that are used frequently, but
    // are changed infrequently
    //

    #pragma once

    #include "targetver.h"

    #define WIN32_LEAN_AND_MEAN             // Exclude rarely-used stuff from Windows headers
    // Windows Header Files:
    #include <windows.h>
    #include <vector>
    #include <fstream>
    #include <cstring>
    // C RunTime Header Files
    #include <stdlib.h>
    #include <malloc.h>
    #include <memory.h>
    #include <tchar.h>
    #include <strsafe.h>

    #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // some CString constructors will be explicit

    #include <atlbase.h>
    #include <atlstr.h>

    // TODO: reference additional headers your program requires here

    For Console add #include <iostream> to .cpp

    Yours Francois.

    Friday, June 5, 2020 11:01 PM
  • For DirectX you need to use RESUME. Any DirectX 11 apps support RESUME.

    Francois.

    Friday, June 5, 2020 11:12 PM