All-In-One Code Framework


 







Dear Friends. Have you ever needed a quick understanding of a technique, e.g. ActiveX or VSX, but been daunted by the few or too many samples and documents that are available on the Internet? Have you ever downloaded or created a good sample, e.g. a named pipe sample for IPC, but forgotten where the sample was placed after a few days? Have you ever wanted a simple test environment, e.g. a COM object or a DLL, but become tired of frequently creating such projects and naming them as “ClassLibrary1”, “ClassLibrary2”, “ClassLibraryABC”?


 


If your answer is YES to any one of these questions, this All-In-One Code Framework will be of assistance to you.

 


We recently created a sample-code project All-In-One Code Framework (codename CodeFx) on CodePlex.


 


All-In-One Code Framework delineates the framework and skeleton of most Microsoft development techniques (e.g. COM, Data Access, IPC) using typical sample codes in different programming languages (e.g. Visual C#, VB.NET, Visual C++). For instance, the code example ATLActiveXDll shows the skeleton of an ATL ActiveX DLL as its name implies. Each example is elaborately selected, composed, and documented to demonstrate one frequently-asked, tested or used scenario based on our experience as support engineers. If you are a software developer, you can fill the skeleton with blood, muscle and soul. If you are a software tester or a support engineer like us, you may extend the sample codes a little to fit your specific test scenario or refer your customer to this project if the customer’s question coincides with what we collected.


 




Project Scope


 


The target of the project is to sketch the skeleton of most Microsoft development techniques using typical sample codes that are frequently-asked, tested or used. You can imagine each technique as a building. The foundation of the building (the basics of the technique) and the facilities inside the building (the details of the technique) are not in the scope. Instead, you fill find the structure of the building (the framework and skeleton of the technique) in the scope.


 


Features


 


All-In-One


 


All examples for all Microsoft development techniques are in one Visual Studio solution. All source codes, documents, and reference materials can be viewed or tested in one instance of Visual Studio.


 


Uniform


 


·      All examples follow a uniform naming convention. The convention applies to the name of the projects, variables, methods, types, etc.  


·      All examples have a uniform style of coding, commenting and documentation. For instance, each code example has a ReadMe.txt file that documents the example. The content of ReadMe.txt follows this structure: Use (the purpose of the example), Project Relation (the relation between the current example and the rest), Build (how to build the example), Creation (the detailed steps to create such an example) and References (the reference materials).


·      All examples of the same technique manage to provide a uniform output or export. For instance, ATLActiveXDll, ATLActiveXExe, CSDllCOMServer, VBDllCOMServer, MFCActiveX, MFCSafeActiveX, CSActiveX, VBActiveX are COM components in different forms. However, they export a uniform set of methods, properties and events.


 


Mutually Dependent


 


The code examples are mutually dependent or related, and many are efficiently reused by other examples to demonstrate the techniques. For instance, CppDllExport is a sample C++ DLL that exports the symbols of data, functions and classes. CppImplicitlyLinkDll depends on CppDllExport to demonstrate the implicit link of a DLL; CppDelayloadDll delay-loads the DLL; CppLoadLibrary dynamically loads the DLL; CSPInvokeDll uses CppDllExport to show the use of .NET Platform Invocation Service.


 


Source of Examples


 


The sample codes are refined out of our supports for developers in the newsgroups and the forums. You can think of the project as a collection of most frequently requested test scenarios in contrast with FAQs.


 


The above four features are highlighted because most sample code sites like www.codeproject.com and MSDN lack them. Besides, the code examples in All-In-One Code Framework are typical, extensible, structured, complete, and easy to understand.


 


Current Stage


 


In the pilot phase of the project, we focus on five techniques: COM, Library, IPC, Office and Data Access. Today is March 8, 2009. There have been 36 code examples in the project. The collection currently grows at a rate of seven examples per week.


 


The following examples are the epitome of CodeFx on 2009-3-1. For an up-to-date list, please refer to All-In-One Code Framework Examples.


 


Examples for COM and ActiveX:


 


COM and ActiveX 


 















































Name


Description


CSDllCOMServer


A COM server written in C#


VBDllCOMServer


A COM server written in VB.NET


ATLActiveXDll


An in-process ATL COM Server


ATLActiveXExe


An out-of-process ATL COM Server


MFCActiveX


A MFC ActiveX Control


MFCSafeActiveX


A MFC ActiveX Control Safe for Scripting and Initialization


CSActiveX


A C# ActiveX Control


VBActiveX


A VB.NET ActiveX Control


CppCOMClient


Use COM servers in a C++ application


CSCOMClient


Host ActiveX controls use COM servers in C#


VBCOMClient


Host ActiveX controls and use COM servers in VB.NET


MFCCOMClient


Host ActiveX controls and use COM servers in MFC


HTMLEmbedActiveX


Host ActiveX controls in HTML


 


Examples for Data Access:


 


Data Access 


 




















Name


Description


CSUseADO


Use ADO in a C# application


CppUseADO


Use ADO in a C++ application


CSUseADONET


Use ADO.NET in a C# application


CppUseADONET


Use ADO.NET in a C++ application


 


Examples for Library:


 


Library


 












































Name


Description


CppDllExport


A C++ dynamic library export symbols


CppImplicitlyLinkDll


C++ implicitly links a DLL


CppDelayloadDll


C++ delay-loads a DLL


CppLoadLibrary


C++ dynamically loads a DLL


CSLoadLibrary


C# dynamically loads a native DLL


CSPInvokeDll


C# P/Invokes a native DLL


CSClassLibrary


A C# Class Library


CppHostCLR


C++ hosts CLR and loads a .NET assembly


CSReflection


C# dynamically loads and uses the types of a .NET assembly


CSEmitAssembly


C# emits an assembly with types in runtime


CppStaticLibrary


A C++ Static Library


CppStaticallyLinkLib


C++ statically links a static library


Examples for IPC and RPC:













































Name


Description


CppNamedPipeServer


A named-pipe server written in C++


CppNamedPipeClient


A named-pipe client written in C++


CSNamedPipeServer


A named-pipe server written in C#


CSNamedPipeClient


A named-pipe client written in C#


CppMailslotServer


A mailslot server written in C++


CppMailslotClient


A mailslot client written in C++


CppFileMappingServer


Create shared memory in C++


CppFileMappingClient


Access shared memory in C++


CSRemotingServer


A .NET Remoting server written in C#


CSRemotingClient


A .NET Remoting client written in C#


VBRemotingServer


A .NET Remoting server written in VB


VBRemotingClient


A .NET Remoting client written in VB


 


Feedback


We look forward to hearing your feedback. Please post your suggestions and ideas in Discussions or contact us directly. Your comments on this project are appreciated. 


 


Thank you!

Comments (2)

  1. Coder24.com says:

    Hi,

    that is a cool project.

    Also I must add: Why not add the security samples here? I mean the architecture.

    Have a nice day…

    Best regards,

    Fisnik