Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, bigsmack, 7th_zorro, dr_panther), 1,364 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 3 1 2 3
Re: inkey coy paste [Re: Wjbender] #449907
04/02/15 10:02
04/02/15 10:02
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Well you forgot to call GlobalFree which might be a big memory leak if the user pastes alot of data. However, just let the people do it theirselves..
Using windows APIs is c&p from msdn. If they cant manage to find something that simple on the net then I have no idea if that helps in any way sorry smirk

Last edited by Ch40zzC0d3r; 04/02/15 10:02.
Re: inkey coy paste [Re: Ch40zzC0d3r] #449908
04/02/15 10:05
04/02/15 10:05
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline
User
Wjbender  Offline
User
W

Joined: Mar 2012
Posts: 927
cyberspace
I don't want to sound foolish but I can almost swear I have read that the system owns the memory after that and the system wil free it by calling the correct free command , unless you alloc with some owner type of type (forgot the name)

Memory and the Clipboard
A memory object that is to be placed on the clipboard should be allocated by using the GlobalAlloc function with the
GMEM_MOVEABLE flag.
After a memory object is placed on the clipboard, ownership of that memory handle is transferred to the system. When the
clipboard is emptied and the memory object has one of the following clipboard formats, the system frees the memory object
by calling the specified function:
Function to free
object Clipboard format
DeleteMetaFile CF_DSPENHMETAFILE
CF_DSPMETAFILEPICT
CF_ENHMETAFILE
CF_METAFILEPICT
DeleteObject CF_BITMAP
CF_DSPBITMAP
CF_PALETTE
GlobalFree CF_DIB
CF_DIBV5
CF_DSPTEXT
CF_OEMTEXT
CF_TEXT
CF_UNICODETEXT
none CF_OWNERDISPLAY
When the clipboard is emptied of a CF_OWNERDISPLAY object, the application itself must free the
memory object.

Last edited by Wjbender; 04/02/15 10:07.

Compulsive compiler
Re: inkey coy paste [Re: Wjbender] #449910
04/02/15 11:04
04/02/15 11:04
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Thanks Wjbender, works like a charm.

For people who want to send a string as a parameter (like for an inkey copy function), the following seems to work (though I am not sure if it is flawless code):

Code:
function inkey_copy()
{
  char* temp_char;
  temp_char = _chr(input_str);
  to_clipboard(temp_char);	
}


Page 3 of 3 1 2 3

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1