Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CopyMemory crashes my VB :-(

Status
Not open for further replies.

gabster

Programmer
Oct 23, 2001
192
US
Hi all,

I have a program that suppose to scan an image, load it into memory and then grab it from there and send it to the server.
However the scan part works fine, also the load to memory also the calling the image from memory works fine.
The problem arise when I try to use CopyMemory api call.

Example (VB):


Private Sub SendToServer()
CopyMemory Text1.Text, hMem, hsize
End Sub


Where the "Text1.Text" is the destination, the hMem is the memory handle and the iSize is the size.

When I try to run it, it crashes not only the app but VB also - simply dissapears from the screen.
Here is how I drclare copyMemory:
[
Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Dest As Any, Src As Any, ByVal cb As Long)

Thanks a lot,
Gabi.
 

You cannot copy memory directly to a file(as far as I know). Try to copy the memory to a variable and then use the open/print/close file methods to print the contents of the variable to the file specified by your text1.text.

Good Luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top