|
I have created simple ATL project. Using AddClass i have added ATL Control object which has a stock property 'Fillcolor' then finished the wizard. After that i tried to add property by using 'add propery', its creating necessary entries in IDL file but its not creating get and set methods to the implementation file.
why this happens? Please help me.
I also find that if i add stock propery to the ATL Control only the above problem occurs.
|
|
|
|
|
have you tried this tutorial? Its quite quick to go through.
ActiveX Tutorial[^]
bart
|
|
|
|
|
Yes, the same tutorial i have tried.
In Step 3: "Adding a Property to the Control" it states get_Sides and put_Sides methods added when we add a property "Sides". but its not adding that methods.
This problem occurs only when we add stock property in previous step 2.
|
|
|
|
|
OK, let me have a quick look at the tutorial
bart
|
|
|
|
|
ok sir
|
|
|
|
|
Hi
I am creating a toolbar for IE in ARL,COM and WTL.I want to add bitmap images to the toolbar buttons programmatically.previously I was adding the images on the toolbar buttons by hand drawing.But these images obviously do not look good.I want to add bitmap images to the buttons programmatically.Can anybody help me with code?Thanks in advance.
|
|
|
|
|
/*Here, hInst is your HINSTANCE, like: HINSTANCE hInst = _Module.GetResourceInstance();*/
/*IDB_SOME is the resource ID of your new bitmap added to the project*/
/*hWnd is the HWND of the toolbar*/
TBADDBITMAP bmpNew;<br />
bmpNew.hInst = hInst;<br />
bmpNew.nID = IDB_SOME;<br />
::SendMessage(hWnd,TB_ADDBITMAP,1,LPARAM(&bmpNew));
TBBUTTONINFO tb;<br />
memset(&tb,0,sizeof(TBBUTTON));<br />
tb.cbSize = sizeof(TBBUTTONINFO);<br />
tb.dwMask = TBIF_IMAGE;
/*Here, set this number to the next value after the end of your bitmapped toolbar*/
tb.iImage = 6;
/*ID_FIRST_BUTTON is the ID of the toolbar button you want to set the image of*/
::SendMessage(hWnd,TB_SETBUTTONINFO,ID_FIRST_BUTTON,LPARAM(&tb));
this is this.
|
|
|
|
|
I need pass struct from client to ATL(EXE server).The struct is defined as
struct node{
BSTR description; /* optional element of type xsd:string */
BSTR id; /* optional element of type xsd:string */
BSTR name; /* optional element of type xsd:string */
struct {BSTR* tags;int numberOfTags;}
}.
So I add the following codes two IDL file,
typedef struct TAGS_DEF {
BSTR* item; //pointer to the memory where tags are stared.
int length; //number of tags
}TAGS;
typedef struct RESNODE {
BSTR description; /* optional element of type xsd:string */
BSTR id; /* optional element of type xsd:string */
BSTR name; /* optional element of type xsd:string */
TAGS tags;
}ResNode
And I add an interface "[id(6), helpstring("方法AddOrModifyRes")] HRESULT AddOrModifyRes([in] ResNode* res, [in] BSTR operat);"
But the code can't run when the client call the interface.The codes in clients is
hr = spf.CoCreateInstance( CLSID_DataServer);
if( FAILED( hr )) throw( _T("server errror!"));
ResNode rn;
BSTR* tmpStr=NULL;
rn.tags.item=tmpStr;
rn.tags.length=0;
BSTR tmp=L"add";
spf->AddOrModifyRes(rn,tmp);
if the ATL is defined as a DLL. the problem doesn't appear.
the following is the content of my idl file.
// monwebDataService.idl : monwebDataService 的 IDL 源
//
import "oaidl.idl";
import "ocidl.idl";
typedef struct TAGS_DEF {
BSTR* item; //pointer to the memory where tags are stared.
int length; //number of tags
}TAGS;
typedef struct RESNODE {
BSTR description; /* optional element of type xsd:string */
BSTR id; /* optional element of type xsd:string */
BSTR name; /* optional element of type xsd:string */
TAGS tags;
}ResNode;
[
object,
uuid(EEC2233E-D1A7-435A-9CBD-48901778AEB7),
dual,
nonextensible,
helpstring("IDataServer 接口"),
pointer_default(unique)
]
interface IDataServer : IDispatch{
[id(1), helpstring("IsDataOK")] HRESULT IsDataOK([in,out] BYTE* sucFlag);
[id(2), helpstring("AddOrModifyRes")] HRESULT AddOrModifyRes([in] ResNode* res, [in] BSTR operat);
};
[
uuid(B79310B8-7A31-4598-897B-A9DD16EA3C33),
version(1.0),
helpstring("monwebDataService 1.0 tlb ")
]
library monwebDataServiceLib
{
importlib("stdole2.tlb");
[
uuid(8256EA22-CA60-4914-B8EB-F215E01C91A7),
helpstring("DataServer Class")
]
coclass DataServer
{
[default] interface IDataServer;
};
};
kasin li
|
|
|
|
|
Read this [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I have a CToolBar that uses the TBSTYLE_EX_MIXEDBUTTONS|TBSTYLE_EX_DRAWDDARROWS style, and some toolbar buttons use the BTNS_DROPDOWN style and some of them use BTNS_WHOLEDROPDOWN style. I'd like to make the arrows on the right side of the buttons little bigger and the drop down part more wider, like the Google has done with their toolbar buttons.
I have tried to custom draw the drop down part of the buttons in CDDS_ITEMPOSTPAINT, but here I don't get the button style and even the rect is smaller than actual button size for BTNS_WHOLEDROPDOWN styled buttons.
I am using pure ATL code(***NO MFC***).
Regards!
Padmanabh Sharma
|
|
|
|
|
I think you can try to set another toolbar on top of your current specific toolbar button. That new toolbar should have only one button in it, a wide one. Just like you can put regular controls instead of toolbar buttons, I believe you can also set a toolbar on one of the buttons.
First you need to set the style of that button to TBSTYLE_SEP , then set the new toolbar on top of it, and set the button's width yourself, handle the OnSize handler, ... something like that...;)
this is this.
|
|
|
|
|
Hi there,
I have created a MFC-Active control, which maps some functions over the dispatch map. Then I want to use these functions in a VB-Marco in Excel, Word or somewhere else.
My pronlem is that, when I create a project in VS 2005 and directly add the functions like:
afx_msg void AboutBox();
afx_msg int GetLength();
in my control and declare it in the .cpp file as:
BEGIN_DISPATCH_MAP(cAHA_Ctrl, COleControl)
DISP_FUNCTION_ID(cAHA_Ctrl, "AboutBox", DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE)
DISP_FUNCTION_ID(cAHA_Ctrl, "GetLength", dispidGetLength, GetLength, VT_I4, VTS_NONE)
END_DISPATCH_MAP()
The methods are also created:
void cAHA_Ctrl::AboutBox(){
AfxMessageBox(IDS_INFO);
}
int cAHA_Ctrl::GetLength(){
return m_vMyVec.size();
}
It is only working at the first time of compilation, then I can use these function in an Excel VBA-macro.
Then I add some more functions in the same way and rebuild my control. This later added function is not visible in the Excel VBA-macro. The first functions are working fine, but all functions, which where later added are not available.
I already tried to unregister the control via regsvr32 /u aha.ocx, I cleaned the solution and removed all files from the MIDL compiler.
It still isn´t working.
If somebody has an idea how to solve this problem, I would be happy to get any hint.
kind regards
Volker
|
|
|
|
|
Increment minor version for your component, if you are adding some new method.
Prasad
MS MVP - VC++
|
|
|
|
|
When you open the OCX Typelibrary in OLE Viewer, are you able to see all your methods (including the new ones) ?
where is dispidGetLength declared?
S o h a i l K a d i w a l a
To Err Is Human; to Debug, Divine
modified 21-Apr-21 21:01pm.
|
|
|
|
|
Yes I can see every method. Only an excla VBA script is not able to seen them.
dispidGetLentgh is declared in the main control class, which is derived from COleControl.
|
|
|
|
|
Have you tried original suggestion by me?
Prasad
MS MVP - VC++
|
|
|
|
|
Yes I tried it, but that did not work. The solution always failed to register.
kind regards
Volker
|
|
|
|
|
In dialog,or SDI without view,there are many problem when I add WM_PAINT event.
But in MFC it is ok.I can draw in OnPaint.
|
|
|
|
|
Can you describe your problem ?
Prasad
MS MVP - VC++
|
|
|
|
|
i have a dll that i've compiled with c++ compiler. i use this this dll in my c# project. i can load the dll from the outside of the project. like :
<br />
[DllImport("tdes.dll")]<br />
unsafe public static extern void Encrypt ( char* input, char* output,int size );<br />
but i want to use this dll as embedded resource. how can load the dll from the resources?
*** Information is Power ***
|
|
|
|
|
I have a situation (due to time constraints) that I need to cram a std::map<std::string,uint> into a std::vector<byte>. Can anyone help me?
|
|
|
|
|
For some reason, the original post parsed out the std:map of (std::string,uint) and std:vector of (byte).
|
|
|
|
|
That's a really bad idea. Are you sure this will really save you time?!?!
Steve
|
|
|
|
|
I'm not sure what you mean but I quess perhaps something like this:
typedef std::vector<std::map<..., ...> > VectorOfMaps_t;
The "..."s should be filled in with the types you require in the map . I have used a typedef to avoid having to type the huge type name everywhere and for maintainability. "VectorOfMaps_t" is a bad name really because if I changed the type to a std::deque of std::map 's it would become misleading.
Steve
|
|
|
|
|
What you're thinking of is called serialization. Look here on CP and MSDN, the topic has been widely covered.
|
|
|
|