Announcement

Collapse
No announcement yet.

Referenceing DLLs

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

  • Ahmad Zaman
    replied
    Referencing DLLs

    Many Thanks

    Leave a comment:


  • Wayne Diamond
    replied
    Ahmad,
    Have a look at the win32api.inc file in your \Pbwin\winapi\ directory. Towards the end you'll see all the common Windows API functions already declared for you.

    For example:
    DECLARE FUNCTION DeleteFile LIB "KERNEL32.DLL" ALIAS "DeleteFileA" (lpFileName AS ASCIIZ) AS LONG

    Using it is then as simple as: DeleteFile "c:\tempfile.dat"


    Alternatively you can reference it dynamically, for example ...

    DECLARE FUNCTION DeleteFile (lpFileName AS ASCIIZ) AS LONG
    LOCAL hLib AS DWORD, hProc AS DWORD
    hLib = GetModuleHandle("kernel32.dll"): IF hLib = 0 THEN hLib = LoadLibrary("kernel32.dll")
    hProc = GetProcAddress(hLib, "DeleteFileA")
    CALL DWORD hProc USING DeleteFile("c:\tempfile.dat")

    Leave a comment:


  • Edwin Knoppert
    replied
    Open win32api.inc, identical.

    Declare ... LIB .... etc..

    Leave a comment:


  • Ahmad Zaman
    started a topic Referenceing DLLs

    Referenceing DLLs

    How do I reference a windows dll within Powerbasic
Working...
X
😀
🥰
🤢
😎
😡
👍
👎