I have created a piece of software which uses windows calls to give focus to different windows at different points of time. Clicking a button in one application may trigger another application to gain focus.
This actually works pretty well, however some times it results in the window getting focus however none of the buttons can be pressed, it seems as it is a window out of focus however it is the top one. Now the really wierd part is that by minimizing one of the other Applications the focus to the one with the problem is restored and one can continue.
Does anyone have any idea what could be the cause of this ?
This is the code which causes the conflict
Private Declare Function BringWindowToTop Lib "user32" (ByVal hwnd As Long) As Long
Public Function switchToCash(billToOpen As Long, Optional person_id As Long)
On Error Resume Next
On Error GoTo here
Dim nrs As New ADODB.Recordset
If person_id <> 0 Then
frmFront.storedPID = person_id
ElseIf frmBusinessView.currentSetup.persLog Then
If frmBusinessView.currentSetup.persCheckedIN Then
nrs.Open "select personale_navn,personale_id from personale_db where personale_id in(select person_id from checks where checkedOut is null)", frmFront.bookingCnxn
nrs.Open "select personale_navn,personale_id from personale_db", frmFront.bookingCnxn
If nrs.EOF Then
MsgBox "Der er intet personale checket ind"
frmFront.storedPID = frmPersLogin.create(frmBusinessView)
frmFront.tableID = -1
frmFront.currentBill = billToOpen
frmFront.Hide ''1, frmBusinessView
frmFront.Show 1, frmBusinessView
MsgBox "Der opstod en fejl..." & vbNewLine & Err.Description