All pastes #1468400 Raw Edit

segin

public text v1 · immutable
#1468400 ·published 2009-06-21 04:38 UTC
rendered paste body
#include once "windows.bi"
#include once "crt.bi"

Function WAIntProc StdCall(hWnd As HWND, uMsg As UINT, wParam As WPARAM, lParam As LPARAM) As LRESULT
   Printf(!"hwnd = %#x, umsg = %d, wParam = %#x, lParam = %#x\n",hWnd, uMsg, wParam, lParam) 
End Function

Sub InitKVIrcWinampInterface Alias "InitKVIrcWinampInterface" ()
   Static WAWindow As HWND
   Dim As WNDCLASSEX WAClass 
   Dim As ATOM a
   Dim As Dword WINERR
   
   With WAClass 
      .cbSize = SizeOf(WNDCLASSEX)
      .style = 0
      .lpfnWndProc = @WAIntProc
      .cbClsExtra = 0
      .cbWndExtra = 0
      .hInstance = GetModuleHandle(NULL)
      .hIcon = 0
      .hCursor = 0 
      .hbrBackground = 0
      .lpszMenuName = NULL
      .lpszClassName = StrPtr("Winamp v1.x")
      .hIconSm = 0
   End With
   
   a = RegisterClassEx(@WAWindow)
   
   printf(!"RegisterClassEx(&WAWindow) returned %#x.\n", a) 
   
   If a = 0 Then
      WINERR = GetLastError()
      Dim As ZString Ptr ErrMsg
      FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER Or FORMAT_MESSAGE_FROM_SYSTEM, 0, WINERR, 0, @ErrMsg, 256, 0)
      printf(!"Error %#x: %s\n", WINERR, ErrMsg)
   EndIf
   
   WAWindow = CreateWindowEx(0, "Winamp v1.x","PsyMP3 Winamp Interface Window - Winamp", _
                             0, 0, 0, 0, 0, HWND_MESSAGE, 0, GetModuleHandle(NULL), 0)
                             
   printf(!"CreateWindowEx(...) returned %#x.\n", WAWindow)
                              
End Sub

InitKVIrcWinampInterface()