Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Determining whether an HTEMPLATE is a DLGTEMPLATE* or a DLGTEMPLATEEX

Posted on 2000-04-04
2
Medium Priority
?
698 Views
Last Modified: 2013-11-20
Hi,

I have a Create method for my dialog, called CreateHidden(), which is used to insert dialogs into a tab control. Before calling CreateIndirect(), I am changing some styls, but the code is different when having extended styles than when not having extended styles. How can I determine whether the HTEMPLATE is extended (DLGTEMPLATEEX)or not (DLGTEMPLATE)?

The code of CreateHidden() is as follows:

BOOL CTemplateTab::CreateHidden(UINT id, CWnd *pParent)
{
      LPCTSTR lpszTemplateName = MAKEINTRESOURCE(id);
      ASSERT(HIWORD(lpszTemplateName) == 0 ||
            AfxIsValidString(lpszTemplateName));

      m_lpszTemplateName = lpszTemplateName;  // used for help
      if (HIWORD(m_lpszTemplateName) == 0 && m_nIDHelp == 0)
            m_nIDHelp = LOWORD((DWORD)m_lpszTemplateName);

      HINSTANCE hInst = AfxGetResourceHandle();
      HRSRC hResource = ::FindResource(hInst, lpszTemplateName, RT_DIALOG);
      HGLOBAL hTemplate = LoadResource( hInst, hResource );
      DLGTEMPLATE* pTemplate = (DLGTEMPLATE*)hTemplate;
      DLGTEMPLATEEX* pTemplateEx = (DLGTEMPLATEEX*)hTemplate;
      BOOL bExStyle = (???);  // **** HOW DO I DO THIS ???
      if (bExStyle)
      { // Extended style
            [...]
      }
      else
      { // Non-extended style
            [...]
      }
      BOOL bResult = CreateIndirect( hTemplate, pParent, hInst );
      FreeResource(hTemplate);
      return bResult;
}
0
Comment
Question by:Brian_HP
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 200 total points
ID: 2683248
Hi Brian_HP,

this is from MSDN help about DLGTEMPLATEEX's member 'signature':

-----------------------------------------------------------------------------------------------------------
signature

Indicates whether a template is an extended dialog box template. A value of 0xFFFF indicates an extended dialog box template. In this case, the dlgVer member specifies the template version number. If signature is any value other than 0xFFFF, this is a standard template that uses the DLGTEMPLATE and DLGITEMTEMPLATE structures.
------------------------------------------------------------------------------------------------------------

so, simply cast to DLGTEMPLATEEX and if its 'signature' isn't 0xFFFF cast it to DLGTEMPLATE.

hope that helps,

ZOPPO
0
 

Author Comment

by:Brian_HP
ID: 2683292
Hi Zoppo,

Thanks for your help. Actually, this was also the way I solved it, except that I wasn't sure whether this was "the best" solution or not.  Next time I should maybe read the whole the help text, I am viewing :)

Brian
0

Featured Post

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question