TOP C++ API WDK .NET MSIL Win32API COM MFC
ASSERT VERIFY
missing
- dirent.h
pragma
#pragma comment(lib, "winmm.lib")
attribute
日本語ソースファイル
SJIS もしくは UTF-8ならBOMBつき
- VARIANT 構造体は多数のデータ型タイプをまとめて入れるコンテナ
- VARIANT 構造体に情報を受け取ると、vt メンバをチェックして、どのメンバに妥当な値が入っているかを調べる。
- VARIANT 構造体を使用して情報を送信するには、情報を含むメンバを常にまとめた形にして vt を設定。
- 構造体を使用する前に、VariantInit という COM 関数を呼び出して構造体を初期化。
- 構造体の利用が終わると、内容を消去してから VariantClear の呼び出しで VARIANT を含むメモリを解放
| vt 値 | 対応する値のメンバ名 |
| VT_I4 | lVal |
| VT_DISPATCH | pdispVal |
| VT_BSTR | bstrVal |
| VT_EMPTY | なし |
_variant_t Class
_variant_t Class
A _variant_t object encapsulates the VARIANT data type. The class manages resource allocation and deallocation and makes function calls to VariantInit and VariantClear as appropriate.
extractor
A _variant_t object encapsulates the VARIANT data type. The class manages resource allocation and deallocation and makes function calls to VariantInit and VariantClear as appropriate.
| Construction | |
| _variant_t | Constructs a _variant_t object. |
| Operations | |
| Attach | Attaches a VARIANT object into the _variant_t object. |
| Clear | Clears the encapsulated VARIANT object. |
| ChangeType | Changes the type of the _variant_t object to the indicated VARTYPE. |
| Detach | Detaches the encapsulated VARIANT object from this _variant_t object. |
| SetString | Assigns a string to this _variant_t object. |
| Operators | |
| Operator = | Assigns a new value to an existing _variant_t object. |
| operator ==, != | Compare two _variant_t objects for equality or inequality. |
| Extractors | Extract data from the encapsulated VARIANT object. |
operator short( ) const; operator long( ) const; operator float( ) const; operator double( ) const; operator CY( ) const; operator _bstr_t( ) const; operator IDispatch*( ) const; operator bool( ) const; operator IUnknown*( ) const; operator DECIMAL( ) const; operator BYTE( ) const; operator VARIANT() const throw(); operator char() const; operator unsigned short() const; operator unsigned long() const; operator int() const; operator unsigned int() const; operator __int64() const; operator unsigned __int64() const;
_bstr_t Class
_bstr_t Class
- comutil.h
- comsuppw.lib or comsuppwd.lib
| Construction | |
| _bstr_t | Constructs a _bstr_t object. |
| Operations | |
| Assign | Copies a BSTR into the BSTR wrapped by a _bstr_t. |
| Attach | Links a _bstr_t wrapper to a BSTR. |
| copy | Constructs a copy of the encapsulated BSTR. |
| Detach | Returns the BSTR wrapped by a _bstr_t and detaches the BSTR from the _bstr_t. |
| GetAddress | Points to the BSTR wrapped by a _bstr_t. |
| GetBSTR | Points to the beginning of the BSTR wrapped by the _bstr_t. |
| length | Returns the number of characters in the _bstr_t. |
| Operators | |
| operator = | Assigns a new value to an existing _bstr_t object. |
| operator += | Appends characters to the end of the _bstr_t object. |
| operator + | Concatenates two strings. |
| operator ! | Checks if the encapsulated BSTR is a NULL string. |
| operator ==, !=, <, >, <=, >= | Compares two _bstr_t objects. |
| operator wchar_t* char* | Extract the pointers to the encapsulated Unicode or multibyte BSTR object. |
さまざまな文字列型間で変換する
ICON
_strlwr_s
char buf[]="abc.efg";
char * p = strrchr(buf,'.');
if(p!=NULL){
_strlwr_s(p,strlen(p)+1) ; // 1 is needed
if(strcmp(p,"efg")==0){
} else {
}
}
char * p = strrchr(buf,'.');
if(p!=NULL){
_strlwr_s(p,strlen(p)+1) ; // 1 is needed
if(strcmp(p,"efg")==0){
} else {
}
}
stdinをバイナリ・モードに切り替え
#include <io.h> // _setmode()
#include <fcntl.h> // _BINARY
if( _setmode ( _fileno ( stdin ), O_BINARY ) == -1 )
perror ( "Cannot set stdin to binary mode" );
else
printf ( "stdin mode successfully set to binary\n" );
managed/unmanaged mix
C++ Interop (暗黙の PInvoke) の使用
混在アセンブリのためのライブラリ サポート
アンマネージ DLL 関数の処理
いままたC++が熱い!「C++/CLI」として大進化したVisual C++ 2005
Performance Considerations for Interop (C++)
Pure and Verifiable Code
混在アセンブリのためのライブラリ サポート
アンマネージ DLL 関数の処理
いままたC++が熱い!「C++/CLI」として大進化したVisual C++ 2005
Performance Considerations for Interop (C++)
Pure and Verifiable Code
| opt | manage func |
unmanage func |
manage data |
unmanage data |
interop with native DLLs~through P/Invoke |
C++ Interop feature |
export function callable from native function |
CRT support |
desc | ||
| C++ Interop | Mixed | /clr | yes | yes | yes | yes | yes | yes | yes | yes | making it possible for them to use .NET features, but still contain unmanaged code. |
| Pure | /clr:pure | yes | no | yes | yes | yes | no | no | yes | ||
| Verifiable | /clr:safe | yes | no | yes | no | yes but ... |
no | no | no | The /clr:safe compiler option generates verifiable assemblies |


最新コメント