Passing variables instead of pointers works anyway ?
Posted: Sat Aug 26, 2006 7:37 pm
Hello,
That is just a simple curiosity I have.
For many API I have noticed that MSDN tells for a given parameter that it is a pointer to a variable/structure/memory address. However, sometimes when you pass directly the variable and not it's address, it works also.
Basic example :
From MSDN :
Just wondering 
Regards,
newbie.
That is just a simple curiosity I have.
For many API I have noticed that MSDN tells for a given parameter that it is a pointer to a variable/structure/memory address. However, sometimes when you pass directly the variable and not it's address, it works also.
Basic example :
Code: Select all
Module.s = "C:\Windows\system32\shell32.dll"
If LoadLibrary_(Module) <> #Null
Debug "success"
FreeLibrary_(Module)
Else
Debug "error"
EndIf
Why does it work, whereas it should be :lpFileName
[in] Pointer to a null-terminated string that names the executable module (either a .dll or .exe file). The name specified is the file name of the module and is not related to the name stored in the library module itself, as specified by the LIBRARY keyword in the module-definition (.def) file.
If the string specifies a path but the file does not exist in the specified directory, the function fails. When specifying a path, be sure to use backslashes (\), not forward slashes (/).
If the string does not specify a path, the function uses a standard search strategy to find the file. See the Remarks for more information.
Code: Select all
LoadLibrary_(@Module)

Regards,
newbie.