|
-
January 13th, 2000, 01:53 PM
#1
Copy Memory
Hi,
I am using VB 6.0. I am calling the Copymemory function twice in one sub.
When the execution goes to the second Copymemory function, I get a memory exception and the program exits out and closes also the vb windows.
Is there a problem with calling copymemory twice in one sub? If not, is there something I can do to fix the problem?
Thank you for your help...
Avni
-
January 13th, 2000, 02:32 PM
#2
Re: Copy Memory
There's nothing wrong with calling CopyMemory multiple times, provided you are passing the parameters as expected, post a sample of the code that's crashing and we may be able to pin point the problem.
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
January 13th, 2000, 02:43 PM
#3
Re: Copy Memory
Hi, Here is the code that uses the copymemory twice. It's kind of long, but i didn't know which part to skip. Thank you for your help.
rc = PLC_GetSessionData(SessionID, pSessionData)
' Get SessionData from the pointer pSessionData
Call CopyMemory(SessionData, ByVal pSessionData, LenB(SessionData))
' Display Data retreived for session
Dim LicenseID As Long
Dim ServerID As Long
Dim LicenseData As tLicenseData
Dim pLicenseData As Long
LicenseID = SessionData.CurrentLicenseId
ServerID = SessionData.CurrentServerId
rc = PLC_GetLicenseData(APIHandle, ServerID, LicenseID, pLicenseData)
Call CopyMemory(LicenseData, ByVal pLicenseData, LenB(LicenseData))
'Here is where I get the memory error.
'Then using LicenseData to get the Developer Data
'Result = Result + "Pointer is: " + Hex(pLicenseData)
Result = Result + vbNewLine + " LicenseID = " + Hex(LicenseID)
-
January 13th, 2000, 02:53 PM
#4
Re: Copy Memory
If the License Data Structure contains Strings, it could be you are doubling up on the Memory you're trying to copy by using LenB, try using Len instead, other than that nothing stands out.
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
January 14th, 2000, 12:44 PM
#5
Re: Copy Memory
Hi Aaron,
What you suggested did not work, but I changed the length in the second copymemory call to len(sessiondata) and that seems to work fine...
I don't know if this is the best way to do this, but it works...
Thanks for your help.
Avni
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|