Announcement

Collapse
No announcement yet.

WaitForSingleObject

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Michael Mattias
    replied
    Duh.

    I guess renaming that MACRO BITSE might make some sense, wouldn't it?

    Would sure make upgrading to CC/5 or Win/9 a bit easier.

    Leave a comment:


  • Michael Mattias
    replied
    "AS LONG" is the ONLY way to go in message-processing loops; this becomes really significant when working with any of the Microsoft Common Controls (listview, treeview, header, etc), as almost all the 'notification codes' passed in the NMHDR.code value in lparam of the WM_NOTIFY message are "negative" when viewed as signed.

    I see that in PB/Win 9x there is also now a function to deal with signed comparisons: the BITSE function.

    No Pb/Win 9x or CC/5x?

    Code:
    MACRO eq32 (a, b) =  BITS???(a) = BITS???(b) 
    ...
        IF eq32 (X, Y) THEN ...
    (Macro courtesy Tom Hanlin, a long time ago, right here).

    MCM

    Leave a comment:


  • Joerg Koehler
    replied
    Thanks guys!

    @Micheal
    Haven't heard about SELECT CASE AS LONG before.
    I'll respect this in the future.

    Joerg

    Leave a comment:


  • Michael Mattias
    replied
    Avoid Long/DWORD problems like this with...

    Code:
     LOCAL iret   AS  LONG or DWORD 
    
       iRet  = WaitForSingleObject (hObj, TimeOutVal) 
       SELECT CASE [b]AS LONG[/b] iret 
           CASE %WAIT_OBJECT_0 
           CASE %WAIT_TIMEOUT
           CASE %WAIT_FAILED
    SELECT CASE AS LONG does 32-bit comparisons; SELECT CASE does signed comparisons (PB/WIn 7+ only. Prior versions always did 32-bit compares).

    FWIW, "SELECT CASE AS LONG" also executes more quickly than "SELECT CASE", not that it would be terribly significant in this case.




    MCM

    Leave a comment:


  • Dave Biggs
    replied
    From the SDK docs: "'If the function fails, the return value is WAIT_FAILED. To get extended error information, call GetLastError".

    From WIN32API.INC: %WAIT_FAILED = &HFFFFFFFF??? ( ie -1& )

    Leave a comment:


  • Joerg Koehler
    replied
    The problems sit in front of the computer
    If I declare the return value as DWORD, the return value of -1
    becomes %WAIT_FAILED....

    Thx
    Joerg

    Leave a comment:


  • Joerg Koehler
    started a topic WaitForSingleObject

    WaitForSingleObject

    Hello,

    I use WaitForSingleObject to control a looped thread.
    Under some circumstances WaitForSingleObject returns the value -1.
    What is this value for?

    Thanks
    Joerg
Working...
X