|
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.
|
|
|
|
|
Hi all,
I'm developing a document processing project using microsoft office document imaging 11.0(MODI) library for OCR in C#. MODI have an activeX control that is microsoft office document imaging viewer control.
If we have to install the MS office 2003,we can use MODI and their activeX control as references from the COM component dialog.
The adove all are working fine in my project,which is converted from visual studio 2003 to visual studio 2005.But,when i create a new project in visual studio 2005, and try to add the MODI viewer control in the form,it will thrown the error like "Failed to import the activeX control.Please ensure it is properly registered". I dont know what i did wrong.
Now I'm using visual studio 2005.
So, please anyone help me regarding to this.
Thanks in advance.
|
|
|
|
|
Hello,
Can any one guide me know to disable back button in Firefox browser.
For IE i am using the following code to disable browser back button.
javascript: window.history.forward(1);
Its not working in Firefox browser.
Plz Help.
Dhulipudi
|
|
|
|
|
You're asking in the wrong forum (possibly) the wrong site) for help like that...
And why, oh why, disable the browser back button...if it's to trap people onto your website...hmmm, we can always close the window and never, ever return to your site.
|
|
|
|
|
Hi, I am trying to load a busy cursor in WTL but it is loading for a moment and then reverting back to normal. Anybody has idea about it? Please let me know.
Raj
|
|
|
|
|
You'll need to respond to the WM_SETCURSOR message, calling SetCursor within a handler for that message.
Michael Dunn's article here[^] shows how to respond to WM_SETCURSOR.
|
|
|
|
|
I'm really stupid about the whole programming thing so i was thinking maybe i could get extensive help, from other users. My dilemma is that i have seen a site that teaches it but doesn't give forums or anything else like this site does, so what i need is lessons on learning C++. Please note that i haven't even any type of programming( including: scripting, um...that's all i can think of right now )
So a load of help would be nice
Stargazer989
http://www.runescape.com <<<play it!!<="" div="">
|
|
|
|
|
This is the wrong place for seeking lessons on learning C++. I suggest purchasing a C++ primer or a book like "The C++ Programming Language by Bjarne Stroustrup" that has exercises at the end of each chapter. If you have specific questions about some code you wrote that isn't executing the way you expected to, then present your issue here to obtain assistance.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|