Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi , Expert

How to free Momery when using CompyMemory Function unfortunately i do not know what s the problem
if no free memory , later , display memory was full

What I have tried:

CopyMemory nmh,Byval lParam,LenB(nmh)

CopyMemory lPraram,nmh,LenB(lParam)

Failed
Posted
Updated 5-Feb-22 9:08am
v3
Comments
Richard MacCutchan 4-Feb-22 12:10pm    
Another vague question that is impossible to answer.
Dave Kreskowiak 4-Feb-22 12:25pm    
How many times are you going to ask questions without showing your code? It's impossible to tell you what you're doing wrong without it.

Oh, besides doing all that crap in VBA...
[no name] 4-Feb-22 12:50pm    
the above mentioned the code
Dave Kreskowiak 4-Feb-22 12:51pm    
No, it didn't. VBA does not have a CopyMemory function to call. You have to define that call to the Win32 function in a Declare statement. What does that code look like?

[no name] 5-Feb-22 9:47am    
CopyMemory lparam,Byval nmh,LenB(nmh)

I'm not the only one who is getting fed up with your inability to work out what we need to know in order to help you: in this case as Dave has said VBA does not have a CopyMemory function so just repeating the code that calls it with no idea what what it does of what the memory you are passing it might be helps noone.

So, let's talk about questions in the hope that you realize why we can't fix your code for you ...

Imagine this: you own a car garage, and the phone rings.
You answer it, say "Member 11803607 Garage, how can we help you?"
The voice at the other end says "my car broke" and the line goes dead.
You check the last call number and try to call it back, but all you get is "this number is not available".
What are you going to do? Will you:

1) Select exactly the right part and tools to fix that specific make, model, and year of car; and the specific problem that prevents it going any further, then drive directly to where the customer is waiting to fix the car?
2) Pack up every part for every car ever made, every tool and mechanic in the garage into a fleet of trucks, then hire a spotter plane to try to locate a broken down car, drive there and see if it's the guy who rang? If it isn't, your flotilla of trucks laden with tools, parts, and bodies drives on to the next one?
3) Shrug and get back to what you were doing?

Select one.

Imagine this: you go for a drive in the country, but you have a problem with the car. You call the garage, say "it broke" and turn off your phone. How long will you be waiting before the garage arrives with the right bits and tools to fix the car given they don't know what make or model it is, who you are, what happened when it all went wrong, or even where you are?

That's what you've done here. So stop typing as little as possible and try explaining things to people who have no way to access your project!

This is not a good question - we cannot work out from that little what you are trying to do. Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with - we get no other context for your project.

So when you ask a question, think about what the other person needs to know:
Ring, ring:
"Hi, it's Member 11802607, and my 2007 Ford Escort 1300GL has got a flat tyre. I'm in the layby on the B7065 road just south of the junction with the A432"

Now, the garage knows the important details:
Who you are.
Where you are.
What make, model, and year of car is involved.
What the fault is.
And they can get a van with a new tyre out to you quickly.

We are in the same position: we have no idea what your code looks like, and no way to find out. And after 17 questions you damn well should know that by now!

And BTW: I agree with Dave: VBA is a silly choice of language / framework for this project ...
 
Share this answer
 
JFC. What does the DECLARE statement look like? You had to define the CopyMemory function somewhere and define the parameters to pass it.

You just keep posting your CALL to the CopyMemory function, not how you DECLAREd it.

Nor do you show how you're declaring your variables or even what type they are.

Oh, and you don't free the memory. CopyMemory doesn't allocate any so there's nothing to free.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900