Here's VB code that calls windows API functions, should be relatively easy to translate (note, this is untested, found on forums, also, you may have issues with the cursor appearing).
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
Const HWND_TOPMOST = -1
Const SWP_NOMOVE = &H2
Const SWP_NOSIZE = &H1
Private Sub Form_Load()
Call SetWindowPos(Form1.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE)
End Sub
Create a timer with interval 1, with the following code:
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Sub Timer1_Timer()
Dim mhwnd As Long
mhwnd = GetForegroundWindow SetParent Form1.hwnd, mhwnd
End Sub
Code translated below (via automated tool):
const long HWND_TOPMOST = -1;
const long SWP_NOMOVE = 2;
const long SWP_NOSIZE = 1;
[DllImport("user32.dll")]
private static extern long SetWindowPos(long hwnd, long hWndInsertAfter, long X, long Y, long cx, long cy, long wFlags);
private void Form_Load() {
SetWindowPos(Form1.hwnd, HWND_TOPMOST, 0, 0, 0, 0, (SWP_NOMOVE | SWP_NOSIZE));
}
[DllImport("user32.dll")]
private static extern long SetParent(long hWndChild, long hWndNewParent);
[DllImport("user32.dll")]
private static extern long GetForegroundWindow();
private void Timer1_Timer() {
long mhwnd;
mhwnd = GetForegroundWindow;
SetParent;
Form1.hwnd;
mhwnd;
}