Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
GlobalLock()
Message
 
To
23/05/1998 03:35:20
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
00101339
Message ID:
00101879
Views:
36
>Just be sure the dll doesn't store the pointer for later use.
>
>Vlad
>
>>Why can't you just allocate the memory from VFP's address space and send it to the function? That's typically the way you do it:
>>
>>declare integer TheFunc in TheDLL string @ buffer
>>lcBuffer = space( 256 )
>>? TheFunc( @lcBuffer )

Well, it gets better. Not only do the several DLL functions require a pointer to the address space, they also want the size. I also believe several K of memory needs to be allocated because many of the functions cache info in this buffer as you call certain functions. This info can build up (to what extent, I don't know, I'm still trying to get past the initialization!).

I was thinking that maybe I could use the LCK and create an FLL as a makeshift "wrapper". I should be able to call a function in an FLL to allocate the memory, and have it return the pointer to the memory and the size of memory allocated. I should then be able to use these numbers in my app to call the functions in the custom DLL. I could use that same DLL to deallocate the memory (if for some reason it can't be deallocated from my app with globalunlock() and globalfree()). How does that sound? If VFP had a pointer type, I wouldn't have to go through any of this trouble (GlobalLock() requires a pointer type arg).

I do think I will try the above method to see if it may save me some trouble!

thanks a bunch

Steve.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform