Embed cjstyles in exe? |
Post Reply |
Author | |
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
Posted: 09 July 2007 at 12:24am |
How can I put the cjstyles for Office 2007 skin into my exe as a resource and still use LoadSkin() on it? |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
1. in rc2 file add
#include "SkinFramework\Styles\Vista\Vista.rc"
and add patch to SkinFramework\Styles\Vista to you project resource settings 2. Add this code
class CInstanceResourceFile : public CXTPSkinManagerResourceFile
{ public: BOOL Open(LPCTSTR lpszResourcePath, LPCTSTR lpszIniFileName) { m_strResourcePath = lpszResourcePath; m_strIniFileName = lpszIniFileName; m_hModule = AfxGetInstanceHandle(); CString strFilePath(m_strIniFileName); REPLACE_S(strFilePath, _T('.'), _T('_')); REPLACE_S(strFilePath, _T('\\'), _T('_')); HRSRC hRsrc = FindResource(m_hModule, strFilePath, _T("TEXTFILE")); if (!hRsrc) return FALSE; HGLOBAL hResData = LoadResource(m_hModule, hRsrc); if (!hResData) return FALSE; m_lpTextFile = (LPWSTR)LockResource(hResData); m_lpTextFileEnd = m_lpTextFile + SizeofResource(m_hModule, hRsrc)/2; if (m_lpTextFile && m_lpTextFile[0] == 0xFEFF) m_lpTextFile++; return TRUE; } void Close() { } };
XTPSkinManager()->SetResourceFile(new CInstanceResourceFile());
XTPSkinManager()->LoadSkin(_T(" "), "normalblue.ini"); |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
Looks like it will work except for linker error:
fatal error CVT1100: duplicate resource. type:VERSION, name:1, language:0x0409 fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt |
|
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
I copied the lines from the resource file except for the version and it works.
How would we include multiple skins in one exe as resources then? THEMES_INI and stringtable 5000 would conflict. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
THEMES_INI and string 5000 can be commented - will not used if you add style to exe.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
THEMES_INI can be removed but if I remove string 5000, or change it from anything but exactly "Office 2007 Style" then the scrollbars become black:
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Right :(
You also need override CXTPSkinManagerSchema* CreateSchema() - see default implementation.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
Ah, you've lost me now. Why are there classes in code for each *.cjstyles file? I thought the point of the skins were that each skin was a self-contained file you could load without any code changes.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi, Its only one class for Office2007. was temporary solution that still not changed :(
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Ark42
Senior Member Joined: 20 October 2003 Status: Offline Points: 291 |
Post Options
Thanks(0)
|
Ok, I will not worry about it for now then. I only want Office themes so until Office 2008/2009/2010 is out and I add that theme, I can just leave the 5000 string info in there and it works for now too.
|
|
aelsmore
Newbie Joined: 27 July 2009 Status: Offline Points: 3 |
Post Options
Thanks(0)
|
Is it also possible to do this in VB6?
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |