ホーム » Iwao の投稿 (ページ 50)

作者アーカイブ: Iwao

2024年5月
 1234
567891011
12131415161718
19202122232425
262728293031  

カテゴリー

アーカイブ

ブログ統計情報

  • 80,830 アクセス



セットアッププロジェクト

カスタム動作の追加
 「ソリューションエクスプローラ」で「右クリック」-「表示」-「カスタム動作」
 起動ポイントは, /Install /Commit /Rollback /Uninstall

カスタム動作の作成

MsgBox.exe では期待した動作となる.
動作として exe の終了を待つ様で,MakeCMF.exe の様な起動したままにするような動作には向かない.
試しに,MakeCMF.exe /Commit とすると,終了まで待ち,終了時にエラーとなる.
Setup Commit
その後,/Rollback が働き,インストールがキャンセルされる.

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

Envy100 その後

以前,MN128-SOHO-IB3 + MN-WLC54g でうまく接続できないでいたが,ATerm WR8500N では簡単に接続できた.
その代り? psc2550 がうまくつながらなくなり,有線に.


普通の印刷などはできるようになったが,Print Apps などは設定できてなかった.

HP カスタマー・ケア
 └─ HP ENVY 100 オールインワンプリンター – D410a
     └─ セットアップとインストールePrint & モバイル機器
         └─ プリンターのアップデート

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

ログオン スクリーンセーバを無効に

[HKEY_USERS\.DEFAULT\Control Panel\Desktop]
“ScreenSaveActive”=”0”
LogonScreenSave.zip

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

Shell.Tile…

以前,デスクトップ上のウィンドウを操作したいことがあった.


ToggleDT.scf
[Shell]
Command=2
IconFile=explorer.exe,3
[Taskbar]
Command=ToggleDesktop


TileVert.vbs
Set objShell = CreateObject(“Shell.Application”)
objShell.TileVertically


TileHorz.vbs
Set objShell = CreateObject(“Shell.Application”)
objShell.TileHorizontally


CascadeW.vbs
Set objShell = CreateObject(“Shell.Application”)
objShell.CascadeWindows


//**************************************************************************************************
// ファイル名 :CtrlDskT.cxx
// 機能名 :デスクトップの制御
// 作成者 :
// 作成年月日 :’07/08/08
// 変更履歴 :
//**************************************************************************************************
//
#include <Afx.h>

#include "DelFileE.hxx"
#include "CharMFC.hxx"
#include "ShellExc.hxx"
#include "HelpAPI.hxx"
#include "CtrlDskT.hxx"

////
//*******************************************************************************
// 関数名 :デスクトップの表示
// 作成日 :’07/08/08
//*******************************************************************************
// http://support.microsoft.com/kb/190355/ja
// クイック起動バーに [デスクトップの表示] アイコンを再登録する方法
BOOL ControlDesktop::ToggleDesktop (void)
{
  CString td_scf = ::GetTempPath()+_T("Command.tmp\\") + _T("ToggleDT.scf") ;
  if (::FileIsNothing(td_scf)) {
  // "デスクトップの表示.scf" の生成
    ::CreateEmptyFile(td_scf) ;
    CString tdCmd ;
    tdCmd += _T("[Shell]\r\n") ;
    tdCmd += _T("Command=2\r\n") ;
    tdCmd += _T("IconFile=explorer.exe,3\r\n") ;
    tdCmd += _T("[Taskbar]\r\n") ;
    tdCmd += _T("Command=ToggleDesktop\r\n") ;
    ::SaveText(td_scf,tdCmd) ;
    }
  ShellExec se ;
  se.SetFile(td_scf) ;
  se.Execute() ;
  { // 終了時に削除するように登録
    static DelFileE dfe ;
    dfe.Add(td_scf) ;
    }
  return TRUE ;
  }

////
//*******************************************************************************
// 関数名 :重ねて表示,上下に並べて表示,左右に並べて表示
// 作成日 :’07/08/08
//*******************************************************************************
// http://www.microsoft.com/japan/technet/scriptcenter/resources/qanda/jul05/hey0726.mspx
// Hey, Scripting Guy! デスクトップ上にウィンドウを並べて表示する方法はありますか
#define CD_AW_CascadeW 0
#define CD_AW_TileHorz 1
#define CD_AW_TileVert 2

BOOL ControlDesktop::CascadeWindows (void) { return
ArrangeWindows(CD_AW_CascadeW) ; }
BOOL ControlDesktop::TileHorizontally(void) { return
ArrangeWindows(CD_AW_TileHorz) ; }
BOOL ControlDesktop::TileVertically (void) { return
ArrangeWindows(CD_AW_TileVert) ; }

BOOL ControlDesktop::ArrangeWindows (const long type)
{
  CString cw_vbs = ::GetTempPath()+_T("Command.tmp\\") + _T("CascadeW.vbs") ;
  CString th_vbs = ::GetTempPath()+_T("Command.tmp\\") + _T("TileHorz.vbs") ;
  CString tv_vbs = ::GetTempPath()+_T("Command.tmp\\") + _T("TileVert.vbs") ;
  CString cmdvbs ;
  CString cmdExc ;
  switch (type) {
    case CD_AW_CascadeW : cmdvbs = cw_vbs ; cmdExc = _T("objShell.CascadeWindows \r\n") ; break ;
    case CD_AW_TileHorz : cmdvbs = th_vbs ; cmdExc = _T("objShell.TileHorizontally \r\n") ; break ;
    case CD_AW_TileVert : cmdvbs = tv_vbs ; cmdExc = _T("objShell.TileVertically \r\n") ; break ;
    default : cmdvbs = cw_vbs ; cmdExc = _T("objShell.CascadeWindows \r\n") ; break ;
    }
  if (::FileIsNothing(cmdvbs)) {
    ::CreateEmptyFile(cmdvbs) ;
    CString awCmd ;
    awCmd += _T("Set objShell = CreateObject(\"Shell.Application\")\r\n") ;
    awCmd += cmdExc ;
      // objShell.TileHorizontally
      // objShell.TileVertically
      // objShell.CascadeWindows
    ::SaveText(cmdvbs,awCmd) ;
    }
  ShellExec se ;
  se.SetFile(cmdvbs) ;
  se.SetShowCmd(SW_HIDE) ;
  se.Execute() ;
  { // 終了時に削除するように登録
    static DelFileE dfe ;
    dfe.Add(cmdvbs) ;
    }
  return TRUE ;
  }

デスクトップ上にウィンドウを並べて表示する方法はありますか
Shell.TileHorizontally method

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

Copy SrcFolder\*.txt DstFolder

あるフォルダの複数ファイルのコピーと移動.
 Files_Copy_or_Move を直接利用するのではなく,FolderCopyFiles , FolderMoveFiles を利用します.
//*******************************************************************************
// 関数名 :あるフォルダ直下のファイルのコピーと移動
// 作成日 :’11/11/04
//*******************************************************************************
BOOL Files_Copy_or_Move (LPCTSTR src_Name,LPCTSTR dstPath,const BOOL isDelSrc,const BOOL exist)
{
  CString srcPath = src_Name ;
  CString srcName = _T(“*.*”) ;
  if (CString(srcPath).IsEmpty()) { return FALSE ; }
  if (!::FileIsDirectory(src_Name)) {
    srcPath = ::GetFileDir (src_Name) ;
    srcName = ::GetFileName (src_Name) ;
    }
  if (srcPath == dstPath) { return FALSE ; }
  if (::FileIsNothing(srcPath)) { return FALSE ; } // 元のフォルダが存在しない
  if (::FileIsNothing(dstPath)) {
    if (!::CreateFolder(dstPath)) { return FALSE ; }
    }
  {
    CStringArray srcFiles ;
    ::FolderEnumFiles(srcPath,&srcFiles,srcName) ;
    for (int index=0 ; index<srcFiles.GetSize() ; index++) {
      CString srcFPath = srcFiles[index] ;
      CString srcFName = ::GetFileName(srcFPath) ;
      CString newFName = ::FolderAddLastSP(dstPath) + srcFName ;
      if (!::CopyFile(srcFPath,newFName,exist)) {
        continue ;
        }
      if (isDelSrc) { // 元のファイルは削除? (移動の場合?)
        CFile::Remove(srcFPath) ;
        }
      }
    }
  return TRUE ;
  }

inline BOOL FolderCopyFiles (LPCTSTR srcName, LPCTSTR dstPath, const BOOL exist)
{ return Files_Copy_or_Move ( srcName, dstPath, FALSE, exist) ; }
inline BOOL FolderMoveFiles (LPCTSTR srcName, LPCTSTR dstPath, const BOOL exist=FALSE)
{ return Files_Copy_or_Move ( srcName, dstPath, TRUE, exist) ; }

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

GetLastError と FormatMessage

以前,以下を作成していた(Error.hxx)

inline	CString	Error::FormatMessage(const DWORD error)
{
	CString	message ;
	LPVOID	lpMessageBuffer = NULL ;
	if (::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
		NULL,error,MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),
		(LPTSTR)&lpMessageBuffer,0,NULL)) {
		message = LPTSTR(lpMessageBuffer) ;
		::LocalFree(lpMessageBuffer) ;
		}
	return	message ;
	}
Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

FindNoCase

同じ関数を作ってしまったので,...
CharFnc.hxx より
//*******************************************************************************
// 関数名 :大文字/小文字を区別せずに検索
// 作成日 :’11/09/07
//*******************************************************************************
inline
int FindNoCase (LPCTSTR str1,LPCTSTR str2)
{
  CString fStr1 = str1 ;
  int fIndex = fStr1.Find(str2) ;
  if (fIndex >= 0) { return fIndex ; } // 大文字/小文字を区別して見つかった?
  CString fStr2 = str2 ;
  fStr1.MakeLower() ;
  fStr2.MakeLower() ;
  return fStr1.Find(fStr2) ; // 大文字/小文字を区別せずに(小文字にして)検索
  }

他にも,
PathName.hxx
PathName.hxx
//*******************************************************************************
// 関数名 :ファイル拡張子取得(text.DAT->dat) 小文字で
// 作成日 :’11/06/09
//*******************************************************************************
inline
CString GetFileExtLow (LPCTSTR pathName)
{
  CString ext = ::GetFileExt(pathName) ;
  ext.MakeLower() ;
  return ext ;
  }


StringFn.hxx

stringfn.hxx

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

WDFME.exe

以前はここまでひどくなかったと思うが,昨日再起動をかけたにもかかわらず,物理メモリの空きが少なくなり動作が遅くなり始めた.
どうも WDFME.exe が影響しているようで,今日再起動後,また同様になってきた.
5 時間程度 PC を起動している状態で,2G 程度食っている.
WD SmartWare のアップデートが出ているのは知っていたが,特に支障は感じられなかった(1.5.0.18)ので更新しないでいた.

アップデートの 1.5.1.6 には以下の様な記述がある.
Fixed high memory utilization on certain systems.

更新してみたが効果なし.

今までうまく動作していて自分の環境に合っていたので,ちょっと残念.
ひとまずサービスを停止することにした.

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

BDH_Modify クラスを用意

BDH_Modify クラスを用意しました.
 class BDH_Modify {
 public:
   BDH_Modify () { Modified = FALSE ; }
 public:
  virtual BOOL IsModified (void) const { return Modified ; }
  virtual BOOL SetModifiedFlag (const BOOL mod=TRUE) { Modified = mod ; return TRUE ; }
  virtual BOOL CanClose (void) { return SaveModified() ; }
 public:
  virtual CString GetPathName (void) const { return _T(“ファイル”) ; }
  virtual BOOL DoFileSave (void) { return FALSE ; }
 public:
  virtual BOOL SaveModified (void) ;
 protected:
  BOOL Modified ;
  } ;

 inline
 BOOL BDH_Modify::SaveModified (void)
 {
  if (!IsModified()) { return TRUE ; }
  CString name = GetPathName() ;
  if (name.Find(‘\\’) >= 0) {
   name = ::GetFileName(name) ;
   }
  // VC98\MFC\SRC\DocCore.cpp CDocument::SaveModified() より
  CString prompt ;
  AfxFormatString1(prompt,AFX_IDP_ASK_TO_SAVE,name) ;
  switch (AfxMessageBox(prompt,MB_YESNOCANCEL,AFX_IDP_ASK_TO_SAVE)) {
   case IDCANCEL: return FALSE ; break ;
   case IDYES : if (!DoFileSave()) { return FALSE ; } break ;
   case IDNO : break ;
   default : break ;
   }
   return TRUE ;
  }

ダイアログベースなどで利用するために作成しました.
以下の様に利用しています.
 #include “BDH_Mod.hxx”
 class BDModCSV : public BDocCSV , public BDH_Modify {
 public:
  virtual BOOL Clear (void) { SetModifiedFlag(FALSE) ; return BDocCSV::Clear() ; }
 public:
  virtual void Serialize (CArchive& ar) { SetModifiedFlag(FALSE) ; BDocCSV::Serialize(ar) ; }
  } ;

 class Masters : public BDModCSV
 {
  // …
  virtual CString GetPathName (void) const { return GetFilePath() ; }
  virtual BOOL DoFileSave (void) { return FileWrite(GetFilePath()) ; }
  } ;

 BOOL Masters::AddMaster1 (Master* reg)
 {
  SetModifiedFlag(TRUE) ;
  // …
  }

 void CEditCNDlg::OnCancel()
 {
  Masters* masters = Mast_S->GetSelected() ;
  if (masters != NULL && !masters->CanClose()) { return ; }
  CDialog::OnCancel();
  }

BDH_Modify クラス

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

VC6→VC8→MBCS→UNICODE C4651

c:\….\masteddg.cpp(4) : warning C4651: ‘/D_MBCS’ がプリコンパイル済みヘッダーに定義されていますが、現在のコンパイル処理には定義されていません。

vcproj 内の “;_AFXDLL;_MBCS;$(NoInherit)” を削除
 _AFXDLL _MBCS $(NoInherit)


VC 7 などで追加したファイルは,以下の様にシンプル.
<File
  RelativePath=".\MastEdDg.cpp">
  </File>

これは,VC 6 で追加したもの.
<File
  RelativePath="MastS.cpp">
  <FileConfiguration
    Name="Debug|Win32">
    <Tool
      Name="VCCLCompilerTool"
      PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
      BasicRuntimeChecks="3"/>
    </FileConfiguration>
  <FileConfiguration
    Name="Release|Win32">
    <Tool
      Name="VCCLCompilerTool"
      PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"/>
    </FileConfiguration>
  </File>


2021/01
VC 12 LNK1104 , VC 14.2 LNK2019
コンパイル対象のソースをすべて選択して「プリプロセッサの定義」を
VC 2008 までは「ブランク」に.
VC 2010 以降は <親またはプロジェクトの既定値から継承> にする.

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

UNICODE と VC6 → VC8 一部修正

UNICODE と VC6 → VC8  2009/12

VC6 UNICODE

wWinMainCRTStartup

VC6 → VC8

http://cid-535f5973454c1292.skydrive.live.com/self.aspx/.Public/MFC/VC6%e2%86%92VC8.txt

「全般」-「出力ディレクトリ」,「中間ディレクトリ」 .\$(ConfigurationName)
「プリコンパイル済みヘッダファイル」 $(IntDir)/$(TargetName).pch
「C/C++」-「出力ファイル」
 「ASMリスト...」
 「オブジェクト...」
 「プログラムデータベース...」
$(IntDir)/
「リンカ」-「全般」の「出力ファイル」 $(OutDir)/$(ProjectName).exe
リンカ」-「デバッグ」
 「プログラムデータベースファイルの生成」
$(OutDir)/$(ProjectName).pdb
「リソース」-「全般」の「リソースファイル名」 $(IntDir)/$(InputName).res
「MIDL」-「出力」の「タイプライブラリ」 $(IntDir)/$(ProjectName).tlb
「ブラウザ情報」-「全般」の「出力ファイル」 $(OutDir)/$(ProjectName).bsc

 
https://dev.mish.work/Iwao/Doc/other/vs/

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

Web 接続のリモート

サーバが WIn XP
 リモート デスクトップ Web 接続をインストール
 ms-its:C:\WINDOWS\Help\rdesktop.chm::/rdesktop_install_Webcli.htm
外部にサーバを公開する
 http://www.aterm.jp/function/guide12/model/190/k/index.html
http://(サーバ名)/tsweb/

Web 経由の場合は,サーバ名を入力

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

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.