Message boxes

I currently have my ISP through Netzero..(Free Internet).   It is pretty cool.   But one problem is after about  30min-45min their program(Netzero) pops up a message box saying "Your connection has been inactive.  Please click Resume button to stay online..."  Or something like that.....They do this to make sure you are online.  So this really sucks for big down loads.  The message box will pop up and give you 60 seconds to press resume, also I can go to the task manager or task list and see that the message box shows up in the task list titled "Netzero Inactivity Warning".   My question is...
I already have a DLL that can check to see if a process is running....I now want to write a VB program that will use the dll...basicly put it on a timer every 45 seconds it will scan to see if the process "Netzero Inactivity Warning" is running...
How do I get VB to click the Resume Button on that message box.  Resume Button is the only button on the message box..  When a message comes up...."Netzero Inactivity Warning" message box has focus.  Can I tell VB to execute a Enter key on my keyboard???
strongdAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hesCommented:
Use Sendkeys
SendKeys "{ENTER}"
0
hesCommented:
To do it all from VB
Declare the following
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
         (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Code:

Private Sub Timer1_Timer()
  Dim lRet As Long
 
  lRet = FindWindow(vbNullString, "Netzero Inactivity Warning" )
 
  If (lRet <> 0) Then
 
   SendKeys "{ENTER}"
  End If
End Sub
0
MarineCommented:
You can also use a SendMessage API after you find the handle of that button and send i thinkmessage wm_button i think to click that button to stay on line.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

rmichelsCommented:
The only problem with the sendkeys is you need to make sure the Netzero message box has the keyboard focus.

There is a windows API to do that but it escapes my memory.
0
ryanvsCommented:
Using an API will work better.  There are two catches.  One is that you need to have handle to the window for the message box.  Two is that you need to know the control ID of the button that you want VB to press.  Getting the hwnd isn't difficult and I'm going to assume you can do this (but if you need some help just ask).  The control ID is usually 1 for OK and similar messages.  You can use Spy++ (under Visual Studio Tools) and use the find window and select the button you want to press.  Under Window Properties is a value called Control ID which is the value you want.

So, to make a long story short...

Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long

Public Const WM_COMMAND = &H111

Dim hwnd As Long
Dim lCtrlID As Long
Dim lResult As Long

' hwnd = FindMessageBox...
lResult = SendMessage(hwnd, WM_COMMAND, ByVal lCtrlID, ByVal 0&)

' Zero lResult means application processed message, but not necessarily a success.  
' Although when I tested this, it worked and it returned 1.  Your mileage may vary


Here is a little documentation on wParam and lParam for WM_COMMAND:

wParam
The high-order word specifies the notification code if the message is from a control. If the message is from an accelerator, this value is 1. If the message is from a menu, this value is zero.
The low-order word specifies the identifier of the menu item, control, or accelerator.

lParam
Handle to the control sending the message if the message is from a control. Otherwise, this parameter is NULL.


Good luck.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
strongdAuthor Commented:
Thanks I think this wil work...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.