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

x
?
Solved

ActiveX - VB Property Categories

Posted on 1998-10-12
9
Medium Priority
?
281 Views
Last Modified: 2013-11-20
I create an ActiveX control with MFC

I add a property say "Caption".  No problem...I don't need help with the code.

However I do need help with this:
My ActiveX control lists it's Caption property under "Misc" when it's inserted in a VB Form (property window in VB for the controls).  However I want it to appear under "Appearance" category in VB like the standard static control.

Question is -
1. how do I fix this
2. how does VB decide what categories to sort the control's properties into (e.g. What goes into Misc, what goes into Appearance, etc.)

Thanks
0
Comment
Question by:Answers2000
[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
  • 6
  • 2
9 Comments
 
LVL 8

Author Comment

by:Answers2000
ID: 1323223
BTW : i'm fairly clued up on Windows / MFC.  I even know a bit of OCX/ActiveX stuff, so I don't need tonnes of background info, unless it's immediately relevant to the question at hand.


0
 
LVL 8

Author Comment

by:Answers2000
ID: 1323224
BTW : i'm fairly clued up on Windows / MFC.  I even know a bit of OCX/ActiveX stuff, so I don't need tonnes of background info, unless it's immediately relevant to the question at hand.


0
 
LVL 8

Author Comment

by:Answers2000
ID: 1323225
Increased pts
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Author Comment

by:Answers2000
ID: 1323226
Has anybody got any help - or even read this ?
0
 
LVL 5

Expert Comment

by:AnswerTheMan
ID: 1323227
yes i read this. i have no answer but i'm confused.
till now i was thinking that the right way is to build the ActiveX in VB and use them in C++, and not the other way around.
0
 
LVL 8

Author Comment

by:Answers2000
ID: 1323228
AnswerTheMan - The host app, and the control can both be in more or less any language (including C/C++, VB, Delphi and probably a few more too).  Mix and match to your preferences..

I'm doing high performance graphics - hence the C++ for the control
0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 300 total points
ID: 1323229
Nice Question
I found this at http://www.vcdj.com/vcdj/aug98/atl1.asp

3. How do I support property categories?

The OCX96 specification defines the ICategorizeProperties interface to categorize different properties in the container's property browser. Microsoft Visual Basic supports this categorization for its Property Inspector and obtains this interface through QueryInterface(). So, to support this feature, the control writer must implement the ICategorizeProperties interface.

ICategorizePriorities supports two methods, declared as follows:



MapPropertyToCategory( [in] DISPID, [out] PROPCAT*)
GetCategoryName( [in] PROPCAT, [in] LCID, [out] BSTR*)


The first returns the category ID for the property whose dispid is passed in. The second method returns the text name of the category requested. This latter method need not be supported unless the control has specific categories of its own. It also should not be called for any standard category IDs of which the container already should be aware. The following standard category IDs are documented in the specification:

#define PROPCAT_Nil-1#define PROPCAT_Misc-2#define PROPCAT_Font-3#define PROPCAT_Position-4#define PROPCAT_Appearance-5#define PROPCAT_Behavior-6#define PROPCAT_Data-7#define PROPCAT_List-8#define PROPCAT_Text-9#define PROPCAT_Scale-10#define PROPCAT_DDE-11

The following steps show how to implement the ICategorizeProperties interface in your ATL control:

1. Declare the ICategorizeProperties:



const IID IID_ICategorizeProperties =
    {0x4D07FC10,0xF931,0x11CE,{0xB0,0x01,0x00,0xAA,0x00,0x68,0x84,0xE5}};

typedef int PROPCAT;

interface ICategorizeProperties : public IUnknown
{

STDMETHOD(MapPropertyToCategory)(/*[in]*/ DISPID dispid,
                  /*[out]*/ PROPCAT* ppropcat) = 0 ;

STDMETHOD(GetCategoryName)(/*[in]*/ PROPCAT propcat,
                  /*[in]*/ LCID lcid,
                  /*[out]*/ BSTR* pbstrName) = 0 ;

};


2. Include the interface in the control class's base class list:



class ATL_NO_VTABLE CXXX :
                  public CComObjectRootEx<CComSingleThreadModel>,
                  public CComCoClass<CXXX, &CLSID_XXX>,
                  public CComControl<CXXX>,
                  …
                  …
                  public ICategorizeProperties

{


3. To enable the QueryInterface() for ICategorizeProperties add the corresponding COM_INTERFACE_ENTRY macro:



BEGIN_COM_MAP (CXXX)
      ...
      ...
      COM_INTERFACE_ENTRY(ICategorizeProperties)
END_COM_MAP ()


4. Implement the methods of ICategorizeProperties:



STDMETHOD(MapPropertyToCategory)(   /*[in]*/ DISPID dispid,
                  /*[out]*/ PROPCAT* ppropcat
                  )
{
      if(dispid >=1000 && dispid <=1005)
      {
         *ppropcat = 1;      
         return S_OK;       
      }
      return E_FAIL;
}

STDMETHOD(GetCategoryName)(      /*[in]*/ PROPCAT propcat,
                  /*[in]*/ LCID lcid,
                  /*[out]*/ BSTR* pbstrName
                  )
{
      if(propcat == 1)
      {
            *pbstrName = ::SysAllocString(L"Instrument");
            return S_OK;
      }
      return E_FAIL;
}
0
 
LVL 8

Author Comment

by:Answers2000
ID: 1323230
I'll try this and let you know
0
 
LVL 13

Expert Comment

by:Mirkwood
ID: 1323231
I works pretty cool.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

596 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