Hi,
im having trouble trying to set button text on my toolbar from a string table in the resources. im using the following code but the ID of the string thats been added is always -1:
iStringID[0] = SendMessage(m_hToolBar, TB_ADDSTRING, reinterpret_cast<WPARAM>(m_hInstance), static_cast<WPARAM>(MAKELONG(IDS_NEW, 0)));
iStringID[1] = SendMessage(m_hToolBar, TB_ADDSTRING, reinterpret_cast<WPARAM>(m_hInstance), static_cast<WPARAM>(MAKELONG(IDS_OPEN, 0)));
iStringID[2] = SendMessage(m_hToolBar, TB_ADDSTRING, reinterpret_cast<WPARAM>(m_hInstance), static_cast<WPARAM>(MAKELONG(IDS_SAVE, 0)));
ZeroMemory(tbb, sizeof(tbb));
tbb[0].iBitmap = STD_FILENEW;
tbb[0].fsState = TBSTATE_ENABLED;
tbb[0].fsStyle = TBSTYLE_BUTTON;
tbb[0].idCommand = ID_FILE_NEW;
tbb[0].iString = iStringID[0];
tbb[1].iBitmap = STD_FILEOPEN;
tbb[1].fsState = TBSTATE_ENABLED;
tbb[1].fsStyle = TBSTYLE_BUTTON;
tbb[1].idCommand = ID_FILE_OPEN;
tbb[0].iString = iStringID[1];
tbb[2].iBitmap = STD_FILESAVE;
tbb[2].fsState = TBSTATE_ENABLED;
tbb[2].fsStyle = TBSTYLE_BUTTON;
tbb[2].idCommand = ID_FILE_SAVEAS;
tbb[0].iString = iStringID[2];
I also tried the following, but this didnt work either:
iStringID[0] = SendMessage(m_hToolBar, TB_ADDSTRING, reinterpret_cast<WPARAM>(m_hInstance), reinterpret_cast<WPARAM>(MAKEINTRESOURCE(IDS_NEW)));
iStringID[1] = SendMessage(m_hToolBar, TB_ADDSTRING, reinterpret_cast<WPARAM>(m_hInstance), reinterpret_cast<WPARAM>(MAKEINTRESOURCE(IDS_OPEN)));
iStringID[2] = SendMessage(m_hToolBar, TB_ADDSTRING, reinterpret_cast<WPARAM>(m_hInstance), reinterpret_cast<WPARAM>(MAKEINTRESOURCE(IDS_SAVE)));
ZeroMemory(tbb, sizeof(tbb));
tbb[0].iBitmap = STD_FILENEW;
tbb[0].fsState = TBSTATE_ENABLED;
tbb[0].fsStyle = TBSTYLE_BUTTON;
tbb[0].idCommand = ID_FILE_NEW;
tbb[0].iString = iStringID[0];
tbb[1].iBitmap = STD_FILEOPEN;
tbb[1].fsState = TBSTATE_ENABLED;
tbb[1].fsStyle = TBSTYLE_BUTTON;
tbb[1].idCommand = ID_FILE_OPEN;
tbb[0].iString = iStringID[1];
tbb[2].iBitmap = STD_FILESAVE;
tbb[2].fsState = TBSTATE_ENABLED;
tbb[2].fsStyle = TBSTYLE_BUTTON;
tbb[2].idCommand = ID_FILE_SAVEAS;
tbb[0].iString = iStringID[2];
Any help is much appreciated.
PS. How can i compile multiple language tables into 1 exe? ie, i want to have a string table for english, german, french etc, but i dont want to compile and exe separately for each language?
Cheers