Code Snippet Needed 
Author Message
 Code Snippet Needed

I am looking for some code that positions a window on top of all other forms
but is NOT modal. Can someone point me to a website or link to some example
code?

Thanks,

Dave



Wed, 21 Apr 2004 09:41:03 GMT  
 Code Snippet Needed
This should do it ...at least until the next application calls the same
function   :-)

Private Declare Function SetWindowPos Lib "user32" _
   (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, _
    ByVal X As Long, ByVal Y As Long, ByVal cx As Long, _
    ByVal cy As Long, ByVal wFlags As Long) As Long

Public Sub MakeFormTopMost(hWnd As Long, _
                           Optional topmost As Boolean = True)

   Const HWND_TOPMOST = -1
   Const HWND_NOTOPMOST = -2
   Const SWP_NOMOVE = &H2
   Const SWP_NOSIZE = &H1

   If topmost Then
      SetWindowPos hWnd, HWND_TOPMOST, 0, 0, 0, 0, _
                        SWP_NOMOVE Or SWP_NOSIZE
   Else
      SetWindowPos hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, _
                        SWP_NOMOVE Or SWP_NOSIZE
   End If

End Sub


Quote:
> I am looking for some code that positions a window on top of all other
forms
> but is NOT modal. Can someone point me to a website or link to some
example
> code?

> Thanks,

> Dave



Wed, 21 Apr 2004 10:54:34 GMT  
 Code Snippet Needed
Thanks!!!


Quote:
> This should do it ...at least until the next application calls the same
> function   :-)

> Private Declare Function SetWindowPos Lib "user32" _
>    (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, _
>     ByVal X As Long, ByVal Y As Long, ByVal cx As Long, _
>     ByVal cy As Long, ByVal wFlags As Long) As Long

> Public Sub MakeFormTopMost(hWnd As Long, _
>                            Optional topmost As Boolean = True)

>    Const HWND_TOPMOST = -1
>    Const HWND_NOTOPMOST = -2
>    Const SWP_NOMOVE = &H2
>    Const SWP_NOSIZE = &H1

>    If topmost Then
>       SetWindowPos hWnd, HWND_TOPMOST, 0, 0, 0, 0, _
>                         SWP_NOMOVE Or SWP_NOSIZE
>    Else
>       SetWindowPos hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, _
>                         SWP_NOMOVE Or SWP_NOSIZE
>    End If

> End Sub



> > I am looking for some code that positions a window on top of all other
> forms
> > but is NOT modal. Can someone point me to a website or link to some
> example
> > code?

> > Thanks,

> > Dave



Wed, 21 Apr 2004 10:54:48 GMT  
 Code Snippet Needed
I usually "cheat a bit", Hugh, by using a Timer to repeatedly set a Form to
Always on Top. A bit {*filter*}, but nice - and great fun if the user happens
to be also running another application that does the same ;-)

Mike


Quote:
> This should do it ...at least until the next application calls the same
> function   :-)

> Private Declare Function SetWindowPos Lib "user32" _
>    (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, _
>     ByVal X As Long, ByVal Y As Long, ByVal cx As Long, _
>     ByVal cy As Long, ByVal wFlags As Long) As Long

> Public Sub MakeFormTopMost(hWnd As Long, _
>                            Optional topmost As Boolean = True)

>    Const HWND_TOPMOST = -1
>    Const HWND_NOTOPMOST = -2
>    Const SWP_NOMOVE = &H2
>    Const SWP_NOSIZE = &H1

>    If topmost Then
>       SetWindowPos hWnd, HWND_TOPMOST, 0, 0, 0, 0, _
>                         SWP_NOMOVE Or SWP_NOSIZE
>    Else
>       SetWindowPos hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, _
>                         SWP_NOMOVE Or SWP_NOSIZE
>    End If

> End Sub



> > I am looking for some code that positions a window on top of all other
> forms
> > but is NOT modal. Can someone point me to a website or link to some
> example
> > code?

> > Thanks,

> > Dave



Wed, 21 Apr 2004 11:55:18 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Code Snippet Needed

2. Need code snippet for benchmarking a process.

3. Code Database Program - Store your code Snippets

4. Code Database Program- Store your code snippets

5. samples code snippets?

6. combobox: converting code snippet from VBA to VB

7. Code Snippet: Browse for Folder

8. Code snippet storage

9. Network Adapter MAC address code snippet

10. whats wrong in this code snippet?

11. Looking for code snippet to parse sentence into words

12. Liberty BASIC code snippet

 

 
Powered by phpBB® Forum Software