掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
Editコントロールについて (ID:65308)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
とりあえず、開発環境は明記しましょう。 (OS,VC(またはVS)のバージョン等) >GetDlgItemText(hDlg,IDC_EDIT4,x,(int)sizeof(x)-1); GetDlgItemText関数の第3引数は終端文字を含めた文字数ですので、-1しなくてもいいです。 [MSDN] http://msdn2.microsoft.com/en-us/library/ms645489.aspx より >nMaxCount >[in] Specifies the maximum length, in TCHARs, of the string to be copied to the buffer pointed to by lpString. >If the length of the string, including the NULL character, exceeds the limit, the string is truncated. ※日本語訳ではNULLcharacterについて触れていないようだったので英語にした。 # GetWindowTextとかでは明に書いてあるんですけど。 (GetDlgItemTextはTCHAR用の関数なので、正しくは TCHAR x[5]; GetDlgItemText(hDlg, IDC_EDIT4, x, sizeof(x) / sizeof(x[0])); kaisi[0] = _ttoi(x); とすべき。) もとからint型の値をとるのであれば GetDlgItemInt http://msdn.microsoft.com/library/ja/default.asp?url=/library/ja/jpwinui/html/_win32_getdlgitemtext.asp でよいのでは?
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.