Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

How can my WPF application (w/ MVVM, Prism) interact with a monolithic MFC application? -


i'm developing wpf front end (using mvvm , prism) existing mfc application. application not going changed monolithic , lacks documentation of kind. there technologies can either bring these 2 platforms same memory space (best option) or allow them communicate in synchronously (as mfc application no means thread safe)? maintain stability, need wpf executable. i've tried attaching dll mfc application, results in extreme instability.

one option have directly host mfc in wpf, or embed wpf in mfc app outlined on wpf , win32 interoperation msdn article. specifically, check out 2 walkthroughs mentioned @ top of article.

i found embedding wpf in mfc code simpler rehosting mfc application in wpf.

hosting wpf in mfc matter of correctly using hwndsource class (if you're unafraid of using managed c++ can create nice interop layer , avoid /clr flag in mfc project altogether.)

hosting mfc application within wpf application trickier if trying rehost mdi application, allows host individual frames anywhere in wpf code (using prism regions, example.) in case, ended stripping away mdi frame management code manually.

to created own cmultidoctemplate-derived class , override opendocumentfile() virtual method provide own frame-opening behaviour. method manually created special cmdichildwnd-derived frame had created overrode method interacted mdi parent frame window, , passed them underlying cframewnd (bypassing cmdichildwnd).

first, helper function object creates frame (m_pframeclass special cmdichildwnd-derived class described above)

hwnd createhostedframe(hwnd parent)

cframewnd* pframe = (cframewnd*)m_pframeclass->createobject();  cwnd parentwnd; parentwnd.attach(parent); pframe->loadframe(resourceid, ws_child, &parentwnd, pcontext); parentwnd.detach();  return pframe->m_hwnd; 

then overridden doctemplate method (or wherever create frames)

chostedmultidoctemplate::opendocumentfile:

cdocument* pdocument = createnewdocument();  // following demo purposes.  use own mechanism m_mywpfshellorsomething->pleasecreateahostedwindowusing(&createhostedframe);  initialupdateframe(pframe, pdocument, bmakevisible);  return pdocument; 

your cmdichildwnd-derived class want override refers mdi parent frame (search mfc cmdichildwnd source mdiparent() or something.)

of course final step updating cmyapp::oninitinstance() method use specialised multidoc template , child frame instead of other ones.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -