Hi

I have a program running that refreshes when it has focus and F5 is selected. I want to do this without it having focus from a VB6 program

The handle is returned OK but the sendmessage does not refresh the program. I also tried using postmessage to no avail.
Private Declare Function SendMessage Lib "user32" Alias _
         "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _
         ByVal wParam As Long, lParam As Long) As Long

Dim hWnd As Long

hWnd = FindWindow(vbNullString, "ProgramName")

Call SendMessage(hWnd, WM_CHAR, vbKeyF5, 0)

any ideas please?

I read your code and line 7 looks suspect. Very few apps would have a window title of "ProgramName". So my bet is that's why it doesn't work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.