Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Mon, 21 Jul 2008 06:26:18 -0700 (PDT),    group: microsoft.public.win32.programmer.ui        back       


How to create rebar control in Vista   
Hi,

I used the following code to create rebar, and it works well in Win2k3
SP2. But in Vista, I cannot see it.

VOID InitRebar(HWND hWnd){
	LRESULT lr;
	HWND hwndRB;
	REBARINFO rbi;
	REBARBANDINFO rbBand;
	HANDLE hImg;
	HWND hwndImg;

	// create rebar window
	hwndRB = CreateWindowEx(WS_EX_TOOLWINDOW,
		REBARCLASSNAME, _T(""),
		WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPSIBLINGS | RBS_AUTOSIZE,
		0,0, 0, 0,
		hWnd,(HMENU)IDC_MAINREBAR, hInst, NULL);

	rbi.cbSize = sizeof(REBARINFO);
	rbi.fMask = 0;
	rbi.himl = (HIMAGELIST)NULL;
	lr = SendMessage(hwndRB, RB_SETBARINFO, 0, (LPARAM)&rbi);

	// insert a img
	// load the img
	hImg = LoadImage(hInst,
		_T("D:\\share\\WindowsApplication1\\DialogTesting\\icon1.ico,0"),
		IMAGE_ICON,
		0, 0,
		LR_LOADFROMFILE);

	hwndImg = CreateWindow(_T("STATIC"),
		NULL,
		WS_CHILD | WS_VISIBLE | SS_ICON | SS_REALSIZEIMAGE | SS_NOTIFY,
		0, 0, 0, 0,
		hwndRB,
		(HMENU)IDC_STATICICON,
		hInst,
		NULL);

	// set static control image
	SendMessage(hwndImg, STM_SETICON, (WPARAM)hImg, NULL);

	rbBand.cbSize = sizeof(REBARBANDINFO);
	rbBand.fMask = RBBIM_STYLE | RBBIM_CHILDSIZE | RBBIM_CHILD |
RBBIM_SIZE;
	rbBand.fStyle = RBBS_CHILDEDGE | RBBS_NOGRIPPER;
	//rbBand.lpText = _T("ico");
	rbBand.hwndChild = hwndImg;
	rbBand.cxMinChild = 0;
	rbBand.cyMinChild = 20;
	rbBand.cx = 20;

	// insert the img into the rebar
	SendMessage(hwndRB, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);

	// insert a blank band
	rbBand.cbSize = sizeof(REBARBANDINFO);
	rbBand.fMask =  RBBIM_STYLE | RBBIM_SIZE;
	rbBand.fStyle = RBBS_CHILDEDGE | RBBS_HIDETITLE | RBBS_NOGRIPPER;

	rbBand.cx = 1;

	// insert the blank band into the rebar
	SendMessage(hwndRB, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
}

Please help me fix it. Thanks.
date: Mon, 21 Jul 2008 06:26:18 -0700 (PDT)   author:   unknown

Re: How to create rebar control in Vista   
wrote in message 
news:79b525d6-33f6-4002-add0-4cc7b927e281@i24g2000prf.googlegroups.com...
> Hi,
>
> I used the following code to create rebar, and it works well in Win2k3
> SP2. But in Vista, I cannot see it.
>
> VOID InitRebar(HWND hWnd){
> LRESULT lr;
> HWND hwndRB;
> REBARINFO rbi;
> REBARBANDINFO rbBand;
> HANDLE hImg;
> HWND hwndImg;
>
> // create rebar window
> hwndRB = CreateWindowEx(WS_EX_TOOLWINDOW,
> REBARCLASSNAME, _T(""),
> WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPSIBLINGS | RBS_AUTOSIZE,
> 0,0, 0, 0,
> hWnd,(HMENU)IDC_MAINREBAR, hInst, NULL);
>
> rbi.cbSize = sizeof(REBARINFO);
> rbi.fMask = 0;
> rbi.himl = (HIMAGELIST)NULL;
> lr = SendMessage(hwndRB, RB_SETBARINFO, 0, (LPARAM)&rbi);
>
> // insert a img
> // load the img
> hImg = LoadImage(hInst,
> _T("D:\\share\\WindowsApplication1\\DialogTesting\\icon1.ico,0"),
> IMAGE_ICON,
> 0, 0,
> LR_LOADFROMFILE);
>
> hwndImg = CreateWindow(_T("STATIC"),
> NULL,
> WS_CHILD | WS_VISIBLE | SS_ICON | SS_REALSIZEIMAGE | SS_NOTIFY,
> 0, 0, 0, 0,
> hwndRB,
> (HMENU)IDC_STATICICON,
> hInst,
> NULL);
>
> // set static control image
> SendMessage(hwndImg, STM_SETICON, (WPARAM)hImg, NULL);
>
> rbBand.cbSize = sizeof(REBARBANDINFO);
> rbBand.fMask = RBBIM_STYLE | RBBIM_CHILDSIZE | RBBIM_CHILD |
> RBBIM_SIZE;
> rbBand.fStyle = RBBS_CHILDEDGE | RBBS_NOGRIPPER;
> //rbBand.lpText = _T("ico");
> rbBand.hwndChild = hwndImg;
> rbBand.cxMinChild = 0;
> rbBand.cyMinChild = 20;
> rbBand.cx = 20;
>
> // insert the img into the rebar
> SendMessage(hwndRB, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
>
> // insert a blank band
> rbBand.cbSize = sizeof(REBARBANDINFO);
> rbBand.fMask =  RBBIM_STYLE | RBBIM_SIZE;
> rbBand.fStyle = RBBS_CHILDEDGE | RBBS_HIDETITLE | RBBS_NOGRIPPER;
>
> rbBand.cx = 1;
>
> // insert the blank band into the rebar
> SendMessage(hwndRB, RB_INSERTBAND, (WPARAM)-1, (LPARAM)&rbBand);
> }
>
> Please help me fix it. Thanks.

Have you called InitCommonControls()? (or InitCommonControlsEx() including 
ICC_COOL_CLASSES in the dwICC field of the INITCOMMONCONTROLSEX structure).

Either this became mandatory in Vista or you don't need to do it at all, I 
can't remember which.
date: Tue, 22 Jul 2008 14:27:20 +0100   author:   Steve Thresher

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us