Aqua-Soft Forums: String from pointer - Aqua-Soft Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

String from pointer Rate Topic: -----

#1 User is offline   Dream_Team Icon

  • Group: Member
  • Posts: 910
  • Joined: 31-March 04

Posted 01 September 2007 - 09:58 AM

Hi !
I've been using AveScripter with bundeled iTunes script for a while.
As you may know I'm developping my own media player.

I want to retrive the current song, but it doesn't think I'm able to create an com interface like iTunes one. (If someone can help me, I use my own toolkit dll done in Visual Studio C++ 2005 (Express edition) so I can do anything that can be done in C)

So i have an plugin system with 3 possibilities.

1/ Request from NL Window (custom class name) to send artist, song and album (NL will not reply anything to the original SendMessage, but the plugin will have to wait for the update messages to come) as pointers to ASCII strings. (SendMessage, pointer : lParam)

2/ Request from NL Window to send an struct with song info (Same as upper, you will have to wait for NL to answer you) still as a pointer, but this time pointer is wParam, lParam is the size so you can use mem transfert.

3/ The title of NL Window (the one hidden for plugins) is the path to an XML file that is currently formatted like that :
<CurrentSong>

				<title>Sample Title</title>

				<artist>Sample Artist</artist>

				<album>Sample Album</album>

</CurrentSong>
(More info to come)

Finally, there are two messages (messages are code that you pass as wParam, you must retrive the numer with RegisterWindowMessage) that can request from NL the total duration of the song (as HH:MM:SS format) and request the eplased time (same format). This time you will need to get the SendMessage result.

So it seems that I'm too dumb to get AveScripter to retrive the XML file, (xmls.new example is wrong in the doc) and I don't know if AveScripter returns the result of SendMessage.

So here is my question :
Is there a way for AveScripter to retrive an ASCII string (or UNICODE, i'll add functions for that later) from an pointer ?
0

#2 User is offline   AndreasV Icon

  • Group: Developers
  • Posts: 2,137
  • Joined: 22-November 03

Posted 01 September 2007 - 10:19 AM

No. Since avescripter runs in a different memory-space than your app: a pointer in one app is not valid in another app. Thus passing pointers to strings using SendMessage() is useless, except when marshalling the data using WM_COPYDATA.

A COM IDispatch solution would be the coolest of course.
0

#3 User is offline   Dream_Team Icon

  • Group: Member
  • Posts: 910
  • Joined: 31-March 04

Posted 01 September 2007 - 11:02 AM

Thanks, I will try to implement something like that.

But if I load an dll and pass a pointer to this dll, since the dll is loaded by the program, the pointer will be shared, right ?

Gotta re-learn how to use pointers.
0

#4 User is offline   AndreasV Icon

  • Group: Developers
  • Posts: 2,137
  • Joined: 22-November 03

Posted 01 September 2007 - 11:34 AM

1. Pointers are only valid inside the same memory space.
2. If you load a DLL into your app, the DLL shares the memory space with your app (process).
3. Thus, the DLL and the app can share pointers.

4. If you load a DLL into two different apps, the DLL is loaded into both processes and thus knows 2 memory spaces: one from process A and one from process B.
5. The DLL still cannot use pointers from process A in process B directly.
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic