home *** CD-ROM | disk | FTP | other *** search
/ Dan Appleman's Visual Bas…s Guide to the Win32 API / Dan.Applmans.Visual.Basic.5.0.Programmers.Guide.To.The.Win32.API.1997.Ziff-Davis.Press.CD / VB5PG32.mdf / articles / vbdev / source / spoolwt.bas < prev    next >
Encoding:
BASIC Source File  |  1995-06-22  |  1.9 KB  |  58 lines

  1. Option Explicit
  2. Global Const WM_SPOOLERSTATUS = &H2A
  3. Global Const WM_PAINT = &HF
  4. Global Const GWW_HINSTANCE = (-6)
  5. Global Const OPAQUE = 2
  6. Global Const SND_SYNC = &H0
  7. Global Const SND_NODEFAULT = &H2
  8.  
  9. Type RECT   '8 Bytes
  10.     left As Integer
  11.     top As Integer
  12.     right As Integer
  13.     bottom As Integer
  14. End Type
  15.  
  16. Type PAINTSTRUCT     '32 Bytes
  17.     hDC As Integer
  18.     fErase As Integer
  19.     rcPaint As RECT
  20.     fRestore As Integer
  21.     fIncUpdate As Integer
  22.     rgbReserved As String * 16
  23. End Type
  24.  
  25.  
  26. Declare Function BeginPaint% Lib "User" (ByVal hWnd%, lpPaint As PAINTSTRUCT)
  27. Declare Sub EndPaint Lib "User" (ByVal hWnd%, lpPaint As PAINTSTRUCT)
  28. Declare Function ExtractIcon% Lib "shell.dll" (ByVal hisnt%, ByVal lpszExeName$, ByVal iIcon%)
  29. Declare Function GetWindowWord% Lib "User" (ByVal hWnd%, ByVal nIndex%)
  30. Declare Function DrawIcon% Lib "User" (ByVal hDC%, ByVal x%, ByVal y%, ByVal hIcon%)
  31. Declare Function GetWindowsDirectory% Lib "Kernel" (ByVal lpBuffer$, ByVal nSize%)
  32. Declare Function DestroyIcon% Lib "User" (ByVal hIcon%)
  33. Declare Function TextOut% Lib "GDI" (ByVal hDC%, ByVal x%, ByVal y%, ByVal lpString$, ByVal nCount%)
  34. Declare Function sndPlaySound Lib "MMSYSTEM.DLL" (ByVal lpszSoundName As Any, ByVal wFlags%) As Integer
  35.  
  36. '
  37. ' Retrieve the instance handle of the specified window
  38. '
  39. Function GetMyInstance () As Integer
  40.     GetMyInstance = GetWindowWord(frmSpoolWatch.hWnd, GWW_HINSTANCE)
  41. End Function
  42.  
  43. '
  44. ' Get the icon for the print manager
  45. '
  46. Function GetPrintmanIcon () As Integer
  47.     Dim windir$
  48.     Dim cnt%
  49.     windir$ = String$(128, 0)
  50.     cnt% = GetWindowsDirectory(windir$, 127)
  51.     ' Trip off the trailing null and extra characters
  52.     windir$ = Left$(windir$, cnt%)
  53.  
  54.     ' Retrieve the first icon of the file
  55.     GetPrintmanIcon = ExtractIcon(GetMyInstance(), windir$ & "\" & "printman.exe", 0)
  56. End Function
  57.  
  58.