Hello
I have created 260 bytes using GlobalAlloc and GPTR flag, the return is successful.
I have stored the returned address in the lParam member of TCITEM successfully.
when my program terminates I try to free the allocated memory but lParam is 0 and SendMessage returns 0 as well on some of the items.
what could be the problem?
this is my log file, and if you notice the addresses of tab 1 and 2 are incorrect but that is what SendMessage returned to me???
thank you
I have created 260 bytes using GlobalAlloc and GPTR flag, the return is successful.
I have stored the returned address in the lParam member of TCITEM successfully.
when my program terminates I try to free the allocated memory but lParam is 0 and SendMessage returns 0 as well on some of the items.
what could be the problem?
DestroyPages proc uses ebx esi
xor ebx, ebx
xcall SendMessage, hTabControl, TCM_GETITEMCOUNT, 0, 0
mov esi, eax
.repeat
xcall DestroyPage, ebx
inc ebx
.until ebx == esi
ret
DestroyPages endp
DestroyPage proc index:DWORD
mov tab.imask, TCIF_PARAM
xcall SendMessage, hTabControl, TCM_GETITEM, index, offset tab
xcall GlobalFree, tab.lParam
xcall SendMessage, hTabControl, TCM_DELETEITEM, index, 0
ret
DestroyPage endp
this is my log file, and if you notice the addresses of tab 1 and 2 are incorrect but that is what SendMessage returned to me???
@CreatePage(): 260 byte allocated, mem=1355184
@CreatePage(): TCM_INSERTITEM=0
@CreatePage(): tab.lParam=1355184
@CreatePage(): 260 byte allocated, mem=1381608
@CreatePage(): TCM_INSERTITEM=1
@CreatePage(): tab.lParam=1381608
@CreatePage(): 260 byte allocated, mem=1381928
@CreatePage(): TCM_INSERTITEM=2
@CreatePage(): tab.lParam=1381928
@CreatePage(): 260 byte allocated, mem=1376032
@CreatePage(): TCM_INSERTITEM=3
@CreatePage(): tab.lParam=1376032
@CreatePage(): 260 byte allocated, mem=1412488
@CreatePage(): TCM_INSERTITEM=4
@CreatePage(): tab.lParam=1412488
@DestroyPages(): TabCount = 5
@DestroyPage(): tab #0, TCM_GETITEM = 1
@DestroyPage(): tab #0, tab.lParam=1355184
@DestroyPage(): tab #1, TCM_GETITEM = 1
@DestroyPage(): tab #1, tab.lParam=1381928
@DestroyPage(): tab #2, TCM_GETITEM = 1
@DestroyPage(): tab #2,tab.lParam=1412488
@DestroyPage(): tab #3, TCM_GETITEM = 0
@DestroyPage(): tab #3, tab.lParam=0
@DestroyPage(): tab #4, TCM_GETITEM = 0
@DestroyPage(): tab #4, tab.lParam=0
@CreatePage(): TCM_INSERTITEM=0
@CreatePage(): tab.lParam=1355184
@CreatePage(): 260 byte allocated, mem=1381608
@CreatePage(): TCM_INSERTITEM=1
@CreatePage(): tab.lParam=1381608
@CreatePage(): 260 byte allocated, mem=1381928
@CreatePage(): TCM_INSERTITEM=2
@CreatePage(): tab.lParam=1381928
@CreatePage(): 260 byte allocated, mem=1376032
@CreatePage(): TCM_INSERTITEM=3
@CreatePage(): tab.lParam=1376032
@CreatePage(): 260 byte allocated, mem=1412488
@CreatePage(): TCM_INSERTITEM=4
@CreatePage(): tab.lParam=1412488
@DestroyPages(): TabCount = 5
@DestroyPage(): tab #0, TCM_GETITEM = 1
@DestroyPage(): tab #0, tab.lParam=1355184
@DestroyPage(): tab #1, TCM_GETITEM = 1
@DestroyPage(): tab #1, tab.lParam=1381928
@DestroyPage(): tab #2, TCM_GETITEM = 1
@DestroyPage(): tab #2,tab.lParam=1412488
@DestroyPage(): tab #3, TCM_GETITEM = 0
@DestroyPage(): tab #3, tab.lParam=0
@DestroyPage(): tab #4, TCM_GETITEM = 0
@DestroyPage(): tab #4, tab.lParam=0
thank you
when you delete, the index of the item changes
you should call DestroyPage in a loop with a parameter of 0 (so you always delete the first item), not ebx
you should call DestroyPage in a loop with a parameter of 0 (so you always delete the first item), not ebx
thank you !!
@Comrade, thank you, passing 0 works!! (should see that myself) :oops:
@suddent, you had the same problem :shock:
@suddent, you had the same problem :shock:
You are welcome, my most dearest friend.
SOCIALISM AND ISLAM GREET YOU
SOCIALISM AND ISLAM GREET YOU
Well, I guess that makes you doubly evil, eh?
Are you proud to have hundreds of millions of lives on your conscience, if you even have one?
Are you proud to have hundreds of millions of lives on your conscience, if you even have one?