WM_CTLCOLOR Message
The WM_CTLCOLOR message is used in 16-bit versions of Windows to change the color scheme of list boxes, the list boxes of combo boxes, message boxes, button controls, edit controls, static controls, and dialog boxes.
In 32-bit versions of Windows, the WM_CTLCOLOR message has been replaced by more specific notifications. These replacements include the following:
WM_CTLCOLORBTN
WM_CTLCOLOREDIT
WM_CTLCOLORDLG
WM_CTLCOLORLISTBOX
WM_CTLCOLORSCROLLBAR
WM_CTLCOLORSTATIC
Ref:
TN062: Message Reflection for Windows Controls - http://msdn.microsoft.com/en-us/library/eeah46xd(VS.80).aspx
Changing the Background Color of an Edit Control - http://www.codeguru.com/cpp/controls/editctrl/backgroundcolor/article.php/c9047
Create a Hyper Link in MFC - http://www.microsoft.com/msj/1297/c1297.aspx
Sending WM_CTLCOLOR for ListBox - http://www.codeguru.com/forum/showthread.php?t=257363
http://www.tech-archive.net/Archive/VC/microsoft.public.vc.mfc/2004-07/1792.html
http://www.codeproject.com/KB/edit/CReadOnlyEdit.aspx?display=PrintAll&fid=145411&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=1375261
CPropTree v1.0 - Property Tree Control By sramsay - http://69.10.233.10/KB/tree/proptree.aspx
COptionTree By Matthew R. Miller : CPropTree Version 2.0 - http://www.codeproject.com/KB/tree/coptiontree.aspx?fid=3829&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=51
Enhancements of Matthew R. Millers COptionTree (with different Colors) - http://www.codeproject.com/KB/tree/COptionTree2.aspx?display=PrintAll&fid=285234&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=2188385
Search this Blog:
Change MFC Controls Color - WM_CTLCOLOR and CtlColor
OpenSource MFC Property Tree Source Code
OpenSource MFC Property Tree Source Code:
CPropTree v1.0 - Property Tree Control By sramsay - http://69.10.233.10/KB/tree/proptree.aspx
COptionTree By Matthew R. Miller : CPropTree Version 2.0 - http://www.codeproject.com/KB/tree/coptiontree.aspx?fid=3829&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=51
Enhancements of Matthew R. Millers COptionTree (with different Colors) - http://www.codeproject.com/KB/tree/COptionTree2.aspx?display=PrintAll&fid=285234&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=2188385
Kaizen - Continual Improvement
Kaizen - Continual improvement philosophy in Japanese ... a system of continuous improvement in quality, technology, processes, company culture, productivity, safety and leadership.
Kai => change
Zen => good
Ref:
http://en.wikipedia.org/wiki/Kaizen
http://en.wikipedia.org/wiki/Continuous_improvement
http://www.valuebasedmanagement.net/methods_kaizen.html
http://www.graphicproducts.com/tutorials/kaizen/index.php
http://www.leankaizen.com/tag/overview-level/
The rule of thirds, team selection
Here is a quick tip for selecting team members for a kaizen blitz or rapid improvement event.
It's called the rule of thirds. The basic idea behind this rule is to choose team members based on the following split.
1/3 rd of the team should be people who have Day to Day association with the project area.
1/3 rd of the team members should have a Functional association with the project area.
1/3 rd of the team members should not be connected with the project area
Miscellaneous Technical URLs
Miscellaneous URLs
Mac OS X Technology Overview - http://developer.apple.com/DOCUMENTATION/MacOSX/Conceptual/OSX_Technology_Overview/AppTechnology/chapter_5_section_2.html
MFC Document View Architecture - http://www.codeproject.com/KB/docview/DocViewEnhancements.aspx
How to dump Memory in VC++ -
http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/a88b0fad-23b9-4df7-b0cd-c7bbc551f647/
How to: Enable Memory Diagnostics - http://msdn.microsoft.com/en-us/library/e009249y.aspx
A list of frequently-asked questions taken from the C++ forum by Michael Dunn - http://www.codeproject.com/KB/cpp/cppforumfaq.aspx
How to customize Windows (Icons, Shutdown, Logoff, ...) -http://www.neowin.net/forum/index.php?act=ST&f=34&t=44566
Good Infrastructure Software Products/Tools Site - http://www.infrastructures.org/
How the Configuration Management has to work - http://www.usenix.org/publications/library/proceedings/lisa94/rouillard.htmlhttp://www.cs.umb.edu/%7Erouilj/#Config
OpenFileDialog() API Crash in Windows XP SP2
Issue:
A program closes when you move the mouse pointer over the program file in the Open, Save, or Save As dialog box on a Windows XP Service Pack 2-based computer.
Reason:
When Adobe Reader 7.0 is installed on Windows XP (SP2) machine , this problem occurs.
Fix:
This Hotfix is available as part of Windows XP (Sp3) Hotfix(Fix171128) is available at the URL below :
http://support.microsoft.com/hotfix/KBHotfix.aspx?kbnum=909486&kbln=en-us
The above FIX is also part of Windows XP SP3.
Running Binary on Windows Vista - side-by-side configuration is incorrect
The application has failed to start because its side-by-side configuration is incorrect. Please see the application log for more details –
Fix:
EventLog will point you almost exactly the issue.
Most of the times it’s lack/missing of the depend files to run your process.
Example:
MFC8.0 dlls missing in the path to run a VC++ Binary built with MFC8.0( linked with MFC as Shared Dll)
Ref:
http://msdn.microsoft.com/en-us/library/ms235291.aspx
http://social.msdn.microsoft.com/Forums/en-US/windowscompatibility/thread/d9c47905-3d84-4275-b277-9ffe06001f80/
http://www.omgili.com/jmp/aHR0cDovL2ZvcnVtcy5zMmdhbWVzLmNvbS9zaG93dGhyZWFkLnBocD90PTEwMjcwJm1vZGU9bGluZWFy
http://www.vistax64.com/vista-general/157036-application-failed-start-side-side-configuration-incorrect.html
Windows Vista : Kernel by Mark Russinovich
Inside the Windows Vista Kernel by Mark Russinovich
Inside the Windows Vista Kernel: Part 1 -
http://technet.microsoft.com/en-us/magazine/2007.02.vistakernel.aspx
Inside the Windows Vista Kernel: Part 2 -
http://technet.microsoft.com/en-us/magazine/2007.03.vistakernel.aspx
Inside the Windows Vista Kernel: Part 3 -
http://technet.microsoft.com/en-us/magazine/2007.04.vistakernel.aspx
Windows Vista : Snipping Tool - To Capture Screen Shots
Use the Snipping Tool to Capture Screen Shots
We can use Snipping Tool (%SystemRoot%\system32\SnippingTool.exe) to capture a screen shot, or snip, of any object on your screen, and then annotate, save, or share the image. Simply use your mouse (or tablet pen) to capture any of the following types of snips:
Free-form Snip - Draw an irregular line, such as a circle or a triangle, around an object.
Rectangular Snip - Draw a precise line by dragging the cursor around an object to form a rectangle.
Window Snip - Select a window, such as a browser window or dialog box, that you want to capture.
Full-screen Snip - Capture the entire screen when you select this type of snip.
VC++ : Extension Dlls
An MFC extension DLL has the following features and requirements:
1. The client executable must be an MFC application compiled with _AFXDLL defined.
2. An extension DLL can also be used by a regular DLL that is dynamically linked to MFC.
3. Extension DLLs should be compiled with _AFXEXT defined. This forces _AFXDLLto be also defined and ensures that the proper declarations is pulled in from the MFC header files. It also ensures that AFX_EXT_CLASS is defined as __declspec(dllexport)while building the DLL, which is necessary if you are using this macro to declare the classes in your extension DLL.
4. Extension DLLs should not instantiate a class derived from CWinApp, but should rely on the client application (or DLL) to provide this object.
5. Extension DLLs should, however, provide a DllMain function and do any necessary initialization there.
6. Extension DLLs are built using the dynamic-link library version of MFC (also known as the shared version of MFC).Only MFC executables (either applications or regular DLLs) that are built with the shared version of MFC can use an extension DLL. Both the client application and the extension DLL must use the same version of MFCx0.dll. With an extension DLL, you can derive new custom classes from MFC and then offer this extended version of MFC to applications that call your DLL.
Ref:
VC++ Extension Dlls - http://msdn.microsoft.com/en-us/library/h5f7ck28(VS.80).aspx
C++ Function Pointers
Pointers to Member Functions are one of C++'s more rarely used features, and are often not well understood even by experienced developers. This is understandable, as their syntax is necessarily rather clumsy and obscure.
Sample Code in 'C' language
void Foo( int anInt, double aDouble );
void Bar()
{
void (*funcPtr)( int, double ) = &Foo;
(*funcPtr)( 1, 2.0 );
}
Sample Code in 'C++' language
class Foo
{
public:
double One( long inVal );
double Two( long inVal );
};
void main( int argc, char **argv )
{
double (Foo::*funcPtr)( long ) = &Foo::One;
Foo aFoo;
double result =(aFoo.*funcPtr)( 2 );
return 0;
}
Details:
For regular function pointers, it is optional to use the address-of operator & when taking the address of a function, but it is required for taking the address of member functions.
To declare a pointer to member function, you give the prototype of a function it can point to, as before, but the name of this function is replaced by a construction that scopes the pointer - you give it the name of the class whose member functions it can point to, as (ClassName::*pointerName).
Note that a given member function pointer can only point to functions that are members of the class it was declared with. It cannot be applied to an object of a different class even if it has member functions with the same signature.
You dereference a member function pointer by using .* or ->*, supplying a reference or pointer to an object on the left, as appropriate, and the function pointer on the right.
Ref:
http://www.goingware.com/tips/member-pointers.html
http://linuxquality.sunsite.dk/articles/memberpointers/
http://www.geocities.com/varunhostel/TechnicalArticles/PointerArticle/PointerArticle_Intro.html?reload_coolmenus
http://stackoverflow.com/questions/402992/passing-function-pointers-in-c
Java Database Access - JDBC, iBATIS, Hibernate Core, OpenJPA and PureQuery
Java Database Access API
• JDBC is good for applications in which the queries are dynamic and you need programmatic control of various tuning features to maximize performance. However, as the coding examples show, JDBC is relatively complex to use because you have to code the persistence logic yourself.
• iBATIS does a great job of insulating your object programmers from the details of JDBC and SQL by providing some ORM functions and keeping the SQL in a separate config file—especially applications that are based heavily on Stored Procedures or well-architected SQL from a DBA. However, if you prefer not to explicitly code SQL or if your domain objects have a complex life cycle, then iBATIS is not likely the best choice for you.
• Hibernate Core has a much more advanced ORM layer and has served as the basis for the new JPA standard; however, developers should begin to use the Hibernate JPA APIs if standards are important. Also, if you are using the JBoss Application Server, using Hibernate Core is a natural choice.
• OpenJPA, like Hibernate, has an excellent ORM layer that lets your Java programmers think in object terms. It has the additional advantage of being based on an industry standard and the capability to annotate the code and forgo the need for a mapping XML. ISVs may find the Apache license a better option for shipping software solutions based on OpenJPA. In addition, if you are using the WebSphere Application Server or WebLogic Server, using the OpenJPA-based runtime shipped with their container makes the most sense.
• pureQuery enables relational queries to be embedded in the Java code itself; however, it is relatively new as of publication and may undergo a number of changes that could impact code you write today. That said, it can have major advantages from a performance and tracing standpoint, especially if using DB2. Furthermore, pureQuery can be used in other types of environments, such as Web 2.0-based environments. Like iBATIS, applications that are based heavily on stored procedures or SQL written by a separate role such as a DBA should consider pureQuery as well. It is also worth noting that another persistence mechanism, such as the Groovy API's in Project Zero, may choose to implement on top of the pureQuery engine to exploit the performance and management features.
Some architects will not be willing to make the trade-offs associated with each of these mechanisms and will instead use this knowledge as an excuse to invent their own persistence framework exactly tailored to their requirements. Although inventing your own persistence layer can be fun, especially for architects with a strong computing science background, we advise against doing so because it puts your programmers in the middleware business instead of developing mission-critical enterprise applications.
Build 64bit binaries on 32bit OS - VS2005
To copy Win32 project settings into a 64-bit project configuration - VS2005
When the New Solution Platform dialog box is open while you set up your project to target a 64-bit platform, click the Copy settings from drop-down arrow, and then select Win32. The following project settings are automatically updated on the project level:
1. /MACHINE (Specify Target Platform) is set to /MACHINE:IA64 or /MACHINE:X64.
2. Register Output is turned OFF. For more information, see Linker Property Pages.
3. Target Environment is set to /env x64 or /env ia64. For more information, see MIDL Property Pages: General.
4. Validate Parameters is cleared and reset to the default value. For more information, see MIDL Property Pages: Advanced.
5. If Debug Information Format was set to /ZI in the Win32 project configuration, then it is set to /Zi in the 64-bit project configuration. For more information, see /Z7, /Zi, /ZI (Debug Information Format).
6. Values of WIN32 are replaced by WIN64 for /D (Preprocessor Definitions).
Ref:
How to: Configure Visual C++ Projects to Target 64-Bit Platforms - http://msdn.microsoft.com/en-us/library/9yb4317s(vs.80).aspx
Introduction to Software Architecture
Software Architecture:
Software architecture is a description of a software system in terms of its major components, their relationships, and the information that passes among them. In essence, architecture is a plan for building systems that meet well-defined requirements and, by extension, systems that possess the characteristics needed to meet those requirements now and in the future.
A fundamental purpose of software architecture is to help manage the complexity of software systems and the modifications that systems inevitably undergo in response to external changes in the business, organizational, and technical environments.
We like to describe architecture as having to answer three main questions:
1. What are the important concepts?
2. What are the relationships among them? How do these relationships describe the behavior of the system?
3. How do the concepts and relationships provide value higher up? How do they serve the purpose of the overall system rather than the purpose of the individual parts?
An architectural style is a family of architectures related by common principles and attributes. In other words, an architectural style contains a well-defined set of patterns that constitute a common way for enterprise solution components to interact with one another. For example, we consider client/server, 3-tier, n-tier, and enterprise application integration (EAI) approaches all to be architectural styles.
There is a saying in the industry that "any problem in computer science can be solved by adding a layer of abstraction." An abstraction layer provides indirection between two layers, allowing for increased flexibility. Typically, the abstraction also provides a higher level of interaction. For example, rather than writing directly to a database, you write SQL, which provides a higher-level interaction model, as well as an abstraction and indirection layer above the lower-level database interfaces. The abstraction provides higher productivity (in the sense that one SQL statement corresponds to many invocations of the lower-level database interfaces) and also supports multiple different datastores.
Software Architecture = {Elements, Form, Rationale}
Elements
– Processing Elements are components that supply transformation on Data Elements
– Data Elements are components that contain information that is used or transformed
– Connecting Elements are the glue that hold different pieces of architecture together
Form
– Properties: Constraints on the elements to the degree desired by the architecture
– Relationships: Constraints on how the different elements will interact and how they are organized with each other
– Weight: Importance of the property or the relationship and the alternatives
Rationale
– Underlying basis for various choices made in defining the architecture
– Explains the satisfaction of basic functional aspect to nonfunctional Requirements
Example
A complier that is organized sequentially
The Multi-phase Architectural Style
– Elements
• Processing: Lexer, Parser, Semantor, Optimizer, Code Generator
• Data: Characters, Tokens, Phrases, Correlated Phrases, Annotated Correlated Phrases, Object Code
– Form
• Property: Optimizer and Annotated Phrases must be found together
• Weight: Optimizer and Annotated Phrases are preferred elements not necessary
• Relationship: Linear relationship between Character & Token, Token & Phrase. But non-linear between Phrase and Correlated Phrases
Ref:
Microsoft(msdn) Architecture Journal -
http://msdn.microsoft.com/en-us/bb410935.aspx
http://msdn.microsoft.com/en-us/library/aa286494.aspx
A practical guide to Enterprise Architecture(Google Book) -
The Open Group Architecture Framework (TOGAF) -
http://www.opengroup.org/architecture/
http://www.opengroup.org/architecture/togaf8-doc/arch/
Zachman Framework - http://www.zifa.com/framework.pdf
4+1 Architecture -
http://www.cs.ubc.ca/~gregor/teaching/papers/4+1view-architecture.pdf
Udi Dahan Blog on SOA - http://www.udidahan.com/?blog=true
http://www.computer.org/portal/cms_docs_software/software/content/promo/promo1.pdf
http://msdn.microsoft.com/en-us/library/aa973811.aspx
Foundation for the Study of Software Architecture -
.NET Tools
.NET Tools
Ildasm.exe
MSIL Disassembler (Ildasm.exe) is included with the .NET Framework SDK. The Ildasm.exe parses any .NET Framework .exe or .dll assembly, and shows the information in human-readable format. Ildasm.exe shows more than just the Microsoft intermediate language (MSIL) code — it also displays namespaces and types, including their interfaces. You can use Ildasm.exe to examine native .NET Framework assemblies, such as Mscorlib.dll, as well as .NET Framework assemblies provided by others or created yourself. Most .NET Framework developers will find Ildasm.exe indispensable.
Assembly Binding Log Viewer (Fuslogvw.exe)
The Assembly Binding Log Viewer displays details for failed assembly binds. This information helps you diagnose why the .NET Framework cannot locate an assembly at run time. These failures are usually the result of an assembly deployed to the wrong location or a mismatch in version numbers or cultures. The common language runtime's failure to locate an assembly typically shows up as a TypeLoadException in your application.
Assembly Linker (Al.exe)
The Assembly Linker generates a file with an assembly manifest from one or more files that are either modules or resource files. A module is a Microsoft intermediate language (MSIL) file that does not have an assembly manifest.
File Signing Tool (Signcode.exe)
The File Signing tool signs a portable executable (PE) file (.dll or .exe file) with an Authenticode digital signature. You can sign either an assembly or an individual file contained in a multifile assembly. If you are distributing an assembly, you should sign the assembly rather than the individual files. Running Signcode.exe without specifying any options launches a wizard that helps with signing.
The File Signing Tool only ships with the .NET Framework SDK version 1.0 and 1.1. In later versions, use the Sign Tool (SignTool.exe) utility instead.
FxCop
FxCop is an application that analyzes managed code assemblies (code that targets the .NET Framework common language runtime) and reports information about the assemblies, such as possible design, localization, performance, and security improvements. Many of the issues concern violations of the programming and design rules set forth in the Design Guidelines for Class Library Developers, which are the Microsoft guidelines for writing robust and easily maintainable code by using the .NET Framework.
FxCop is intended for class library developers. However, anyone creating applications that should comply with the .NET Framework best practices will benefit. FxCop is also useful as an educational tool for people who are new to the .NET Framework or who are unfamiliar with the .NET Framework Design Guidelines.
FxCop is designed to be fully integrated into the software development cycle and is distributed as both a fully featured application that has a graphical user interface (FxCop.exe) for interactive work, and a command-line tool (FxCopCmd.exe) suited for use as part of automated build processes or integrated with Microsoft Visual Studio® .NET as an external tool.
UI Spy (UISpy.exe)
The UI Spy tool enables developers and testers to view and interact with the user interface (UI) elements of an application. By viewing the application's UI hierarchical structure, property values, and raised events, developers and testers can verify that the UI they are creating is programmatically accessible to assistive technology devices such as screen readers.
UI Spy uses the UI Automation libraries. UI Automation is the new accessibility framework for Microsoft Windows.
Using UI Spy, developers and testers can check an application's level of accessibility by verifying the following:
• UI Automation property values for UI items.
• Control pattern implementation.
• UI Automation event information.
• Navigation and keyboard focus.
Ref:
.NET 3.5 Tools - http://msdn.microsoft.com/en-us/library/bb400851.aspx
.NET 3.0 Tools - http://msdn.microsoft.com/en-us/library/aa388630(vs.85).aspx
.NET 2x Tools - http://msdn.microsoft.com/en-us/library/d9kh6s92(VS.80).aspx
.NET 1x Tools - http://msdn.microsoft.com/en-us/library/d9kh6s92(VS.71).aspx
FxCop - http://msdn.microsoft.com/en-us/library/bb429476(VS.80).aspx
UI Spy - http://msdn.microsoft.com/en-us/library/ms727247(VS.85).aspx
Production Debugging for .NET Framework Applications - http://msdn.microsoft.com/en-us/library/ms954594.aspx
AzMan - Windows Authorization Manager
AzMan is a role-based access control (RBAC) framework that provides an administrative tool to manage authorization policy and a runtime that allows applications to perform access checks against that policy. The AzMan administration tool (AzMan.msc) is supplied as a Microsoft Management Console (MMC) snap-in.
Ref:
http://msdn.microsoft.com/en-us/library/bb897401.aspx