NTK and The NTK Project
are properties of Jn Dechereux
Home | Documentation | FAQ.

Vanilla 1.1.8 is a product of Lussumo. More Information: Documentation, Community Support.

Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    •  
      CommentAuthorLucas
    • CommentTimeApr 30th 2013
     
    Hi all:

    I'm new to NTK and I'm currently migrating with good success the config module of a huge Clipper S87/db3 program i wrote years ago. so sorry if this is a stupid question for you guys but would like to know how to determine if a window is topmost?

    TIA, Lucas
    •  
      CommentAuthorLucas
    • CommentTimeApr 30th 2013
     
    Also, found this on the net:
    DWORD dwExStyle = ::GetWindowLong(m_hWnd, GWL_EXSTYLE);

    if ((dwExStyle & WS_EX_TOPMOST) != 0)
    {
    // do stuff
    }

    but not sure about it and as i'm not a C++ expert don't know how to convert this code for NTK.
    Can anyone help me?

    thanks
    Lucas
    •  
      CommentAuthorAbbougaga
    • CommentTimeMay 1st 2013
     
    Hi Lucas

    Indeed, it's a well known tip. But, your C++ sample has rather to do with the MFC syntax. Anyway, it can be easily adapted for NTK, this way:
    if NTK_And( NTK_GetWindowLong(hWnd, GWL_EXSTYLE), WS_EX_TOPMOST ) != 0
    ... // The window is topmost.
    else
    ... // The window is not topmost.
    endif
    

    Hope this helps.

    Cheers,
    Ab
    •  
      CommentAuthorLucas
    • CommentTimeMay 2nd 2013
     
    Dear Ab,
    Many thanks for this helpful tip. Just another novice question:
    At the moment I use "CREATE WINDOW" with the WS_EX_TOPMOST style to force my program always running in foreground. Works great. But what i really would like to do is to offer the operator the ability to alternatively switch from Topmost/Not topmost mode by pressing a toggle button or invoking the attached hotkey/super accel.
    Unfortunately I didn't find any samples that show explicitly how to set the current foreground window to be Topmost/Not topmost. Do you know a function or command capable to do that?

    Rgds,
    Lucas
    •  
      CommentAuthorAbbougaga
    • CommentTimeMay 3rd 2013
     
    Hi,

    Well, I think the NTK_SetWindowPos() API should do the job.

    e.g.
    // Make topmost
    NTK_SetWindowPos(hwnd, HWND_TOPMOST,0,0,0,0,SWP_NOMOVE+SWP_NOSIZE)
    
    // Revert back
    NTK_SetWindowPos(hwnd, HWND_NOTOPMOST,0,0,0,0,SWP_NOMOVE+SWP_NOSIZE)
    

    Hope this helps.

    Cheers,
    Ab
    •  
      CommentAuthorLucas
    • CommentTimeMay 3rd 2013
     
    Ab:
    Works nicely. Thank you very much for pointing that out.

    Lucas