Thursday, December 11, 2014

Error RC2144 : PRIMARY LANGUAGE ID not a number

Fix for “Error RC2144 : PRIMARY LANGUAGE ID not a number”

in visual studio express 2013 , do not have Resources editor,  use the txt editor create a RC file.
include  string table for multiple language support.

Adding #include <windows.h> seems to fix it…for now.

Resources.rc


#include <windows.h>
#include "resource.h"

etc...


/////////////////////////////////////////////////////////////////////////////
// English (United States) resources

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)

LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
STRINGTABLE DISCARDABLE
BEGIN
...
END


#endif    // English (United States) resources


#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
STRINGTABLE DISCARDABLE
BEGIN
.....
END

Friday, December 5, 2014

COM object with Single-threaded apartment threading model.

To implement the (single-threaded) apartment threading model, you must

follow a few rules:

The first thread in the application that gets created is COM's main

thread. This is typically the thread on which WinMain was called. This

must also be the last thread to uninitialize COM.
Each thread in the apartment threading model must have a message loop,

and the message queue must be checked frequently.
When a thread gets a pointer to a COM interface, that pointer may only

be used in that thread.
The single-threaded apartment model is the middle ground between

providing no threading support and full, multi-threading support of the

free threading model. A server committing to the apartment model

promises that the server has serialized access to all of its global data

(such as its object count). This is because different objects may try to

access the global data from different threads. However, the object's

instance data is safe because the methods are always called on the same

thread.
Typically, controls for use in Web browsers use the apartment threading

model because browser applications always initialize their threads as

apartment.