2025年5月
 123
45678910
11121314151617
18192021222324
25262728293031

カテゴリー

アーカイブ

ブログ統計情報

  • 113,761 アクセス


CListCtrl の列数の取得

CListCtrl の列数の取得

  int		colCount = 0 ;
  // C:\Program Files\Microsoft Visual Studio\VC98\MFC\SRC\WinCtrl6.cpp
  // CListCtrl::GetColumnOrderArray より
  {
    CHeaderCtrl*	pCtrl = ctrl->GetHeaderCtrl() ;
    if (pCtrl != NULL)	{	colCount = pCtrl->GetItemCount() ;	}
    }

CListCtrl::GetItemCount では行数
CListCtrl レポート形式

Is this 投稿 useful? Useful Useless 1 of 1 people say this 投稿 is useful.

smtp 587 TLS

au の基本メールアドレスを取って,手動で設定.
受信はできるが,送信でエラー.
http://www.auone-net.jp/support/various_set/mail/win/ol10/02.html
ここの step 10
  送信サーバー(SMTP)(O)       587
  使用する暗号化接続の種類(C)   TLS
これらの設定が足りなかった.

OE 6 では
  このサーバーは…接続(SSL)が必要(Q)  チェックします
  送信メール(SMTP)(O)            465


2012/11/12 追記
SMTP認証 oe 6

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

ビルドエラー fatal error C1060

VC 8 でのビルドでエラー
c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxtempl.h(674) : fatal error C1060: ヒープの領域を使い果たしました。
c:\program files\microsoft visual studio 8\vc\atlmfc\include\afxtempl.h(675): クラス テンプレート のメンバ関数 ‘void CArray::AssertValid(void) const’ のコンパイル中
with
[
TYPE=Circle,
ARG_TYPE=Circle
]
\\dp340xpp\d_drive\develop\circary.hxx(79) : コンパイルされたクラスの テンプレート のインスタンス化 ‘CArray’ の参照を確認してください
with
[
TYPE=Circle,
ARG_TYPE=Circle
]

エラーメッセージの通り,不要な AP を終了することにより対応.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

タスクバー内のアイコンが…

タスクバー内のアイコンが見えなくなった.


「休止状態」にして,復帰で,通常の表示に戻った.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

CArray&saAry

CStringArray の配列を使用する時の制限?

c:\program files\microsoft visual studio\vc98\mfc\include\afxtempl.h(86) : error C2582: ‘operator ” 関数は ” 内では使用できません。
c:\program files\microsoft visual studio\vc98\mfc\include\afxtempl.h(406) : コンパイルされたクラスのテンプレートのインスタンス化 ‘void __stdcall CopyElements(class CStringArray *,const class CStringArray *,int)’ の参照を確認してください
  以下の様なコードでコメントにした Copy があると,エラーとなる.
  {
    CArray<CStringArray,CStringArray> saAry ;
    CArray<CStringArray,CStringArray> saA ;
  // saAry.Copy(saA) ;
    }

他にもいろいろとエラーになったが,うまく抜き出せなかった.
関数などの引数として与える時に,最初 const としていたためか?
const を外して,それなりにコードを書けば通るようになったみたい.
これらを利用して書いたコードは,ListBD_C.hxx

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

BL190HW

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

CSV 関係へのリンク

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

オフラインファイルのタイムスタンプ

サーバがオフラインの時に,サーバ上のファイルを WinFile.exe で移動
 この時,更新日時が,移動(実際は同期)した日時に変更されてしまう?
 クライアント,サーバ共に Win XP SP3.

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

コンピュータ名を隠す

エクスプローラなどのネットワーク表示で,コンピュータ名を隠す
 ドメイン一覧にコンピュータが表示されないようにする
 net config server コマンド
 net config server /hidden:yes

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

CHttpFile を利用した読込みで,…

CHttpFile を利用した読込みで,接続されていなくても ReadString でそれなりに戻ってくることがあった?

以下は,あるサイトが応答しているかどうかを確認するコードの断片.
  #define W_M_P_C_ _T(“http://www.??????.com/”)
  CString rData ;
  if (!canConnectWeb && InetFile::Read(W_M_P_C_,rData)) {
    if (rData.Find(K_M_P_C_) > 0) { canConnectWeb = TRUE ; }
    connectdSite = W_M_P_C_ ;
    }

アクセスする url に,ダブらないような情報を付加することで回避.
  CString para = _T(“?_q_=”) + ::ToString(::GetTickCount()) ;
  if (!canConnectWeb && InetFile::Read(W_M_P_C_+para,rData)) {
    if (rData.Find(K_M_P_C_) > 0) { canConnectWeb = TRUE ; }
    connectdSite = W_M_P_C_ ;
    }


2022/09
CHttpFile Read

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

2038 対応

以下の様なコードの所では,VC 7 までは 2038 に対応していない.
time_t ????::Get???? (void)
{
  ….
  time_t term = 0 ;
  #if(_MFC_VER >= 0x0800)
    ReadBlock(…,sizeof(__time32_t)/sizeof(WORD)) ;
    __time32_t* dateBuffer = (__time32_t*)Get????Buffer() ;
    __time32_t term32 = *dateBuffer ;
    term = UINT(term32) ;
  #else
    ReadBlock(…,sizeof(time_t)/sizeof(WORD)) ;
    time_t* dateBuffer = (time_t*)Get????Buffer() ;
    term = *dateBuffer ;
  #endif
  return term ;
  }
0x7fffffff までは問題ないが,2038 を超えると VC 7 の場合,-2147483648 になる.
VC 7 LocTim64.c では,以下の様になっている.
  if ( (*ptime _MAX__TIME64_T) )
    return( NULL );
VC 6 では,long のため範囲外(LocalTim.c など)となる.
VC 8 では,2038/01/19 と認識できる.
なんで VC 8 で #ifdef としたのか?古いことなので覚えてないが,VC 7 では一部うまくないことがあったため 2038 には対応しないとした?

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Dependency Walker , Spy , …

Dependency Walker
 http://www.dependencywalker.com/

Spy++ 8.0
 2005-09-28 10:07 140,463 spyxx.chm
 2005-12-01 03:24 496,824 spyxx.exe
 2005-09-23 02:13 73,728 spyxxhk.dll
 VC++ 2005 SP1 再頒布可能パッケージ
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

ASP 関係続き...

ログ
 AsFile.FileSys.Log(LPCTSTR message) { return ::LogMessage(message) ; }

TempFile
 AsFile.FileSys.GetDirTemp() + “TempFile.txt”
  logData = oFSys.TextFileRead(logFile)
  logData = logData & Now & vbTab & “LogData” & vbCrLf
  oFSys.TextFileWrite logFile,logData

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

しばらく使ってなかったので,…

並び替え
  ”SELECT * FROM Table_H_T_M_ ORDER BY U_1,U_2 ;”
  ”SELECT * FROM Table_H_T_M_ ORDER BY T_New,U_1,U_2 ;”
  ”SELECT * FROM Table_H_T_M_ ORDER BY T_Max,U_1,U_2 ;”
  ”SELECT * FROM Table_H_T_M_ ORDER BY H_No,U_1,N_ ;”

今回やりたいのは抽出なので WHERE
  ”SELECT * FROM Table_H_T_M_ WHERE H_No < 'M1000' ORDER BY H_No,U_1,N_ ;"
  "SELECT * FROM Table_H_T_M_ WHERE H_No LIKE ‘M0%’ ORDER BY H_No,U_1,N_ ;"

RecodeCount が -1 で返される
  デフォルトのカーソル adOpenForwardOnly
  ADO Recordset で RecordCount プロパティが -1 を返す場合
  oRS.CursorLocation = 3 ‘ adUseClient などとすれば良い
  または,oRS.Open source , connection , 3

全レコードの読み取り
  dim oRS
  set oRS = Server.CreateObject(“ADODB.recordset”)
  oRS.Open “Table” , “DSN=name”
  oRS.MoveFirst
  do while not oRS.EOF
    …
    oRS.MoveNext
  loop
  …
  oRS.Close

ASP の中止
  Response.End

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

CString::ReleaseBuffer で Assert

CString::GetBuffer を使用して,ReleaseBuffer を忘れているバグがあった.
現象は,内容をコピーした別の CString で ReleaseBuffer した時にアサート.
—————————
Microsoft Visual C++ Debug Library
—————————
Debug Assertion Failed!
Program: …\…\TInet\Debug.060\TInet.exe
File: strcore.cpp
Line: 512
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
—————————
中止(A) 再試行(R) 無視(I)
—————————
CString::ReleaseBuffer で Assert

他にも,GetLength で 0 になる.
CString::GetLength()  で 0 になる

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

DoDragDrop ですぐに抜ける?

以下の様なコードで,COleDataSource::DoDragDrop の部分がすぐ抜ける.
  CStringArray sa ;
  ::ListBoxToStringArray(m_DropList,&sa,TRUE) ;
  {
    CByteArray ba ;
    ::StringArrayToString2Z(sa,&ba) ;
    int len = ba.GetSize() ;
    HDROP hDrop = (HDROP)::GlobalAlloc(GHND,sizeof(DROPFILES) + len + sizeof(TCHAR)) ;
    if (hDrop == NULL) { return ; }
    LPDROPFILES lpdf = (LPDROPFILES)::GlobalLock(hDrop) ;
    lpdf->pFiles= sizeof(DROPFILES) ;
    lpdf->pt.x = 0 ;
    lpdf->pt.y = 0 ;
    lpdf->fNC = FALSE ;
    lpdf->fWide = FALSE ;
    #ifdef _UNICODE
    lpdf->fWide = TRUE ;
    #endif
    LPCTSTR lpFileNames = LPCTSTR(LPCSTR(lpdf)+lpdf->pFiles) ;
    memmove(LPVOID(lpFileNames),ba.GetData(),len) ;
    ::GlobalUnlock(hDrop) ;
    {
      COleDataSource* ods = new COleDataSource ;
      ods->CacheGlobalData(CF_HDROP,hDrop) ;
      ods->DoDragDrop() ;
      delete ods ;
      }
    }

AfxOleInit() を呼出していなかった.


[VC50] Windows 95 標準コントロールのドラッグアンドドロップサンプル 
http://support.microsoft.com/kb/152092/ja


2014/08/11 追記
上のコードで,delete ods はうまくない.
データ オブジェクトとデータ ソース : 作成と破棄

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Win 7 TaskBar Pin

C:\Users\[UserName]\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

LBS_HASSTRINGS を忘れると…

オーナ描画リストボックスで,GetText を呼出した時
LBS_HASSTRINGS を忘れると
コントロールの LBS_HASSTRINGS が指定されていない.


Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

CInternetFile::ReadString

CInternetFile::ReadString
VC 6 UNICODE.exe で,文字化けと,中身がうまく処理されない.MBCS.exe はOK.
文字化けは,CHAR から TCHAR への変換を正しく処理することにより対応.
それでも,まだ改行の位置で戻らず,終端も正しくない(デバッグ版ではゴミ ‘0xCD’ が入る).
どうも,VC 6 や 7 では,うまく処理できないみたい.VC 8 では期待した動作と思われる.

  CHttpConnection* pServer = pServer = session.GetHttpConnection (svrName) ;
  CHttpFile* pFile = pServer->OpenRequest (CHttpConnection::HTTP_VERB_GET,name) ;
  pFile-> SendRequest () ;
  {
    CString buf ;
    while (pFile->ReadString(buf)) {
      CString tmp = ::ToStringTC(LPCSTR(LPCTSTR(buf))) ;
      rBuf.Add(tmp) ;
      }
    ::StringArrayToString(rBuf,rData) ;
    }

http://support.microsoft.com/kb/329071
Microsoft KB Archive/329071
 PRB: CInternetFile::ReadString Does Not Convert Non-Unicode Text to Unicode Text


2019/01/31 LPCSTR , LPCWSTR からの変換
CRT_MBWC.hxx
tstrmbwc.hxx


2022/09/09 バイナリで処理する様に変更.
CHttpFile Read

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

MS11-025 その後

以前,KB2465367 などの影響を受けたが,その対応版 KB2538218 のコードの抜粋
typedef BOOL (WINAPI *PFNFINDACTCTXSECTIONSTRING)(DWORD, const GUID *, ULONG, LPCTSTR, PACTCTX_SECTION_KEYED_DATA);
static HINSTANCE _AfxLoadLangDLL(LPCTSTR pszFormat, LPCTSTR pszPath, LCID lcid)
{
 TCHAR szLangDLL[_MAX_PATH+14];
 TCHAR szLangCode[4];
 HINSTANCE hInstance = NULL;
 if (lcid == LOCALE_SYSTEM_DEFAULT) {
  Checked::tcscpy_s(szLangCode, _countof(szLangCode), _T("LOC"));
  }
 else {
  int nResult;
  nResult = ::GetLocaleInfo(lcid, LOCALE_SABBREVLANGNAME, szLangCode, 4);
  if (nResult == 0)
    return NULL;
  ASSERT( nResult == 4 );
  }
 int ret;
 ATL_CRT_ERRORCHECK_SPRINTF(ret = _sntprintf_s(szLangDLL,_countof(szLangDLL),_countof(szLangDLL)-1,pszFormat,pszPath,szLangCode));
 if(ret == -1 || ret >= _countof(szLangDLL)) {
  ASSERT(FALSE);
  return NULL;
  }
 TCHAR *pszFilename = ::PathFindFileName(szLangDLL);
 ACTCTX_SECTION_KEYED_DATA data = {sizeof(data)};
 HMODULE hKernel = GetModuleHandle(_T("KERNEL32"));
 PFNFINDACTCTXSECTIONSTRING pfnFindActCtxSectionString = NULL;
 if (hKernel != NULL) {
  #ifdef _UNICODE
   pfnFindActCtxSectionString = (PFNFINDACTCTXSECTIONSTRING)GetProcAddress(hKernel, "FindActCtxSectionStringW");
  #else
   pfnFindActCtxSectionString = (PFNFINDACTCTXSECTIONSTRING)GetProcAddress(hKernel, "FindActCtxSectionStringA");
  #endif
  }
 if (pfnFindActCtxSectionString &&
 pfnFindActCtxSectionString(0, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, pszFilename, &data)) {
  // Load using the dll name only…
  hInstance = ::LoadLibraryEx(pszFilename, NULL, 0);
  }
 else {
  // Load using the full path…
  hInstance = ::LoadLibraryEx(szLangDLL, NULL, 0);
  }
 return hInstance;
 }

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.