How do I handle Bigger values than GetDlgItemInt
can handle :?

If the decimal input value is "1234567891", then everything
is ok, but with a value "12345678912" then GetDlgItemInt
returns 0. The return value is bigger than a dword,
and that's why it returns 0. So what can I do about it :?

regards,


The SharK
Posted on 2004-10-04 01:43:43 by The SharK
hi theshark
i guess u might try using qword.
and may be ull get it.btw
The ULARGE_INTEGER structure is used to specify a 64-bit unsigned integer value.


typedef union _ULARGE_INTEGER {
struct {
DWORD LowPart;
DWORD HighPart;
};
DWORDLONG QuadPart;
} ULARGE_INTEGER;

nickdigital
Posted on 2004-10-04 03:11:53 by nickdigital
Hi nickdigital

Thanks I'll try that :)
Posted on 2004-10-04 05:04:10 by The SharK
You need to write your own GetDlgItemLargeInt using a pointer to a 64-bit qword value i think....in my opinion this means you need to write code that ms is supposed to support. :(

Dominik
Posted on 2004-10-04 05:19:16 by Dom
How about using the FPU for calculating 64-bit ?


regards,


The SharK
Posted on 2004-12-21 08:51:19 by The SharK
Read it as a string and convert it to 64bit (Either using your own or someone else). :)
Posted on 2004-12-21 09:19:35 by roticv
How about using the FPU for calculating 64-bit ?

That could be one of your options but you would have to first convert the string to the required packed decimal format. If you are not familiar with that format, the following may help you:
http://www.masmforum.com/website/tutorials/fptute/fpuchap2.htm#bcds

To avoid having to check the validity of the characters in your dialog box edit control, that control should have the ES_NUMBER style (however, this may not allow negative numbers). To avoid checking for overflow, you should also limit the number of characters in that edit control to 18.

Raymond
Posted on 2004-12-21 10:46:21 by Raymond
Try splitting your large integer into several DWORDs and get/store them in several calls. :)
Posted on 2004-12-21 14:42:42 by QvasiModo
Hi roticv !
Read it as a string and convert it to 64bit (Either using your own or someone else).


That seems like a good solution :)

Hi Raymond !
but you would have to first convert the string to the required packed decimal format.


I knew about BCD which takes a lot of memory to store (a byte).
But I didn't know about Packed BCD's, which only takes a nibble
in memory - I have used it in practice, but I didn't know the name
for it. ;)
Nice FPU tutorial, but I may use the other solution from roticv,
if it's simpler to use.
Of course I would learn to use the FPU, which in itself is something !

Hi QvasiModo
Try splitting your large integer into several DWORDs and get/store them in several calls.

Nice, but wouldn't it be simpler to read the whole number, as a string
in only one call :)


regards,

>>>The SharK<<<
Posted on 2004-12-21 16:33:10 by The SharK
Assuming you have taken the precautions given in my previous post, the following code using the FPU could be used without any need for error checking apart of no input (not tested however).
;hDlg - handle of dialog box

;ID_edit - ID of your edit control
;txtbuf - 20-byte buffer memory variable
;packed_BCD - tbyte memory variable
;long_int - qword memory variable for your answer

invoke GetDlgItemText,hDlg,ID_edit,addr txtbuf,18
.if eax == 0
;whatever code you need when no input
.endif
push esi
push edi
mov ecx,eax ;count of characters returned
lea esi,txtbuf
add esi,eax ;point to null terminator
lea edi,packed_BCD
mov dword ptr[edi],0
mov dword ptr[edi+4],0
mov word ptr[edi+8],0 ;rezero it as precaution
@@:
dec esi
mov al,[esi]
and al,0fh
dec ecx
.if ZERO? ;needed for odd character count
mov [edi],al
jmp @F
.endif
ror ax,4 ;move nibble to high nibble of AH
dec esi
mov al,[esi]
rol ax,4 ;bring nibble back to AL
stosb
dec ecx
jnz @B
@@:
pop edi
pop esi
finit ;for precaution
fbld packed_BCD
fistp long_int


Hope it helps.

Raymond
Posted on 2004-12-21 22:31:26 by Raymond