タイトル | : Re^3: スプラッシュスクリーンで最前面にならない |
記事No | : 10174 |
投稿日 | : 2010/07/01(Thu) 22:25 |
投稿者 | : YAS |
ひろこさん,こんばんは。 下のようにして,Me.Activate2()としたらどうでしょう?
<DllImport("user32.dll")> Public Shared Function AttachThreadInput(ByVal idAttach As Integer, ByVal idAttachTo As Integer, ByVal fAttach As Boolean) As Boolean End Function <DllImport("user32.dll")> Public Shared Function GetForegroundWindow() As IntPtr End Function <DllImport("user32.dll")> Public Shared Function GetWindowThreadProcessId(ByVal hwnd As IntPtr, ByRef lpdwProcessId As Integer) As Integer End Function
Private Sub Activate2() Dim targetThreadProcessId As Integer = GetWindowThreadProcessId(GetForegroundWindow(), IntPtr.Zero.ToInt32) Dim ThreadProcessId As Integer = GetWindowThreadProcessId(Me.Handle, 0&) AttachThreadInput(ThreadProcessId, targetThreadProcessId, True) Me.Activate() AttachThreadInput(ThreadProcessId, targetThreadProcessId, False) End Sub
|