#include "myWin.h" #include "dialog.h" //■SowFind Example([検索]用変数宣言 //static FINDREPLACE fr; //static UINT uMessage; TCHAR strFind[128]=TEXT("find"), strMsg[1024]; //■SowFindReplace Example([検索&置換]用変数宣言 static FINDREPLACE fr; static UINT uMessage; TCHAR strFind[128]=TEXT("find"), strRep[128]=TEXT("replace"),strMsg[1024]; void procLButtonDown(HWND hw, WPARAM wp,LPARAM lp){ //■ChooseColor Example // CHOOSECOLOR CC;COLORREF CustC[16];TCHAR str[128]; // if(ChooseColor(hw, &CC, CustC)){ // wsprintf(str,TEXT(" %08X"),CC.rgbResult); // MessageBox(hw,str,TEXT("色指定"),MB_OK); // } //■ChooseFont Example // CHOOSEFONT CC;LOGFONT logfont;TCHAR str[128]; // if(ChooseFont(hw, &CC, &logfont)){ // wsprintf(str,TEXT(" %08X Name=\"%s\" Bold=%08X "), // CC.iPointSize,logfont.lfFaceName, logfont.lfWeight); // MessageBox(hw,str,TEXT("フォント選択"),MB_OK); // } //■GetOpenFName Example // static OPENFILENAME CC; // static TCHAR strFile[2048],strFileTitle[128]; // static TCHAR sFilter[]=TEXT("Text Files\0*.txt\0All Files\0*.*\0"); // if(GetOpenFName(hw,&CC, sFilter, strFile, strFileTitle, // TEXT("D:\\"),TEXT("テストだよ"),TEXT("txt"))) // MessageBox(hw,CC.lpstrFile,TEXT("ファイルを開くダイアログ"),MB_OK); //■GetSaveFName Example // static OPENFILENAME CC; // static TCHAR strFile[2048],strFileTitle[128]; // static TCHAR sFilter[]=TEXT("Text Files\0*.txt\0All Files\0*.*\0"); // if(GetSaveFName(hw,&CC, sFilter, strFile, strFileTitle, // TEXT("D:\\"),TEXT("テストだよ"),TEXT("txt"))) // MessageBox(hw,CC.lpstrFile,TEXT("ファイルを保存ダイアログ"),MB_OK); //■GetOpenMultiFName Example // static OPENFILENAME CC; // static TCHAR strFile[2048],strFileTitle[128]; // static TCHAR sFilter[]=TEXT("Text Files\0*.txt\0All Files\0*.*\0"); // if(GetOpenMultiFName(hw,&CC, sFilter, strFile, strFileTitle, // TEXT("D:\\"),TEXT("テストだよ"),TEXT("txt"))) // printMultiFileName(hw, CC.lpstrFile); // //■PrintDialog Example // static PRINTDLG pd; // static BCHAR *strName;//TCHAR str[256]; // if( PrintDialog(hw, &pd)){ // if(pd.hDevMode){ // strName=(BCHAR *)GlobalLock(pd.hDevMode); // MessageBox(hw,strName,TEXT("印刷ダイアログ"),MB_OK); // GlobalUnlock(pd.hDevMode); // } // static PAGESETUPDLG psd; TCHAR str[2048]=TEXT(""); //■PageSetupDialog Example // if(PageSetupDialog(hw, &psd)){ // wsprintf(str,TEXT("\n幅 = %d\n高さ = %d\nマージン = %d %d, %d,%d"), // psd.ptPaperSize.x , psd.ptPaperSize.y , // psd.rtMargin.top , psd.rtMargin.right, // psd.rtMargin.bottom, psd.rtMargin.left); // MessageBox(hw,str,TEXT("ページ設定"),MB_OK); // } //■SowFind Example // uMessage = showFind(hw,&fr, strFind); //■SowFindReplace Example uMessage = showFindReplace(hw,&fr, strFind, strRep); } //■SowFind Example([検索]ボタンクリック時の処理 //void procFind(HWND hw, WPARAM wp,LPARAM lp){ // wsprintf(strMsg,TEXT("検索文字列   : \"%s\"\n") // TEXT("単語単位で探す : %s\n") // TEXT("大/小文字の区別: %s\n") // TEXT("上から下に   : %s\n"), // fr.lpstrFindWhat , andTF(FR_WHOLEWORD), // andTF(FR_MATCHCASE), andTF(FR_DOWN)); // MessageBox(hw,strMsg,TEXT("検索条件"),MB_OK); //} //■SowFindReplace Example([検索&Replace]ボタンクリック時の処理 void procFind(HWND hw, WPARAM wp,LPARAM lp){ wsprintf(strMsg,TEXT("検索文字列   : \"%s\"\n") TEXT("置換文字列   : \"%s\"\n") TEXT("単語単位で探す : %s\n") TEXT("大/小文字の区別: %s\n") TEXT("処理      : %s\n"), fr.lpstrFindWhat , fr.lpstrReplaceWith, andTF(FR_WHOLEWORD), andTF(FR_MATCHCASE), fr.Flags & FR_FINDNEXT? TEXT("次を検索") : fr.Flags & FR_REPLACE ? TEXT("置換して次へ"):TEXT("すべて置換")); MessageBox(hw,strMsg,TEXT("検索条件"),MB_OK); } LRESULT CALLBACK WndProc(HWND hw, UINT msg, WPARAM wp,LPARAM lp){ //■SowFind, ShowFindReprace Example([検索]ボタンクリック時の判定 if(checkFind(hw, msg, wp,lp, fr,uMessage, procFind)) return 0;//検索用判定 switch(msg){ case WM_DESTROY : PostQuitMessage(0) ;return 0; case WM_LBUTTONUP: procLButtonDown(hw,wp,lp);return 0; } return DefWindowProc(hw,msg,wp,lp); }