Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / win dlls

Author
Message
Slooper
21
Years of Service
User Offline
Joined: 13th Feb 2003
Location: Sweden
Posted: 14th Mar 2007 03:02 Edited at: 14th Mar 2007 03:04
Well i have never used dlls from win dir, just started to look on the app called API guide and found an function i want to use in :

GetUserName

from the Advapi32.dll


i tried like this:

function getProfileName()
local Advapi32 as Integer
local result as string
repeat
inc Advapi32
until Dll Exist(Advapi32) = 0
Load Dll "Advapi32.dll", Advapi32
result = Call Dll(Advapi32, "GetUserName",0)
Delete Dll Advapi32
endfunction result

bit it didnt work, i suppose it is becuse the parameters or what it is called, how do i make this work so it returns the user name?

here is the declaration i got from API guide

Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long

and here is the function name (well you guys prob already got the name of it):

GetUserName


Please make an example source and please explain what i did wrong and what all in your source does. I want to learn something to


You never fail, only make mistakes.
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 14th Mar 2007 04:03
There you go. Took me frickin ages to get right.



Boo!
Slooper
21
Years of Service
User Offline
Joined: 13th Feb 2003
Location: Sweden
Posted: 14th Mar 2007 16:21
TNX spooky but there is one thing missing could you explain what you did in the example i am not so into dlls or memblocks so it would be nice with some comments on the lines you wrote, do you got the energy to help me with this ?

tnx in advance


You never fail, only make mistakes.
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 15th Mar 2007 00:20
OK, will fully comment it tomorrow.

Would do it tonight but it's been a busy day and I'm going to bed early.

Boo!
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 15th Mar 2007 15:08
Hopefully enough info here for you to understand things but please ask if you want more help.



As well as the MEMBLOCK commands you could also use the MEMORY commands such as MAKE MEMORY, DELETE MEMORY, etc but there are far more commands to manipulate memblocks.

Boo!
Slooper
21
Years of Service
User Offline
Joined: 13th Feb 2003
Location: Sweden
Posted: 15th Mar 2007 18:23 Edited at: 15th Mar 2007 18:24
wow tnx spooky you really filled in with comments really tnx for the effort you made to help me with this


You never fail, only make mistakes.

Login to post a reply

Server time is: 2024-11-22 16:58:25
Your offset time is: 2024-11-22 16:58:25