From: claus.kick on
On 21 Sep., 15:54, "Nhat Dung" <nhatd...(a)hotmail.com> wrote:
> Thanks you all for help me :)
> I had compile my code in VC6 + XP and everything work ... fine
> Still can't understand why ???

Are you sure you did use your original code?
From: Men on
typedef struct tagREBARBANDINFOA
{
UINT cbSize;
UINT fMask;
UINT fStyle;
COLORREF clrFore;
COLORREF clrBack;
LPSTR lpText;
UINT cch;
int iImage;
HWND hwndChild;
UINT cxMinChild;
UINT cyMinChild;
UINT cx;
HBITMAP hbmBack;
UINT wID;
#if (_WIN32_IE >= 0x0400)
UINT cyChild;
UINT cyMaxChild;
UINT cyIntegral;
UINT cxIdeal;
LPARAM lParam;
UINT cxHeader;
#endif
#if (_WIN32_WINNT >= 0x0600)
RECT rcChevronLocation; // the rect is in client co-ord wrt hwndChild
UINT uChevronState; // STATE_SYSTEM_*
#endif
} REBARBANDINFOA, *LPREBARBANDINFOA;


BOOL RBValidateBandInfo(LPREBARBANDINFO *pprbbi, LPREBARBANDINFO prbbi)
{
BOOL fRet = ((*pprbbi)->cbSize == sizeof(REBARBANDINFO));

if (!fRet) {

if ((*pprbbi)->cbSize < SIZEOF(REBARBANDINFO)) {
hmemcpy(prbbi, (*pprbbi), (*pprbbi)->cbSize);
(*pprbbi) = prbbi;
prbbi->cbSize = SIZEOF(REBARBANDINFO);
fRet = TRUE;
}
}

return fRet;
}

COMCTL32!RBValidateBandInfo:
5d18413b 8bff mov edi,edi
5d18413d 55 push ebp
5d18413e 8bec mov ebp,esp
5d184140 57 push edi
5d184141 8b7d08 mov edi,dword ptr [ebp+8] ss:0023:0012f258=0012f2cc
5d184144 8b0f mov ecx,dword ptr [edi] ds:0023:0012f2cc=0012f6c0
5d184146 8b11 mov edx,dword ptr [ecx] ds:0023:0012f6c0=00000064
5d184148 33c0 xor eax,eax
5d18414a 83fa50 cmp edx,50h
5d18414d 0f94c0 sete al
5d184150 85c0 test eax,eax
5d184152 0f84043c0100 je COMCTL32!RBValidateBandInfo+0x19 (5d197d5c)
5d184158 5f pop edi
5d184159 5d pop ebp
5d18415a c20800 ret 8

5d197d5c 83fa50 cmp edx,50h
5d197d5f 0f83f3c3feff jae COMCTL32!RBValidateBandInfo+0x39 (5d184158) [br=1]
5d197d65 56 push esi
5d197d66 8b750c mov esi,dword ptr [ebp+0Ch]
5d197d69 52 push edx
5d197d6a 51 push ecx
5d197d6b 56 push esi
5d197d6c e81ce0fdff call COMCTL32!memmove (5d175d8d)
5d197d71 83c40c add esp,0Ch
5d197d74 8937 mov dword ptr [edi],esi
5d197d76 33c0 xor eax,eax
5d197d78 c70650000000 mov dword ptr [esi],50h
5d197d7e 40 inc eax
5d197d7f 5e pop esi
5d197d80 e9d3c3feff jmp COMCTL32!RBValidateBandInfo+0x39 (5d184158)

If you compile in VC6 + XP, VC6 defines _WIN32_WINNT 0x0400, so sizeof(REBARBANDINFO)==0x50, and works on XP.
If you compile in SDK7+ XP, SDK7 defines _WIN32_WINNT 0x0600, so sizeof(REBARBANDINFO)==0x64, and fails on XP.

You should
add
#define _WIN32_WINNT 0x0501
before
#include "windows.h"
or
change
REBARBANDINFO rbBand = { sizeof(REBARBANDINFO) };
to
REBARBANDINFO rbBand = { REBARBANDINFO_V6_SIZE };
for your code to be compiled with SDK7 to run on XP.

"Nhat Dung" <nhatdung(a)hotmail.com> wrote:
> Thanks you all for help me :)
> I had compile my code in VC6 + XP and everything work ... fine
> Still can't understand why ???
From: Timo Kunze on
claus.kick(a)googlemail.com schrieb:
> Also, as a side note, I think you have to fill an imagelist first,
> before you set it for any control.
I don't think so. For instance you can use the system image list which
will contain only a handful icons in the beginning.

Timo

@Christian: Sorry for sending you the mail, I selected the wrong command
in my client. The message was meant to be posted here.
--
www.TimoSoft-Software.de - Unicode controls for VB6
"Those who sacrifice freedom for safety deserve neither."
"Demokratie ist per Definition unsicher. Ihr Schutz entsteht aus der
Überzeugung, dass die demokratischen Kräfte überwiegen und sich – auf
demokratischem Wege – durchsetzen."
From: Nhat Dung on
Hello, i'm sure 100% that is my code and i doesn't change anything.
I also try to change
REBARBANDINFO rbBand = { REBARBANDINFO_V6_SIZE };
But that won't work :(


From: Men on
Have you removed the "rbBand.cbSize = sizeof(REBARBANDINFO);" line?

With the following two fixes, your code works on my XP with SDK6.0A + VC9sp1.

/* REBARBANDINFO rbBand = { sizeof(REBARBANDINFO) };
*/REBARBANDINFO rbBand = { REBARBANDINFO_V6_SIZE };

/* rbBand.cbSize = sizeof(REBARBANDINFO);//_V6_SIZE
*/

"Nhat Dung" <nhatdung(a)hotmail.com> wrote:
> Hello, i'm sure 100% that is my code and i doesn't change anything.
> I also try to change
> REBARBANDINFO rbBand = { REBARBANDINFO_V6_SIZE };
> But that won't work :(