Print Page | Close Window

Embed cjstyles in exe?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Skin Framework
Forum Description: Topics Related to Codejock Skin Framework
URL: http://forum.codejock.com/forum_posts.asp?TID=7555
Printed Date: 22 November 2024 at 7:13pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Embed cjstyles in exe?
Posted By: Ark42
Subject: Embed cjstyles in exe?
Date 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?




Replies:
Posted By: Oleg
Date 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


Posted By: Ark42
Date 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



Posted By: Ark42
Date 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.




Posted By: Oleg
Date 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


Posted By: Ark42
Date 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:




Posted By: Oleg
Date Posted: 10 July 2007 at 12:09am
Right :(
You also need override CXTPSkinManagerSchema* CreateSchema() - see default implementation.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Ark42
Date 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.



Posted By: Oleg
Date 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


Posted By: Ark42
Date 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.




Posted By: aelsmore
Date Posted: 28 July 2009 at 7:30am
Is it also possible to do this in VB6?



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net