Search code examples
vb.netsendkeys

send key strokes to a window in vb.net while it is still minimized


I used to know vb6 and I need to make a quick application. I hope someone can help me with how to send keys to a minimized window in vb.net

thanks


Solution

  • Normally you can send keys with the SendMessage API function, but I'm not sure if it would be affected in any way by the window being minimized, I don't think so but I haven't tried.
    To use a Windows API function from VB.Net you need to use PInvoke to call it, you can find information about how to do that on this page.

    The MSDN page for SendMessage might also be useful for information about how it works.

    Btw, you probably want to use the WM_CHAR message which is 0x0102.