2024年4月
 123456
78910111213
14151617181920
21222324252627
282930  

カテゴリー

アーカイブ

ブログ統計情報

  • 79,962 アクセス



CCriticalSection と CMutex

それぞれ,500,000 回呼出した時間 (m sec) 

      P4       VirtualPC     Xeon    
CCriticalSection 734 160 94
*1 78 20 15
CMutex 8200 710 1140
*1 950 250 437
Profile          INI 2900 950 920
Reg 2100 570 740

  ElapseTick et_cs ;
  {
     CCriticalSection cs ;
     for (int index=0 ; index<500000 ; index++) {
     //CCriticalSection cs ;
        cs.Lock() ;
        cs.Unlock() ;
        }
     }
  DWORD e_cs = et_cs.GetElapse() ;

  ElapseTick et_me ;
  {
     CMutex mt ;
     for (int index=0 ; index<500000 ; index++) {
       mt.Lock() ;
       mt.Unlock() ;
       }
     }

  DWORD e_me = et_me.GetElapse() ;

  ElapseTick et_pr ;
  {
     Profile profile ;
     for (int index=0 ; index<500000 ; index++) {
       int data = profile.GetInt(_T("Test"),_T("Test"),100) ;
       }
     }
  DWORD e_pr = et_pr.GetElapse() ;

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

OpenMP エラー 1002

—————————
致命的なユーザー エラー 1002:
—————————
同一名の 1 つで ‘#pragma omp critical’ が不適切に入れ子にされています
致命的なユーザー エラー 1002: 同一名の 1 つで ‘#pragma omp critical’ が不適切に入れ子にされています
2.9 ディレクティブの入れ子
局所的になる様に,呼び出し元での “#pragma omp critical” を削除.

class Profile {
  ...
protected:
  LPCTSTR  LastProfileName ;
  CString  C_T_ProfileName ;
  ...
  } ;

BOOL Profile::SaveProfileName(void)
{
  CWinApp* app = AfxGetApp() ;
  if (app== NULL) { return FALSE ; }
  LastProfileName = AfxGetApp()->m_pszProfileName ;
  AfxGetApp()->m_pszProfileName = C_T_ProfileName ;
  return TRUE ;
  }
BOOL Profile::LoadProfileName(void)
{
  AfxGetApp()->m_pszProfileName = LastProfileName ;
  return TRUE ;
  }

omp critical ではなく,MFC 同期クラスを使用する様に変更.

//  以下は,テスト用のコード
BOOL Profile::?et??? (LPCTSTR lpszSection,LPCTSTR lpszEntry,...)
{
  ...
  CMutex m(FALSE,MN_LPN) ;
  m.Lock() ;
// return    ???Profile??? (lpszSection, lpszEntry, ...) ;
  BOOL ret = ???Profile??? (lpszSection, lpszEntry, ...) ;
  m.Unlock() ;
  return ret ;
  }
//  MFC 同期クラスの呼出しはコストがかからない様に修正する
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

OpenMP プロジェクトの設定

VC8 以降 プロジェクトのプロパティページ
「構成プロパティ」-「C/C++」-「言語」-「OpenMP サポート」を「はい」に設定.

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

MFC Static → DLL

MFC を「スタティック ライブラリ」から「共有 DLL」に変更した時,以下のエラーになることがある.
—— ビルド開始: プロジェクト: Project , 構成: Release Win32 ——
コンパイルしています…
StdAfx.cpp
C:Program FilesMicrosoft Visual Studio 8VCatlmfcincludeafx.h(24) : fatal error C1189: #error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]
Project – エラー 1、警告 0
========== ビルド: 0 正常終了、1 失敗、0 更新、0 スキップ ==========
*.vcproj をエディタで開き,"$(NoInherit)" を削除


2010/04/21 追記
—— ビルド開始: プロジェクト: Project , 構成: Release Win32 ——
StdAfx.cpp
C:Program Files (x86)Microsoft Visual Studio 10.0VCatlmfcincludeafxver_.h(81): fatal error C1189: #error : Please use the /MD switch for _AFXDLL builds
========== ビルド: 0 正常終了、1 失敗、0 更新不要、0 スキップ ==========
プロジェクトの「プロパティ」-「構成プロパティ」-「C/C++」-「コード生成」-「ランタイムライブラリ」
マルチスレッド (/MT) → マルチスレッド DLL (/MD)


2021/06
https://dev.mish.work/wordpress/2021/01/23/vc-12-lnk1104-vc14-2-lnk2019/
https://dev.mish.work/wordpress/2021/04/01/change-mfc-static-error/

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

FileVer.* を使用した CAboutDlg

CAboutDlg を表示する時に IDC_STATIC による固定的な情報を使用するのではなく,バージョンリソースを使用する

  1. IDD_ABOUTBOX の IDC_STATIC を IDC_FV_DESCRIPTION_VERSION と IDC_FV_LEGAL_COPYRIGHT に変更.
  2. IDC_FV_XXX で始まる使用できるものは,FileVer.cxx を参照.個別の12個と組合せの1個を用意 . 
  3. CAboutDlg::OnInitDialog() で,SetAboutFileVer(this) を呼び出す. 
  4. リンク時に Version.lib がなければ追加.

http://cid-535f5973454c1292.skydrive.live.com/embedicon.aspx/.Public/MFC/FileVer.zip
FileVer.zip


2022/07/28
::GetFileVersionInfo
FVersion.hxx

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

Windows バージョンのデスクトップ表示

Windows のバージョンをデスクトップに表示する reg ファイル
http://cid-535f5973454c1292.skydrive.live.com/embedicon.aspx/.Public/RegFiles/PaintDesktopVersion.zip
PaintDesktopVersion.zip
HKEY_CURRENT_USER\Control Panel\Desktop
  PaintDesktopVersion
Win10 1903 バージョン表示


2020/10
https://jml.mish.work/i-tools/setcolt.html
Win10 用 タイトルバーの色設定

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

IE の Skype アドオン機能の無効化

IE での Web ページ内の電話番号付近の表示をなくす設定
Skype add-on の設定を開く.
Skype add-on の設定を開く
その中の,「番号をハイライト表示する」のチェックを外す.
「番号をハイライト表示する」のチェックを外す
特に利用しない場合は,アンインストールしても良い.


2013/12/09 追記
今の環境(Win 7 , IE 10)では,
メニューの「ツール」-「アドオンの管理」などから
 IE 10 メニューの「ツール」-「アドオンの管理」
「Skype add-on for Internet Explorer」を選択して,「無効にする」
「Skype add-on for Internet Explorer」を選択して「無効にする」
IE を再起動.

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

Outlook で配信不能 配布先リスト

「配布先リスト」の「名前」の所にメールアドレスでなく「連絡先」の「表示名」のみの場合?に配信不能になる.
修正後,「配信不能」にならなかったことは確認済み.
詳細は未確認.

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

IIS 他の PC から接続できない

以下を設定済み.
Windows ファイアウォールを設定したまま、IIS のサービス提供を有効にする方法
  http://support.microsoft.com/kb/883877/ja
  http://support.microsoft.com/ja-jp/help/883877
この状態で,他の PC から接続できない状態になっていた(前は接続できてたはず).
 1. 一度,「詳細設定」-「サービス」タブの「Web サーバ(HTTP)」のチェックを外す.
 2. 「Windows ファイアウォール」のダイアログを閉じる.
 3. 再度開いて「「Web サーバ(HTTP)」のチェックを付ける.
再設定して他から接続できる様になった.


2016/04/19 追記 上は,Win XP 相当の内容です.


2015/02 IIS 環境の再設定
2020/11 Win10 他の PC が表示されない

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

「すべて…/このユーザのみ」の選択を表示させない

インストール時に,「すべてのユーザ」/「このユーザのみ」の選択を表示しない設定.

  1. メニューの「表示」-「エディタ」-「ユーザーインターフェイス」で設定ウィンドウを表示する.
  2. ツリーの「インストール」-「開始」-「インストールフォルダ」を選択.
  3. プロパティの「InstallAllUsersVisible」を Flase に.

必要に応じて,「配置プロジェクトのプロパティ」の「InstallAllUsers」を設定すること.


2021/11/17
メニューの「表示」-「Editor」-「ユーザー インターフェース」.
または「プロジェクト」-「右クリック」-「View」-「ユーザー インターフェース」.
「ツリー」の「Install」-「Start」-「インストール フォルダー」を選択.
プロパティの「InstallAllUsersVisible」を Flase に.
「InstallAllUsersVisible」を Flase に.

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

エクスプローラでサムネール表示できない

 エクスプローラの表示設定の「常にアイコンを表示し,縮小版は表示しない」のチェックを外す.

  1. 「コントロールパネル」-「デスクトップのカスタマイズ」.
  2. その中の「フォルダオプション」.
  3. 「フォルダオプション」ダイアログ内の「表示」タブにあります.
  • または,「エクスプローラ」のメニューの「ツール」-「フォルダオプション」.

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.

CommonAppDataFolder にインストールしたい

CommonAppDataFolder 以下に,ファイルをインストールする

  1. 「特別なフォルダの追加」-「カスタムフォルダ」でフォルダを作成.
  2. プロパティの「DefaultLocation」を "[CommonAppDataFolder]" と入力.
    [CommonAppDataFolder][Manufacturer][ProductName] などとしても良い.

System Folder Properties
http://msdn.microsoft.com/en-us/library/aa372057(VS.85).aspx

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

Outlook で配信不能になる

2018/04/06 新しく書き直し


受信者をコードで指定していると Outlook で配信不能になる(OE では問題ない).

配信不能 : Subject
システム管理者
送信日時 2010/02/19(金) 21:20
宛先   **********


このメールは、受信者全員または一部に届きませんでした。
件名: Subject
送信日時: 2010/02/19 21:20
以下の受信者にメールを配信できません: 
‘user@*******.com’ 2010/02/19 21:20
この受信者へ配信できる電子メール アカウントはありません。


受信者のメールアドレスを設定する時,_T("smtp:") を付加する

// DOCMAPI.CPP  CDocument::OnFileSendMail
//*******************************************************************************
// 関数名 :ファイルの送信
// 作成日 :’06/06/23
//*******************************************************************************

BOOL SendMail::Send (void) const
{
  if (!IsSupport()) { return FALSE ; }
  CheckSizeAlert() ;
  // MultiByte の必要があるようなので,UNICODE の時のバッファをここに登録する
  LateDelete ld ;
  // 添付ファイルの準備
   int fileCount = 0 ;
   CArray<MapiFileDesc,MapiFileDesc> fileDescA ;
   int index = 0 ;
   for (index=0 ; index<PathNames.GetSize() ; index++) {
      CString pathName = PathNames[index] ;
      if (::FileIsNothing (pathName)) { continue ; }
      if (::FileIsDirectory(pathName)) { continue ; }
      MapiFileDesc fileDesc ;
      memset(&fileDesc,0,sizeof(MapiFileDesc)) ;
      fileDesc.nPosition = (ULONG)-1 ;
      #ifdef _UNICODE
        fileDesc.lpszPathName = SendMail__ChangeMultiByte(PathNames[index],&ld) ;
        fileDesc.lpszFileName = SendMail__ChangeMultiByte(FileNames[index],&ld) ;
      #else
        fileDesc.lpszPathName = LPSTR(LPCTSTR(PathNames[index])) ;
        fileDesc.lpszFileName = LPSTR(LPCTSTR(FileNames[index])) ;
      #endif
      fileDescA.Add(fileDesc) ;
      fileCount++ ;
      }
    // 受信者の準備
    int recipCount = 0 ;
    CArray<MapiRecipDesc,MapiRecipDesc> recipDescA ;
    CStringArray recipName ;
    CStringArray recipAddr ;
    for (index=0 ; index<Recipient.GetSize() ; index++) {
        recipName.SetAtGrow(index,Recipient[index]) ;
        recipAddr.SetAtGrow(index,Recipient[index]) ;
        if (IsAddressAddSMTP()) {
            recipAddr.SetAtGrow(index,_T("smtp:")+Recipient[index]) ;
            }
        }
    for (index=0 ; index<Recipient.GetSize() ; index++) {
      MapiRecipDesc recipDesc ;
      memset(&recipDesc,0,sizeof(MapiRecipDesc)) ;
      recipDesc.ulRecipClass = MAPI_TO ;
      #ifdef _UNICODE
        recipDesc.lpszName = SendMail__ChangeMultiByte(recipName[index],&ld) ;
        recipDesc.lpszAddress = SendMail__ChangeMultiByte(recipAddr[index],&ld) ;
      #else
        recipDesc.lpszName = (LPSTR)((LPCTSTR)(recipName[index])) ;
        recipDesc.lpszAddress = (LPSTR)((LPCTSTR)(recipAddr[index])) ;
      #endif
      recipDescA.Add(recipDesc) ;
      recipCount++ ;
      }
    MapiMessage message ;
    memset(&message,0,sizeof(message)) ;
    message.nFileCount = fileCount ;
    message.lpFiles = fileDescA.GetData() ;
    message.nRecipCount = recipCount ;
    message.lpRecips = recipDescA.GetData() ;
    #ifdef _UNICODE
       message.lpszSubject = SendMail__ChangeMultiByte(GetSubject(), &ld) ;
       message.lpszNoteText = SendMail__ChangeMultiByte(GetNoteText(), &ld) ;
    #else
       message.lpszSubject = LPSTR(LPCTSTR(Subject)) ;
       message.lpszNoteText = LPSTR(LPCTSTR(NoteText)) ;
    #endif
    CWnd* mainWnd = AfxGetMainWnd() ;
    #if(_MFC_VER >= 0x0700)
       ULONG_PTR hWnd = (ULONG_PTR)mainWnd->GetSafeHwnd() ;
    #else
       ULONG hWnd = (ULONG) mainWnd->GetSafeHwnd() ;
    #endif
    int nError = pSendMail(0, hWnd,&message, MAPI_LOGON_UI|MAPI_DIALOG, 0);
    if (nError != SUCCESS_SUCCESS &&
        nError != MAPI_USER_ABORT &&
        nError != MAPI_E_LOGIN_FAILURE) {
        AfxMessageBox(AFX_IDP_FAILED_MAPI_SEND) ;
        Copy() ;
        }
     return TRUE ;
     }

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

クリップボードへのテキストの転送

//  WinMFC.hxx
//*******************************************************************************
// 関数名 :クリップボードへのテキストの転送
// 作成日 :’01/07/13
// 変更日 :’07/12/14 UNICODE テキスト対応
//*******************************************************************************
inline
BOOL SetClipboardText (LPCTSTR text)
{
 CString   str = text ;
 GLOBALHANDLE hGMemText = 0 ;
 {
  hGMemText = ::GlobalAlloc(GHND,(DWORD)(str.GetLength()+1)*sizeof(TCHAR)) ;
  LPSTR  lpText = (LPSTR)::GlobalLock(hGMemText) ;
  memmove(lpText,str,str.GetLength()*sizeof(TCHAR)) ;
  ::GlobalUnlock(hGMemText) ;
  }
 {
  BOOL ret = ::OpenClipboard(NULL) ;
  if (ret == FALSE) {
   ::GlobalFree(hGMemText) ;
   ::MessageBeep(0) ;
   ::MessageBox(NULL,_T("ERROR: Cannot access the Clipboard!"),AfxGetAppName(),MB_OK|MB_ICONEXCLAMATION) ;
   return FALSE ;
   }
  else {
   ::EmptyClipboard() ;
   #ifdef _UNICODE
   ::SetClipboardData(CF_UNICODETEXT, hGMemText) ;
   #else
   ::SetClipboardData(CF_TEXT,   hGMemText) ;
   #endif
   ::CloseClipboard() ;
   }
  }
 return TRUE ;
 }
 
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

Win7 が勝手に起動する

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

VC6 , VC8 リモートデバッグ

VC6
mk:@MSITStore:J:MSDNvccore.chm::/html/_core_setting_up_the_remote_debug_monitor.htm
http://support.microsoft.com/kb/241848/ja
https://www.betaarchive.com/wiki/index.php?title=Microsoft_KB_Archive/241848
以下のファイルをターゲット PC にコピー

1998-07-06 00:00 24,651 MSVCMON.EXE
2004-02-27 00:00 106,566 DM.DLL
2000-07-15 00:00 184,320 MSDIS110.DLL
2008-04-14 11:25 413,696 MSVCP60.DLL
2004-02-17 00:00 278,581 MSVCRT.DLL
2000-07-15 00:00  28,746 TLN0T.DLL

VC7
ms-help://MS.VSCC/MS.MSDNVS.1041/vsdebug/html/vctskInstallingRemoteDebugMonitor.htm
http://msdn.microsoft.com/ja-jp/library/aa291492(VS.71).aspx
C:\Program Files\Microsoft Visual Studio .NET\Common7\Packages\Debugger\
 msvcmon.exe
 msvcr70.dll
 NatDbgTLNet.dll
 NatDbgDM.dll
デバッグを開始できません.
プログラム ” を開始できません。
現在のユーザーのコンテキストで実行中のリモート コンピュータに MSVCMON がありません。

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Machine Debug Manager]
"AllowLaunchAsOtherUser"=dword:00000001
うまく起動できない


VC8
http://msdn.microsoft.com/ja-jp/library/ey7ec813.aspx
http://msdn.microsoft.com/ja-jp/library/ey7ec813(VS.80).aspx
http://msdn.microsoft.com/ja-jp/library/bt727f1t(VS.80).aspx
 MSVSMon.exe
 DbgHelp.dll
 MSDbgUI.dll

http://support.microsoft.com/kb/908099/ja


VC9
http://msdn.microsoft.com/ja-jp/library/bt727f1t.aspx
http://msdn.microsoft.com/ja-jp/library/bt727f1t(VS.100).aspx
 MSVSMon.exe


リモートデバッグ

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

VC7 マルチバイト→UNICODE

マルチバイトから UNICODE への変更で以下のエラーになることがある.

libcmtd.lib(wwincrt0.obj) : error LNK2019: 未解決の外部シンボル _wWinMain@16 が関数 _wWinMainCRTStartup で参照されました。

*.vcproj をエディタで開き,"$(NoInherit)" を削除

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

157 – 1 – 4 – 4

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

起動時 kstartup.exe がない

Kinoma Play の Storage Card へのインストールで起動時にメッセージが表示される.
「マイ デバイス」内へインストールし直しで OK.

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