MyTetra Share
Делитесь знаниями!
Сделать стороннее приложение поверх всех окон
Время создания: 24.03.2018 23:11
Раздел: VB
Запись: xintrea/mytetra_db_adgaver_new/master/base/15219222641446x94prn/text.html на raw.githubusercontent.com

Сделать стороннее приложение поверх всех окон


3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

Imports System.Runtime.InteropServices

 

Public Class Form1

    <DllImport("user32.dll", SetLastError:=True)> _

Public Shared Function SetWindowPos(ByVal hWnd As IntPtr, ByVal hWndInsertAfter As IntPtr, ByVal X As Integer, ByVal Y As Integer, ByVal W As Integer, ByVal H As Integer, _

ByVal uFlags As UInteger) As Boolean

    End Function

 

    <DllImport("USER32.DLL", CharSet:=CharSet.Unicode)> _

    Public Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As IntPtr

    End Function

 

    Private Const HWND_TOPMOST = -1

    Private Const HWND_NOTOPMOST = -2

    Private Const SWP_NOMOVE = &H2

    Private Const SWP_NOSIZE = &H1

    Private Const SWP_NOACTIVATE = &H10

    Private Const SWP_SHOWWINDOW = &H40

    Private Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE

 

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim hwnd As IntPtr = FindWindow(Nothing, "Калькулятор")

        If hwnd = IntPtr.Zero Then

            MsgBox("Calculator not found")

        Else

            SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)

        End If

    End Sub

End Class

Так же в этом разделе:
 
MyTetra Share v.0.65
Яндекс индекс цитирования