Thread: string resources in tooltips

  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, 05:45 PM
  3. Something is wrong with this menu...
    By DarkViper in forum Windows Programming
    Replies: 2
    Last Post: 12-14-2002, 11:06 PM
  4. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 03:23 PM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM