Follow us on Facebook Follow us on Twitter SofoTex RSS Feeds Follow Us Login or Register



YahooPOPs! reviewReviews for YahooPOPs!

55555 Works like a charm!

Very nice feature, I was thinking of many ways to get my mail in outlook from yahoo.

Untill April 2002 the POP service was free, but then Yahoo decided to introduce a flat charge.

I am using my yahoo account since 95 and was not about to surrender it.

I have written 2 scripts for Outlook, the first one activates yahoo pops, the second one kills the process, so I launch the yahoopops only when I check my email and do not have it all the time in background.


Here is the code:

Public shell_str As String
Public Declare Function GetWindowText _
Lib "user32" _
Alias "GetWindowTextA" ( _
ByVal hWnd As Long, _
ByVal lpString As String, _
ByVal cch As Long _
) As Long
Public Declare Function FindWindow _
Lib "user32" _
Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String _
) As Long
Public Declare Function GetWindowThreadProcessId _
Lib "user32" ( _
ByVal hWnd As Long, _
lpdwProcessId As Long _
) As Long
Public Declare Function GetParent _
Lib "user32" ( _
ByVal hWnd As Long _
) As Long
Public Declare Function GetWindow _
Lib "user32.dll" ( _
ByVal hWnd As Long, _
ByVal wCmd As Long _
) As Long
Public Declare Function PostMessage _
Lib "user32" _
Alias "PostMessageA" ( _
ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any _
) As Long

Const WM_CLOSE = &H10
Sub Start_yahoo()
shell_str = Shell("C:Program FilesYahooPOPsYahooPOPs.exe", 0)
End Sub

Sub Kill_yahoo()
Dim proc_id As Long, win_handle As Long
Dim buf As String, buf_len As Long
proc_id = shell_str
' MsgBox proc_id
If proc_id = 0 Then
MsgBox "Error"
Exit Sub
End If
win_handle = HandleFromProcId(proc_id)
buf = Space$(256)
buf_len = GetWindowText(win_handle, buf, Len(buf))
buf = Left$(buf, buf_len)

PostMessage win_handle, WM_CLOSE, 0&, 0&
End Sub

'Return the window handle from the Shell function
'used from an examples found on API Viewer
Private Function HandleFromProcId(ByVal proc_id As Long) As _
Dim test_hwnd As Long
Dim test_pid As Long
Dim test_thread_id As Long
Const GW_HWNDNEXT As Long = 2

test_hwnd = FindWindow(ByVal vbNullString, ByVal vbNullString)

' Loop until we find the target or we run out
' of windows.
Do While test_hwnd <> 0
' See if this window has a parent. If not,
' it is a top-level window.
If GetParent(test_hwnd) = 0 Then
' This is a top-level window. See if
' it has the target instance handle.
test_thread_id = _
GetWindowThreadProcessId(test_hwnd, _

If test_pid = proc_id Then
' This is the target.
HandleFromProcId = test_hwnd
Exit Do
End If
End If

' Examine the next window.
test_hwnd = GetWindow(test_hwnd, GW_HWNDNEXT)
End Function

93 of 135 people found this review helpful


ReviewWrite a Review

poor 2 3 4 excellent

Type the letters and numbers shown on the left into the box on the right (this is to prevent automated submissions).
security image