noticed Doom posting code to set display status in C++, I figured I would post the VB codes as well.
Code:
option explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpData As Any, ByVal cbData As Long) As Long
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Any, lpcbData As Long) As Long
Private Const HKEY_CURRENT_USER = &H80000001
Private Const WM_COMMAND = &H111
Private hCurKey As Long ' Not API
Private Const REG_SZ = 1
Private Const REG_BINARY = 3
Private Const REG_DWORD = 4
Public Sub DisplayMessage(Message As String)
Dim mhWnd As Long ' Window's Handle
Dim lngValueType As Long
Dim strBuffer As String
Dim lngDataBufferSize As Long
Dim intZeroPos As Integer
Dim LastSettingLog As String
mhWnd = FindWindow("yahoobuddymain", vbNullString)
If IsEmpty("Yahoo! ID") Then LastSettingLog = vbNullString
RegOpenKey HKEY_CURRENT_USER, "Software\Yahoo\Pager", hCurKey
RegQueryValueEx hCurKey, "Yahoo! User ID", 0&, lngValueType, ByVal 0&, lngDataBufferSize
If lngValueType = REG_SZ Then
strBuffer = String(lngDataBufferSize, " ")
RegQueryValueEx hCurKey, "Yahoo! User ID", 0&, 0&, ByVal strBuffer, lngDataBufferSize
intZeroPos = InStr(strBuffer, Chr$(0))
If intZeroPos > 0 Then LastSettingLog = Left$(strBuffer, intZeroPos - 1) Else LastSettingLog = strBuffer
End If
RegCloseKey hCurKey
RegCreateKey HKEY_CURRENT_USER, "Software\Yahoo\Pager\profiles\" + LastSettingLog + "\Custom Msgs", hCurKey
RegSetValueEx hCurKey, 1, 0, REG_SZ, ByVal Message, Len(Message)
RegCloseKey hCurKey
SendMessage mhWnd, WM_COMMAND, 388, 1&
End SubFrom the the program:
call DisplayMessage("Hey Hey")__________________