Ok,
I have to invoke a SENDMESSAGE which returns in the lParam "the Address of Buffer with String".
So i think that the lParam gives me an Address (POINTER maybe ? ) from which i have to get the string.
How i do that in EBasic ?
Examples from others Languages:
RapidQ
---------
Defint i
Defstr s
SendMessageA(hwnd, msg, 0, @i)
s = VarPTR$(i)
PureBasic
-------------
Protected i.l
Protected s.s
SendMessage_(hwnd, msg, 0, @i)
s = PeekS(PeekL(@i))
Thanks in Advance
pointer p
sendmessage(win,msg,0,p)
print #<string>p
Ot would help if I knew which message you were sending.
Ok Paul,
IÂÃ,´m making a INC file of a Freeware DLL called SuperEdit.dll, an editor control. ;)
In attachment there is a ZIP file with the files that i have made so far and which are:
1) SuperEdit.dll - The DLL itself (Not Mine but from Copyright (c) 2006 - 2007 Nastase Eodor as it says in properties); ;D
2) SuperEdit.lib - The LIB made with EBasic IDE;
3) SuperEdit.inc - The Include File where i have the "wrapper" for the DLL. The SUB that i'm working on is the Editor_GetFontName().
As you can see, executes a SENDMESSAGE where the lParam returns the Address Buffer of the String.
Paul, i made as you said,
POINTER Buffer
SENDMESSAGE(Handle, @SEM_GETFONTNAME, 0, Buffer)
MESSAGEBOX(Handle, #<STRING>Buffer, "Test")
RETURN #<STRING>Buffer
but the result is Garbage;
Something is missing here.
Can you help me, please ?
Thanks in advance
Do you have the header file for C perhaps? We can convert those fairly easily
Sorry, :'(
I donÂÃ,´t have but if we have in EBasic Functions similar to PeekL and PeekS we can get the right string.
Thanks.
Any other documentation on the DLL?
They may be returning a pointer to a string, or a pointer to a unicode string, or a pointer to a pointer to a string. If I can seel an example from the docs, or from another language I will be able to help more.
Paul,
Just have a HTML help file but i donÂÃ,´t think it can help more.
But i will put it as Attachment.
As other examples from other languages, i have put them already in this thread but i will put them again.
RapidQ Language
------------------------
Defint i
Defstr s
SendMessageA(Handle, SEM_GETFONTNAME, 0, @i)
s = VarPTR$(i)
PureBasic Language
--------------------------
Protected i.l
Protected s.s
SendMessage_(Handle, #SEM_GETFONTNAME, 0, @i)
s = PeekS(PeekL(@i))
In RapidQ and PureBasic Languages, this works.
As you can see in RapidQ they use the Function VarPTR$(279027343) which returns the string representation of a given address. They also have the VarPTR(a$) which returns the address, ie. pointer to, of the given variable name.
In PureBasic they use the Functions PeekL() and PeekS() to get the String.
Thanks.
;D ;D ;D ;D ;D ;D ;D ;D ;D
I found the solution.
As you said Paul, ItÂÃ,´s a POINTER to a POINTER of the STRING.
So the solution is:
SUB Editor_GetFontName(Handle AS UINT), STRING
POINTER Buffer
POINTER Address
STRING FontName
SENDMESSAGE(Handle, @SEM_GETFONTNAME, 0, Buffer)
Address = #<POINTER>Buffer
RETURN #<STRING>Address
ENDSUB
Thanks to everyone involved.