Linking styles statically |
Post Reply |
Author | |
ABuenger
Newbie Joined: 02 February 2006 Status: Offline Points: 1075 |
Post Options
Thanks(0)
Posted: 02 May 2006 at 10:41am |
Is it possible to link the Office2007.cjstyles into the EXE? |
|
rmercer
Groupie Joined: 22 February 2006 Status: Offline Points: 34 |
Post Options
Thanks(0)
|
Why not add it as a resource to your project? This will compile it into your .exe. In your CWinApp::InitInstance() load the resource and write it to disk as a temp file (prior to creating your document template). When your main FrameWnd is constructed and you call XTPSkinManager()->LoadSkin(), just pass in the temp pathname you wrote the skin file to. I don't see any reason why this wouldn't work. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi, I guess it will work even without creating temporary file. Just specify your executable file in firsts parameter of LoadSkin. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
ABuenger
Newbie Joined: 02 February 2006 Status: Offline Points: 1075 |
Post Options
Thanks(0)
|
Tried to add the .cjstyles file to the resources, but in CXTPSkinManagerResourceFile::Open the resource can not be found, the following line failes. HRSRC hRsrc = FindResource(m_hModule, strFilePath, _T("TEXTFILE")); I guess the problem is that the TEXTFILE resource is wrapped in the executable. My executable \ cjstyles (executable) \ TEXTFILE resource Then I've tried to add the "SkinFramework/Styles/Office2007/Office2007.rc" file to my resources, which results in "file not found: res\Office2007_Normal.ini" errors. Should I add the cjstyles or rc file to my resources? |
|
rmercer
Groupie Joined: 22 February 2006 Status: Offline Points: 34 |
Post Options
Thanks(0)
|
Excuse any typos since I'm typing this in on the fly... // CString m_strSkinTempFilename if ( (hResource = FindResource(AfxGetInstanceHandle(), MAKEINTRESOURCE(IDR_MYSKINRESOURCE), _T("TEXTFILE")) ) != NULL) } } } ... CXTPSkinManager()->LoadSkin(m_strSkinTempFilename); ... Don't forget to delete the tempfile at shutdown, and you'll want to add some additional code to confirm that the skin was actually loaded. Oleg's suggestion may work too, however I'm not familiar with what he's talking about, so I'll leave it up to him to assist you.
|
|
ABuenger
Newbie Joined: 02 February 2006 Status: Offline Points: 1075 |
Post Options
Thanks(0)
|
Thanks, but I would like to avoid to write the skin to a temporary file because that requires write permissions. I hope Oleg has a suggestion how to load it directly from the EXE.
Wouldn't that have the disadvantage that something that is already loaded is loaded (duplicated) again? CXTPSkinManager::SetResourceFile looks promising.
|
|
ABuenger
Newbie Joined: 02 February 2006 Status: Offline Points: 1075 |
Post Options
Thanks(0)
|
Ok, I've added the Office2007.rc to my rc2 file, added "..\Source\SkinFramework\Styles\Office2007" to my include folders and it compiles and it loads the skin, but the result is not what I've expected: That doesn't look like Office 2007 for me |
|
rmercer
Groupie Joined: 22 February 2006 Status: Offline Points: 34 |
Post Options
Thanks(0)
|
Your users don't have write permission to their temp folder? Okay, I'll let Oleg assist from here. |
|
ABuenger
Newbie Joined: 02 February 2006 Status: Offline Points: 1075 |
Post Options
Thanks(0)
|
I've figured out why it didn't worked, the problem is in CXTPSkinManager::LoadSkin BOOL bOffice2007 = CString(lpszResourcePath).Find(_T("Office2007")) > 0; I had to add "Office2007" to my executables name and then it worked fine. Please change, overload or whatever it with CXTPSkinManager::LoadSkin(LPCTSTR lpszResourcePath, LPCTSTR lpszIniFileName, XTPSkin skin=xtpSkinOffice2007) or whatever...
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Yes, right, please just change code now. For next vresion we will add SetShema method to allow you manually set CXTPSkinManagerSchemaOffice2007 class. Thanks for this point. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
ABuenger
Newbie Joined: 02 February 2006 Status: Offline Points: 1075 |
Post Options
Thanks(0)
|
Thanks, that would solve my problems, but is still not perfect. Users should be able to browse for *.cjstyles and *.msstyles skins, so wheter at compile nor at runtime I know the schema of the file. |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello, CString(lpszResourcePath).Find(_T("Office2007")) will still present, so if user browse it it will use correct Schema.... I guess we will add parameter to ini file what shema to use. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
ABuenger
Newbie Joined: 02 February 2006 Status: Offline Points: 1075 |
Post Options
Thanks(0)
|
That assumes that the file will not be renamed. What if the user renames Office2007.cjstyles to renamed.cjstyles? Adding the schema to the ini file would be the best idea. |
|
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 |