Show form (Topmost), running code (ADO, API etc), but not active (I not stealing keyboard focus).

HI Guys

I am trying to write a word shorthand autocompletion program, and need a form with a database driven list box to provide expansion strings. as the user types
eg. atineof =  and there is no evidence of

My problem, is that my app needs to remain on top, but not be stealing the keyboard focus,

I believe that vb NET has the SHOWNOACTIVATE  or the SHOWWITHOUTACTIVATION stuff,
but how do I implement this in VB6.

Some code I have borrowed from the Net is included here,

'**********
private const int SW_SHOWNOACTIVATE = 4;
private const int HWND_TOPMOST = -1;
private const uint SWP_NOACTIVATE = 0x0010;

[DllImport("user32.dll", EntryPoint = "SetWindowPos")]
static extern bool SetWindowPos(
int hWnd, // window handle
int hWndInsertAfter, // placement-order handle
int X, // horizontal position
int Y, // vertical position
int cx, // width
int cy, // height
uint uFlags); // window positioning flags

[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

static void ShowInactiveTopmost(Form frm)
{
ShowWindow(frm.Handle, SW_SHOWNOACTIVATE);
SetWindowPos(frm.Handle.ToInt32(), HWND_TOPMOST,
frm.Left, frm.Top, frm.Width, frm.Height,
SWP_NOACTIVATE);
}
********

This may be C++ or VB.NET code.

Can some body please help me with a good vb6 method that works

Many thanks

Simpath
simpathAsked:
Who is Participating?
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
0
 
simpathAuthor Commented:
Dear Idle Mind

Thank you so much for your prompt response and help = AWESOME

Simpath
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.