string resources in tooltips

This is a discussion on string resources in tooltips within the Windows Programming forums, part of the Platform Specific Boards category; Here is the problem, I've created a tooltip and i've set up some dialog item tools (TTM_ADDTOOL) associated with it. ...

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    7

    string resources in tooltips

    Here is the problem, I've created a tooltip and i've set up some dialog item tools (TTM_ADDTOOL) associated with it. It all works fine but I want them to pick up text from resorce strings. Whenever the tooltip loads a string from executable resources It only loads 30-40 chars and then nothing more. Opening the resource script with notepad I can see the string fully registered in the string table. What goes wrong here? I don't think string resources have a limited length so maybe It is a load problem.
    Any help is wellcome.

    seed

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    7
    ok, probably when I put the string ID in lpszText member of NMTTDISPINFO structure It tries to load the string resource in szText member which is an [80] char array, so the string is cut. Manually loading should solve the problem.

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    7
    -- THIS SHOULD WORK --

    Code:
    case WM_NOTIFY:
    
    if(((LPNMHDR)lParam)->code==TTN_NEEDTEXT)
    {
    					
    	LPTOOLTIPTEXT	lpttt=(LPTOOLTIPTEXT) lParam;
    	int		idCtrl=GetDlgCtrlID((HWND)((LPNMHDR)lParam)->idFrom);
    			
    	static char	cstrToolText[512];
    
    	switch(idCtrl)
    	{
    	case IDC_XXX:
                  LoadString(g_hInstance,IDS_STRING_XXX,cstrToolText,512);
    		pttt->lpszText = cstrToolText;
    		break;
    	}
    }
    
    break;
    Last edited by seed; 08-14-2003 at 06:58 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 04-25-2008, 02:45 PM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  3. Something is wrong with this menu...
    By DarkViper in forum Windows Programming
    Replies: 2
    Last Post: 12-14-2002, 10:06 PM
  4. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 02:23 PM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21