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 / desaware / demo32 / sw5demo / coop.bas next >
Encoding:
BASIC Source File  |  1996-03-19  |  3.7 KB  |  59 lines

  1. Attribute VB_Name = "COOP"
  2.  
  3. Option Explicit
  4.  
  5. 'When passing a user Type as a pointer to memory, you need to
  6. 'align the elements. Otherwise, the data may not be copied to the
  7. 'correct elements in Visual Basic. Refer to the "Visual Basic
  8. 'Programmer's Guide to the Win32 API" or some other Win32 reference
  9. 'book for further explanation on how Visual Basic handles Type alignments.
  10. Type CoopStructure
  11.     CompanyName(1 To 24) As Byte
  12.     count As Integer
  13.     dummy As Integer    'dummy integer to pad the structure, try removing
  14.                         'this to see what happens
  15.     Amount As Single
  16.     Total As Long
  17. End Type
  18.  
  19. Global Const COOP_MESSAGE = "Coop_Private_Message"
  20. Global Const THUNDERRTMAIN = "ThunderRTMain"
  21.  
  22. #If Win32 Then
  23.     Public Declare Sub dwCopyDataBynum Lib "dwspy32.dll" Alias "dwCopyData" (ByVal Source&, ByVal dest&, ByVal nCount&)
  24.     Public Declare Function dwGetAddressForObject& Lib "dwspy32.dll" (object As Any)
  25.     Public Declare Sub dwCopyDataByString Lib "dwspy32.dll" Alias "dwCopyData" (ByVal Source As String, ByVal dest As Long, ByVal nCount&)
  26.     Public Declare Function dwXCopyDataBynumFrom& Lib "dwspy32.dll" Alias "dwXCopyDataFrom" (ByVal mybuf As Long, ByVal foreignbuf As Long, ByVal size As Integer, ByVal foreignPID As Long)
  27.     Public Declare Function dwGetWndInstance& Lib "dwspy32.dll" (ByVal hWnd&)
  28.     
  29.     Public Declare Function RegisterWindowMessage& Lib "user32" Alias "RegisterWindowMessageA" (ByVal lpstring As String)
  30.     Public Declare Function GetWindowLong& Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long)
  31.     Public Declare Function EnumWindows& Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long)
  32.     Public Declare Function SendMessageBynum& Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)
  33.     Public Declare Function GetWindowThreadProcessId& Lib "user32" (ByVal hWnd As Long, lpdwProcessId As Long)
  34.     Public Declare Function GetClassName& Lib "user32" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long)
  35. #Else
  36.  
  37.     Global Const GWW_HINSTANCE = -6
  38.     
  39.     Public Declare Sub dwCopyDataByString Lib "dwspydll.dll" Alias "dwCopyData" (ByVal Source As String, ByVal dest As Long, ByVal nCount%)
  40.     Public Declare Sub dwCopyDataBynum Lib "dwspydll.dll" Alias "dwCopyData" (ByVal Source&, ByVal dest&, ByVal nCount%)
  41.     Public Declare Function dwGetAddressForObject& Lib "dwspydll.dll" (object As Any)
  42.     Public Declare Function dwGetAddressForVBString& Lib "dwspydll.dll" (vbstring$)
  43.  
  44.     Public Declare Function RegisterWindowMessage% Lib "User" (ByVal frmsgstr$)
  45.     Public Declare Function EnumWindows% Lib "User" (ByVal lpEnumFunc&, ByVal lParam&)
  46.     Public Declare Function GetWindowWord% Lib "User" (ByVal hWnd%, ByVal offset%)
  47.     Public Declare Function SendMessage% Lib "User" (ByVal hWnd%, ByVal wMsg%, ByVal wParam%, lParam As Any)
  48.     Public Declare Function SendMessageBynum& Lib "User" Alias "SendMessage" (ByVal hWnd%, ByVal wMsg%, ByVal wParam%, ByVal lParam&)
  49.     Public Declare Function GetWindow% Lib "User" (ByVal hWnd%, ByVal wCmd%)
  50.     Public Declare Function GetWindowTask% Lib "User" (ByVal hWnd%)
  51.     Public Declare Function GetClassName% Lib "User" (ByVal hWnd%, ByVal lpstr$, ByVal strlen%)
  52.     Public Declare Function GlobalAlloc% Lib "kernel" (ByVal wFlags%, ByVal dwBytes&)
  53.     Public Declare Function GlobalLock& Lib "kernel" (ByVal hMem%)
  54.     Public Declare Function GlobalUnlock% Lib "kernel" (ByVal hMem%)
  55.     Public Declare Function GlobalFree% Lib "kernel" (ByVal hMem%)
  56.     Public Declare Function lstrlen% Lib "kernel" (ByVal lp&)
  57. #End If
  58.  
  59.