Hi Folks
This is (I thing) a very simple question, I am sorry posting such a dumb question, but I've been stuck for days trying to find a solution :(

How do I return a string pointer from a library, I tryed pushing it in the stuck, but all I get is an empty string, tryed even to pass it in a register, the result is the same.

Here is some code:



;library
mov ecx, offset message
push ecx

;Program
pop ecx
mov hMsg,ecx
MsgBox2 hWnd,ADDR hMsg,ADDR AppName,MB_OK


Best Regards
Posted on 2003-08-10 17:59:55 by mistronr1
Return the pointer in eax and set up a small proc in your library
GetPointer proc

mov eax,OFFSET string
GetPointer endp

invoke GetPointer
mov pString,eax

This should work OK

BTW MsgBox2 hWnd,ADDR hMsg,ADDR AppName,MB_OK the ADDR is wrong you are already returning an address.
Posted on 2003-08-10 18:13:41 by donkey
Hi Again
Thanx alot donkey, I try it.
take care
Best Regards

EDIT:


MsgBox2 hWnd, hMsg,ADDR AppName,MB_OK


returns an ERROR ( error A2032: invalid use of register).
Posted on 2003-08-10 18:16:37 by mistronr1
MsgBox2 hWnd, hMsg,offset AppName,MB_OK

or


lea eax, AppName
MsgBox2 hWnd, hMsg,eax,MB_OK

Depends on whether hMsg is a local or a global variable. Anyway I think you got the error because Msgbox2 is a marco.
Posted on 2003-08-11 08:38:09 by roticv
Hi

Thanx dankey & roticv, I couldn't get MsgBox2 to work with registers, it needs ADDR XXX as a parameter, I am giving up MsgBox2 and use MessageBox insted.
The pointer pass from library worked fine, My Project is still not done "I'LL BE BACK" with more Questions :).

Best Regards
Posted on 2003-08-11 16:39:50 by mistronr1