Announcement

Collapse
No announcement yet.

Help with Declares

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with Declares


    Everyone having a grand ole' time!

    I have a VB include file that i use with no problem.
    Converting it to PB, doesn't seem to want to work.
    I have tried ByVAL, ByREF, $, As ASCIIZ, AS String and nothing
    appears to work!

    So maybe one of you can help!
    Thanks

    Code:
    'Private Declares
    Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
    Private Declare Function mciGetErrorString Lib "winmm.dll" Alias "mciGetErrorStringA" (ByVal dwError As Long, ByVal lpstrBuffer As String, ByVal uLength As Long) As Long
    Private Declare Function SetTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long, ByVal uElapse As Long, ByVal lpTimerFunc As Long) As Long
    Private Declare Function KillTimer Lib "user32" (ByVal hWnd As Long, ByVal nIDEvent As Long) As Long
    Private Declare Function GetWindowRect Lib "user32" (ByVal hWnd As Long, lpRect As RECT) As Long
    Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
    Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
    Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
    Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
    
    'Private types
    Private Type RECT
            left As Long
            top As Long
            Right As Long
            Bottom As Long
    End Type

    Thanks
    MWM


    ------------------
    mwm
    mwm

  • #2

    Ops.....I left the private in...
    but in the pb mod it's taken out!

    Thanks
    MWM


    ------------------
    mwm
    mwm

    Comment


    • #3
      Let's try this again.....
      here's what I wanted to post:

      Code:
      'powerbasic include file
      'Player Declares
      
      DECLARE FUNCTION mciSendString LIB "winmm.dll" ALIAS "mciSendStringA" (BYVAL lpstrCommand$, BYVAL lpstrReturnString$, BYVAL uReturnLength&, BYVAL hwndCallback&) AS LONG
      DECLARE FUNCTION mciGetErrorString LIB "winmm.dll" ALIAS "mciGetErrorStringA" (BYVAL dwError&, BYVAL lpstrBuffer$, BYVAL uLength&) AS LONG
      DECLARE FUNCTION SetTimer LIB "user32" (BYVAL hWnd&, BYVAL nIDEvent&, BYVAL uElapse&, BYVAL&) AS LONG
      DECLARE FUNCTION KillTimer LIB "user32" (BYVAL hWnd&, BYVAL nIDEvent&) AS LONG
      DECLARE FUNCTION GetWindowRect LIB "user32" (BYVAL hWnd&, lpRect AS RECT) AS LONG
      DECLARE FUNCTION GetWindowsDirectory LIB "kernel32" ALIAS "GetWindowsDirectoryA" (BYVAL lpBuffer$, BYVAL nSize&) AS LONG
      DECLARE FUNCTION WritePrivateProfileString LIB "kernel32" ALIAS "WritePrivateProfileStringA" (BYVAL lpApplicationName$, BYVAL lpKeyName$, BYVAL lpString$, BYVAL lpFileName$) AS LONG
      DECLARE FUNCTION GetPrivateProfileString LIB "kernel32" ALIAS "GetPrivateProfileStringA" (BYVAL lpApplicationName$, BYVAL lpKeyName$, BYVAL lpDefault$, BYVAL lpReturnedString$, BYVAL nSize&, BYVAL lpFileName$) AS LONG
      DECLARE FUNCTION GetShortPathName LIB "kernel32" ALIAS "GetShortPathNameA" (BYVAL lpszLongPath$, BYVAL lpszShortPath$, BYVAL cchBuffer&) AS LONG
      
      'Private types
      TYPE RECT
          nLEFT   AS LONG
          ntop    AS LONG
          nRIGHT  AS LONG
          nBottom AS LONG
      END TYPE
      Thanks


      ------------------
      mwm
      mwm

      Comment


      • #4
        Michael,
        Just: #INCLUDE "win32api.inc"

        These are all located in this file!

        --Bob

        ------------------
        "It was too lonely at the top".

        Comment


        • #5
          Bob...

          I did have it in.....however,
          when I took out the $INCLUDE "WIN32API.INC"
          the errors went away!

          MWM



          ------------------
          mwm
          mwm

          Comment


          • #6
            ok......
            Sorry for wasting anyone's time!
            Found my over-site!
            All the declares listed above are already in the win32api!
            (dah!)

            Thanks
            MWM


            ------------------
            mwm
            mwm

            Comment

            Working...
            X