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
    xcall DestroyPage, ebx
    inc ebx
  .until ebx == esi
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
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

thank you
Posted on 2005-07-24 13:32:16 by Chambao
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
Posted on 2005-07-24 14:39:05 by comrade
thank you !!
Posted on 2005-07-24 14:50:29 by suddent
@Comrade, thank you, passing 0 works!! (should see that myself)  :oops:
@suddent, you had the same problem  :shock:
Posted on 2005-07-24 18:35:55 by Chambao
You are welcome, my most dearest friend.

Posted on 2005-07-24 19:48:16 by comrade
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?
Posted on 2005-07-28 06:48:26 by Sephiroth3