忍者ブログ
NINJA
[1] [2]
×

[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。

LPSTRをCStringに変換する。

void xxxxx::LpstrToString(LPSTR lpsz, CString& str)
{
    str.Format( _T("%s"), lpsz );
}

PR
10進数を16進数に変換する。

CString xxxxxx::DecToHex( DWORD dwNum )
{
    CString str;

    str.Format( _T("%x"), dwNum );

    return str;
}

文字列を10進数の浮動小数点へ変換する。

double CUtils::StringToDexDouble(CString str)
{
    double dex = 0;
    _stscanf( str, _T("%lf"), &dex );
    return dex;
}

文字列を10進数へ変換する。


int xxxxxx::StringToDex(CString str)
{
    int dex = 0;

    CStringW strw = str;
    _stscanf( strw, _T("%d"), &dex );

    return dex;
}

char型をマルチバイト文字列に変換する。


HRESULT Cxxxx::DXconvAnsiToWide( WCHAR* wstrDest, const CHAR* strSrc, int ct )
{
    // 引数の*がNULLの場合と、文字数が1以下の場合はエラー
    if( wstrDest==NULL || strSrc==NULL || ct < 1 )
        return E_INVALIDARG;

    int nResult = MultiByteToWideChar( CP_ACP, 0, strSrc, -1, wstrDest, ct );
    wstrDest[ct-1] = 0;
   
    if( nResult == 0 )
        return E_FAIL;
    return S_OK;

}

カレンダー
04 2025/05 06
S M T W T F S
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
フリーエリア
最新CM
最新TB
プロフィール
HN:
No Name Ninja
性別:
非公開
バーコード
ブログ内検索
アーカイブ
P R
Powered by ニンジャブログ  Designed by ゆきぱんだ
Copyright (c) Visual Studio C++のお勉強 All Rights Reserved
忍者ブログ / [PR]