I have been trying to work with RADasm SpreadSheet custom control and have run into a problem. The SpreadSheet.inc says the following: "SPRM_GETCELLSTRING equ WM_USER+124 ;Get content of current cell. wParam=0, lParam=0. Returns a pointer to a null terminated string."

So far I have not been able to return the string with 'ptr' or 'addr'. Who has the answer for a MessageBox?  :sad:

Thanks ahead of time...
Posted on 2008-03-17 08:16:10 by TempNew
invoke SendMessage, hSpreadsheet, SPRM_GETCELLSTRING, 0, 0
invoke MessageBox, 0, eax, 0, 0

Wild Guess....
Posted on 2008-03-17 10:52:11 by JimmyClif
Thanks for the reply Jimmy, but I have tried that one and several other things including 'reparg', but I get garbage which means it is returning an integer instead of a string, or it crashes. I am posting the sniplet created by the author that is called.

invoke FindCell,ebx,.WIN.ccol,.WIN.crow
.if eax
lea eax,.COLDTA.fmt.tpe[1]

'COLDTA'; 'fmt'; 'tpe' are all structs that I have verified. I think tpe is looking at an array of strings or it may be pointers, but that is beyond my abilities.
Posted on 2008-03-17 11:42:50 by TempNew
tpe[1] refers to a byte at offset 1 of the given element.
I am going to guess, without looking, that tpe[] is a buffer that contains the string length in a byte at offset zero, and at offset 1 we find the string.
This alternative way of storing strings (length, string) is quite common when working with tables of strings, note that that string is probably NOT zeroterminated, try grabbing the Length byte from tpe[0] and using strcpyn to copy the string to a local buffer.

Posted on 2008-03-18 02:50:45 by Homer
Thanks Homer, but I don't have access to 'COLDTA', that is a part of the .dll. It just happens that KetilO bundled it with the SpreadSheet. I could probably recreate the .dll, but I could blow up the whole thing. I was hoping someone had some knowledge of the control.

Posted on 2008-03-18 04:52:06 by TempNew
I don't know what the issue is in "my" other project, but the following code works fine as stated in a complete new project:

mov hIDC_SPR1,rv(GetDlgItem,hWnd,IDC_SPR1)                  ; Get handle
invoke SendMessage,hIDC_SPR1,SPRM_SETCURRENTCELL,2,1                  ; Select cell
invoke SendMessage,hIDC_SPR1,SPRM_SETCELLSTRING,TPE_TEXT,SADD("Some text")                  ; Put some text into cell
invoke SendMessage,hIDC_SPR1,SPRM_GETCELLSTRING,0,0                  ; Return text from cell
invoke MessageBox,0,eax,0,0                  ; Display text

I am off to the hunt.

Sorry about the trouble... :shock:
Posted on 2008-03-18 05:15:44 by TempNew
I have finally found out the answer to this problem and it is the control itself. If you enter any data into a cell and save it you cannot any longer use: invoke SendMessage,hSPR_DATABASE,SPRM_GETCELLSTRING,0,0 to check for an empty cell. eax will always return a value when referencing the cell that had the saved data. This is a bug that needs to be fixed before the control is usable.

Another issue is that any numbers typed into a cell are automatically converted to a float and cannot be retrieved if longer then a double.

These are the only 2 problems that I have found. I have discontinued trying to use the control because it is not suitable for what I need - creating a database.
Posted on 2008-03-24 20:26:33 by TempNew

The SpreadSheed custom control is an advanced control, yet its basic functions are very easy to use. There are also notifications that makes it possible to take control over user input.

The SPRM_GETCELLSTRING message has been enhanced and will now only return a pointer to cells that contains text, integer (32 bit) or float (80 bit).

Also included is a database example that uses an access database.


Posted on 2008-04-03 02:06:52 by KetilO