Calling sleep();

Product Compare Forums Multi-Edit Support Calling sleep();

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #834
    deleyd
    Participant

    How may I call the Win32 API Sleep() function? It was suggested I could do the following:

    void test()
    {
    TEXT(“START “);
    sleep(1000);
    TEXT(” END”);
    }

    but the CMAC compiler complains about the call to sleep(1000). Is there something else special I need to add to the above code to make it compile?

    #3169
    DanHughes
    Participant

    Try the following
    [code:benfgy2p]
    import void Sleep( DWord dwMilliseconds )
    Kernel32 ‘Sleep’;

    void TstSleep( )
    /******************************************************************************
    Multi-Edit Macro
    05-Sep-03 11:56

    Function: Test the Sleep Window API
    Entry : None
    Exit : None
    Author : Dan Hughes

    Copyright (C) 2003 by Multi Edit Software, Inc
    *******************************************************************( ldh )***/
    {
    Make_Message( ‘Sleeping now...’ );
    Sleep( 1000 );
    Make_Message( ” );

    } // TstSleep

    [/code:benfgy2p]

    #3176
    ReidSweatman
    Participant

    Quick addendum to what Dan said: the reason your original code didn’t work is that sleep() is a Windows API function not imported into Multi-Edit by default. The method he demonstrated is how you would import most other Windows functions that aren’t already exposed in Multi-Edit’s API.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.