Jump to content
Sign in to follow this  
Danyfirex

CopyMemory API copy to another variable?

Recommended Posts

Danyfirex

Well mate today I got this problem. I know How to use copy memory API using DllCall.

the problem it's that I just want to copy a value "text" from a Pointer to my variable. bot I don't know how too.

In vb6 I would do it so

CopyMemory ByVal StrPtr(FilePath), ByVal CallWindowProc(VarPtr(ASMBYTE(0)), 0, 0, 0, 0), 255

but I don't know sure how to get a ptr. I think maybe createing a structure but not sure how.

I hope you understand :S look complicated.

Edited by Danyfirex

Share this post


Link to post
Share on other sites
Andreik

How it's this related to AutoIt? If it is then check out DllStructCreate() function, maybe this is what you need.


When the words fail... music speaks

Share this post


Link to post
Share on other sites
Danyfirex

How it's this related to AutoIt? If it is then check out DllStructCreate() function, maybe this is what you need.

I know that I need to use dll call.

But I don't know the exactly way to do that I want.

I mean make tow structures. struct1 with some value. and struct2 empty.

then use copymemory to pass the value of struct1 to struct2 by pointers.

and then be able to use dlstructure get data and my struct2 should have the value same struct1.

but don't know how to start.

sorry for my bad english.

Edited by Danyfirex

Share this post


Link to post
Share on other sites
Danyfirex

Share this post


Link to post
Share on other sites
Melba23

Danyfirex,

You have been here long enough to know that 24hrs is considered an accceptable time to wait before bumping your own thread. ;)

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Danyfirex

I'm sorry. I thought, I should bump.

Please Close Topic.

Share this post


Link to post
Share on other sites
Melba23

Danyfirex,

There is no need to close it - just do not bump it again before this time tomorrow. ;)

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
KaFu
Danyfirex

Maybe give this a try:

$tStruct = DllStructCreate("WCHAR[260]", $ptr)
$sVar = DllStructGetData($tStruct, 1)

I feel stupid. it was easiest that I thought.

thank you so much KaFu

here result.

$tStruct1 = DllStructCreate("WCHAR[260]")
DllStructSetData($tStruct1,1,"Hola Mundo") 
$sVar1 = DllStructGetData($tStruct1, 1)

$ptr=DllStructGetPtr($tStruct1,1)

msgbox(0,"",$sVar1) 


$tStruct = DllStructCreate("WCHAR[260]",$ptr)

$sVar = DllStructGetData($tStruct, 1) 

msgbox(0,"",$sVar)

thank you so much.

Share this post


Link to post
Share on other sites
JohnOne

Are you sure that is the behaviour you want, nothing is being copied is it?

$tStruct1 = DllStructCreate("WCHAR[260]")
DllStructSetData($tStruct1,1,"Hola Mundo")
$sVar1 = DllStructGetData($tStruct1, 1)

$ptr=DllStructGetPtr($tStruct1,1)

msgbox(0,"",$sVar1)


$tStruct = DllStructCreate("WCHAR[260]",$ptr)
DllStructSetData($tStruct1,1,"Bye Mundo")
$sVar = DllStructGetData($tStruct, 1)

msgbox(0,"",$sVar)

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
Danyfirex

Are you sure that is the behaviour you want, nothing is being copied is it?

$tStruct1 = DllStructCreate("WCHAR[260]")
DllStructSetData($tStruct1,1,"Hola Mundo")
$sVar1 = DllStructGetData($tStruct1, 1)

$ptr=DllStructGetPtr($tStruct1,1)

msgbox(0,"",$sVar1)


$tStruct = DllStructCreate("WCHAR[260]",$ptr)
DllStructSetData($tStruct1,1,"Bye Mundo")
$sVar = DllStructGetData($tStruct, 1)

msgbox(0,"",$sVar)

yes this that I want, no need to be copy I wanted to get the the string by the ptr. its work. or there is some best way?

obvious then I will use copymemory to copy in another block.

Edited by Danyfirex

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×