Bonjour a tous.
J'ai un oetit soucis depuis un moment sur un update de tooltip sur un bouton d'une toolbar.
J'ai definis ma toolbar comme suis :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
int XXXXX::CreationStdToolBar()
{
	UINT lId;
	int lIndex;

	if (!mStdToolBar.Create(this) ||
		!mStdToolBar.LoadToolBar(IDR_ELV_STD_TOOLBAR))
	{
		TRACE0("Failed to create toolbar\n");
		return -1;      // fail to create
	}

	mStdToolBar.SetBarStyle(mStdToolBar.GetBarStyle() | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC);
	mStdToolBar.EnableDocking(CBRS_ALIGN_TOP);
	DockControlBar(&mStdToolBar, AFX_IDW_DOCKBAR_TOP);

	// On memorise les images des boutons qui peuvent etre caches
	lIndex = mStdToolBar.CommandToIndex(ID_ELV_TB_GEL_ALL);
	mStdToolBar.GetButtonInfo(lIndex, lId, mStyleGelAll, mImageGelAll);
Et apres dans ma toolbar windows j(ai ajouter dans les ressource le message qui va bien et cela marche.

Par contre, je voudrais changer dynamiquement le texte. J'ai essayer un certain nombre de methode mais je bloque sur un SendMessage qui me renvoi FALSE.
mon code est le cde ci dessous :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
    _AFX_THREAD_STATE* pThreadState = AfxGetThreadState();
   CToolTipCtrl* pToolTip = pThreadState->m_pToolTip;
 
   TOOLINFO ti;
 
   // Pour utiliser la structure TOOLINFO, il faut indiquer la taille de la structure,
	ZeroMemory(&ti, sizeof(ti));
	ti.cbSize= sizeof(ti);
 
	// l'ID du bouton associé
	ti.uId = (UINT_PTR)ID_ELV_TB_SPEAKER;
	// et le handle de la fenêtre mère
	ti.hwnd = AfxGetApp()->m_pMainWnd->m_hWnd;
 
	if (pToolTip->SendMessage(TTM_GETTOOLINFO , 0, (LPARAM) (LPTOOLINFO) &ti) == TRUE)
	{
		// il suffit juste d'indiquer ici l'information impérissable que vous voulez transmettre.
		ti.lpszText = _T("Toto Lariflette");
		pToolTip->SendMessage(TTM_SETTOOLINFO , 0, (LPARAM) (LPTOOLINFO) &ti);
		}
Auriez vous une petite idée....

Merci d'avance en tout cas.

Pos²