|
Stuart Dootson wrote: What do you mean by serialization?
save/load the object
It seems that I should learn Boost first.
system
|
|
|
|
|
followait wrote: save/load the object
Yeah, there's no standard way of doing that, really. Either you use some framework such as the one in MFC, or the one in Boost, or you have to work out how you're going to it yourself.
If only it were as easy as in (say) .NET or Python, where serialization is a standard concept.
|
|
|
|
|
Hi everyone:
I have this Single Document Interface MFC project that has quite a lot of code in it (mostly View/Doc interaction and lots of CString usage). Now I came to a realization that I have to convert it into Multiple Document Interface project. By doing so I will need a tab control for the documents, docking bars for side controls, splitter windows, etc. My original thought was to develop all the GUI myself, but then I came across the WTL 8.0. I played around with some of their samples and it sounds very promising.
My question is, or maybe I should better say, what would you suggest - shall I try to switch this SDI MFC project into an MDI WTL 8.0 (I believe it now supports MDI as well), or shall I tough it out and stick with good-ol' MFC (and poor GUI)?
Thanks in advance!
|
|
|
|
|
I haven't tried with VC 8 or later, but in 6 you can certainly use MFC and WTL in the same app. You'll need to tweak the WTL headers a bit and change a couple references to "CDC" to "CDCT<1>" but I think that's the only error you'll hit. I haven't actually tried MFC and WTL together in a while, those problems might have been fixed in a newer VC or WTL.
|
|
|
|
|
Hi
I Create a ATL Modelless Dialog Box and Host Webpage on Dialog Box using CAxWindow , I want that tab and Accelerators work on Webpage , But delete Key , Tab Key , Enter Key ...
Keys are not working properly , I use code from CodeProject Site.
http://www.codeproject.com/KB/atl/cdialogmessagehook.aspx
But this code is not working for me , in InstallHook I gave my DialogBox Handle .
Thanks in Advance.
|
|
|
|
|
I'm using ATL and c++ to develop an Add-in for Microsoft Word. The problem
that I'm having is that the parameters for the events that I'm trying to
capture aren't being filled with data. They're essentially null. The
problem is only happening with events that pass back more than one parameter.
The events that I am trapping are DocumentOpen, NewDocument,
DocumentBeforePrint, and DocumentBeforeSave
DocumentOpen, and NewDocument event trapping work fine.
The dispinterface is ApplicationEvents2; I've also tried using
ApplicationEvents3, and ApplicationEvents4 with the same results.
/***********************************************
* IDL for DocumentOpen, NewDocument and DocumentBeforePrint
* and DocumentBeforeSave
************************************************/
[id(0x00000004), helpcontext(0x00061a84)]
void DocumentOpen([in] Document* Doc);
[id(0x00000009), helpcontext(0x00061a88)]
void NewDocument([in] Document* Doc);
[id(0x00000007), helpcontext(0x00061a86)]
void DocumentBeforePrint(
[in] Document* Doc,
[in] VARIANT_BOOL* Cancel);
[id(0x00000008), helpcontext(0x00061a87)]
void DocumentBeforeSave(
[in] Document* Doc,
[in] VARIANT_BOOL* SaveAsUI,
[in] VARIANT_BOOL* Cancel);
/**********************************************
* Here is the SINK_MAP
***********************************************/
BEGIN_SINK_MAP(MyAddin)
SINK_ENTRY_INFO(1,__uuidof
(Word::ApplicationEvents2),4,DocumentOpen,&DocumentOpenInfo)
SINK_ENTRY_INFO(1,__uuidof(Word::ApplicationEvents2),9,NewDocument,&NewDocumentInfo)
SINK_ENTRY_INFO(1,__uuidof(Word::ApplicationEvents2),7,DocumentBeforePrint,&DocumentBeforePrintInfo)
SINK_ENTRY_INFO(1,__uuidof(Word::ApplicationEvents2),8,DocumentBeforeSave,&DocumentBeforeSaveInfo)
END_SINK_MAP()
/******************************************************
* Here are the ATL_FUNC_INFO structures I've declared
*******************************************************/
_ATL_FUNC_INFO NewDocumentInfo = {CC_STDCALL,VT_EMPTY,1,
{VT_DISPATCH|VT_BYREF}};
_ATL_FUNC_INFO DocumentBeforePrintInfo = {CC_STDCALL,VT_EMPTY,2,
{VT_DISPATCH|VT_BYREF, VT_BOOL|VT_BYREF}};
_ATL_FUNC_INFO DocumentOpenInfo = {CC_STDCALL,VT_EMPTY,1,
VT_DISPATCH|VT_BYREF}};
_ATL_FUNC_INFO DocumentBeforeSaveInfo = {CC_STDCALL,VT_EMPTY,3,
{VT_DISPATCH|VT_BYREF, VT_BOOL|VT_BYREF, VT_BOOL|VT_BYREF}};
void __stdcall MyAddin::DocumentOpen(IDispatchPtr ptr)
{
//Process DocumentOpen Event
}
void __stdcall MyAddin::NewDocument(IDispatchPtr ptr)
{
//Process NewDocument Event
}
void __stdcall MyAddin::DocumentBeforePrint(IDispatchPtr ptr, VARIANT_BOOL*
pvtCancel )
{
//The __vfPtr in ptr comes back as 0x00000000. I don't know why
}
void __stdcall MyAddin::DocumentBeforeSave(IDispatchPtr ptr, VARIANT_BOOL*
pSaveAsUI, VARIANT_BOOL* pCancel )
{
//The __vfPtr in ptr comes back as 0x00000000. I don't know why
}
|
|
|
|
|
I've just tried this with a modified version of Microsoft's 'ATLEventHandling' sample (which happily uses Word::ApplicationEvents too). I think you'll find that replacing the IDispatchPtr with IDispatch* will solve your problem. A COM interface will always pass a raw pointer, not a managed one - managed COM interface pointers are purely VC++ (_ptr_t ) and ATL (CComPtr ) inventions.
Anyway - the code I used was:
void __stdcall DocumentBeforePrint(IDispatch* doc, VARIANT_BOOL* pvtCancel )
{
*pvtCancel = VARIANT_TRUE;
Word::_DocumentPtr pDoc(doc);
CComBSTR bstrName;
if (pDoc)
pDoc->get_Name(&bstrName);
}
This cancelled print operations and retrieved the document name successfully.
HTH.
|
|
|
|
|
Your suggestion did not work for me.
I am using VC6 on Windows XP sp3 using Word 2003.
I'm willing to bet when you step through your code if you check the value for doc->IUnknown->__vfptr has a value other than 0x00000000 in it. Mine comes up with 0x00000000 and of course once I get to
Word::_DocumentPtr pDoc( doc );
I get the dreaded and tiresome 0xC0000005 access violation error.
Any other thoughts on this?
|
|
|
|
|
The only thing I can suggest is going to something that has been demonstrated to work (i.e. the Microsoft ATLEventHandling sample that I used - I modified the CNotSoSimple class in that to have the DeomentBeforePrint method). Try that. If that doesn't work, there's clearly something not right with the setup on your machine.
BTW - I was using VS2008 + Word 2007.
|
|
|
|
|
The platform was the trick. I switched to vs2005 and the program ran as expected. Thanks for the input.
|
|
|
|
|
I've created a CSplitterWindow that works perfectly except when resized. My Code[^] I use SetWindowPos to move the splitter as my "view" is resized, while sizing there is alot of flicker. How does the CSplitterWindow update it's panes when the splitter is moved so smoothly? Any suggestions would be greatly appreciated.
Thanks,
Nathan
|
|
|
|
|
Nathan Going wrote: How does the CSplitterWindow update it's panes
Not sure what you mean. Everything in windows get's painted more or less the same way, in response to a WM_PAINT message.
Perhaps you can rephrase your question for clarity?
led mike
|
|
|
|
|
Ok, start with the CSplitterWindow, if you move the splitter bar left or right, both panes are resized smoothly using a set of calls to SetWindowPos internally. Now I have the CSplitterWindow created as a child of another CWindow derived "View". I catch the WM_SIZE event and call SetWindowPos to set the new size of the CSplitterWindow, when this happens it appears that the entire window gets redrawn, producing a "flicker" effect. In my "view" window, I catch the WM_ERASEBKGND message so it doesn’t happen; also I handle WM_PAINT so I can draw a margin around the CSplitterWindow. I'm trying to find a way to resize the entire window and at the same time reduce the flickering of the contents as much as possible.
Thank you.
|
|
|
|
|
Hi Nathan,
Replace DECLARE_WND_CLASS(xx) in your frame and intermediate windows by DECLARE_WND_CLASS_EX(xx, 0, -1);
BTW your layout is much too complicated. Just paint what you want in your frame window and override the default CFrameWindowImplBase::UpdateLayout() to compute the position of your client window.
cheers,
AR
|
|
|
|
|
When I work for ATL composite project, I inserted ActiveX on the Dialog resource page.
But I can't asign the variable to any control on dialogue. When I use "Add Variable", the wizard doesn't to be enabled the "control variable" check box. So I don't know how to control them by programming from related .cpp file or .h file.
Please suggest me how to handle these controls(especially Activex) by programming.
|
|
|
|
|
I used WTL for windows apps, and ATL for COM, but now need to create a windows application with ATL/WTL that can connect to web service, and probably even more.
I also have a thorough knowledge of web services, remoting and WCF under .Net.
Now how do I merge these two, i.e. where do I find wrapper classes or examples for this kind of communication?
Thank you.
|
|
|
|
|
Dunno that MS do anything for non-.NET C++. This[^] might help though, especially this[^], if WS-* floats your boat. If you're more a fan of REST-ful web services, just use libcurl[^] and a parser for whatever format the payload's in. I've been using libcurl to write a specialized HTTP client in Haskell[^] - it's made the job very easy.
|
|
|
|
|
Thanks, I will look into this.
|
|
|
|
|
You might want to look at this[^]. See the description for the sproxy.exe tool
led mike
|
|
|
|
|
Thanks a lot, I will give it i try.
|
|
|
|
|
That's cool - I never realised ATL Server had client side stuff like that as well. I'll have to remember that if I'm ever stuck doing SOAPy web services clients.
|
|
|
|
|
int i,j;ifstream infile(L"data.txt")infile>>i>>j;
string a,b;infile>>a>>b;
Any STL way to do this?
system
|
|
|
|
|
Presuming you want a to contain "aa" and b to contain "bb" , the code you've posted does precisely that with gcc (precisely, g++ 4.0.1 on OS X Leopard).
To provide you with any help beyond that (which isn't much help), it would help if you stated:
- What compiler you're using
- What you expect the code to do
- What actually DOES happen
|
|
|
|
|
I use VC9, and want to do just as you said, but it throws an excetpion.
system
|
|
|
|
|
followait wrote: I use VC9, and want to do just as you said, but it throws an excetpion.
OK....now, WHAT exception is it throwing?
It'll be derived from std::exception , so try something like:
<code></code>try {
std::string a, b;
infile>>a>>b;
}
catch(std::exception&e)
{
std::cerr << e.what() << std::endl;
}
This will print out the exception message, which should give some pointers.
|
|
|
|
|