Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Skin Framework
  New Posts New Posts RSS Feed - Embed cjstyles in exe?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Embed cjstyles in exe?

 Post Reply Post Reply
Author
Message
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Topic: Embed cjstyles in exe?
    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?

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 09 July 2007 at 1:22am
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
Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 09 July 2007 at 11:51am
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

Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 09 July 2007 at 12:12pm
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.


Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 09 July 2007 at 1:14pm
Hi,
 
THEMES_INI and string 5000 can be commented - will not used if you add style to exe.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 09 July 2007 at 1:28pm
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:


Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 10 July 2007 at 12:09am
Right :(
You also need override CXTPSkinManagerSchema* CreateSchema() - see default implementation.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 10 July 2007 at 1:40am
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.

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 10 July 2007 at 9:07am

Hi,

Its only one class for Office2007. was temporary solution that still not changed :(
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Ark42 View Drop Down
Senior Member
Senior Member
Avatar

Joined: 20 October 2003
Status: Offline
Points: 291
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ark42 Quote  Post ReplyReply Direct Link To This Post Posted: 10 July 2007 at 11:19am
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.


Back to Top
aelsmore View Drop Down
Newbie
Newbie


Joined: 27 July 2009
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote aelsmore Quote  Post ReplyReply Direct Link To This Post Posted: 28 July 2009 at 7:30am
Is it also possible to do this in VB6?
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.