windowsのプロンプトでansiのエスケープシーケンスが使いたい場合は、
wac というコマンドにパイプで渡すと出来る。
wac というコマンドにパイプで渡すと出来る。
wget http://apt-cyg.googlecode.com/svn/trunk/apt-cyg chmod a+x apt-cyg mv apt-cyg /usr/local/bin/
`setup.ini' というファイルはありません。 Error updating setup.ini, reverting
--- apt-cyg.org 2013-08-10 10:57:28.000000000 +0900 +++ apt-cyg 2013-08-10 11:11:15.000000000 +0900 @@ -95,14 +95,14 @@ then touch setup.ini mv setup.ini setup.ini-save - wget -N $mirror/setup.bz2 + wget -N $mirror/x86_64/setup.bz2 if test -e setup.bz2 && test $? -eq 0 then bunzip2 setup.bz2 mv setup setup.ini echo Updated setup.ini else - wget -N $mirror/setup.ini + wget -N $mirror/x86_64/setup.ini if test -e setup.ini && test $? -eq 0 then echo Updated setup.iniDownload here
cd wget http://tyfunction.net/download/apt-cyg.patch cd /usr/local/bin/ patch < ~/apt-cyg.patch rm ~/apt-cyg.patch
#import <mshtml.tlb> no_auto_exclude auto_rename static long getScrollTop(CHtmlView* pView){ long scrollTop = 0; try { MSHTML::IHTMLDocument3Ptr document = pView->GetHtmlDocument(); MSHTML::IHTMLElement2Ptr root = document->documentElement; scrollTop = root->scrollTop; if (0 == scrollTop){ MSHTML::IHTMLElement2Ptr body = root->getElementsByTagName(_T("body"))->item(0); scrollTop = body->scrollTop; } } catch (_com_error& e){ // TODO: Error handling... } return scrollTop; }
DWORD execute(LPCTSTR lpCommand, LPCTSTR lpRedirectFile) { DWORD dwExidCode = -1; TCHAR* pCmd; size_t nSize = _tcsclen(lpCommand); pCmd = new TCHAR[nSize +1]; _tcscpy_s(pCmd, nSize+1, lpCommand); SECURITY_ATTRIBUTES sa; sa.nLength = sizeof(sa); sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = TRUE; HANDLE hFile = CreateFile( lpRedirectFile, GENERIC_WRITE, FILE_SHARE_WRITE, &sa, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile != INVALID_HANDLE_VALUE){ STARTUPINFO si; ZeroMemory(&si, sizeof(si)); si.cb = sizeof(si); si.dwFlags = STARTF_USESTDHANDLES; si.hStdOutput = hFile; PROCESS_INFORMATION pi; ZeroMemory(&pi, sizeof(pi)); if(CreateProcess(NULL, pCmd, &sa, &sa, TRUE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)){ WaitForSingleObject(pi.hProcess, INFINITE ); GetExitCodeProcess(pi.hProcess, &dwExidCode); CloseHandle(pi.hProcess); CloseHandle(pi.hThread); } CloseHandle(hFile); } delete[] pCmd; return dwExidCode; }※CreateProcess関数に渡すコマンド文字列はconst付きの文字列を取らないので、ヒープ上にコピーしたうえで渡す。
virtual BOOL DoSave(LPCTSTR lpszPathName, BOOL bReplace = TRUE);
#include "io.h" // for _access #include "afxdatarecovery.h" #define DELETE_EXCEPTION(e) do { if(e) { e->Delete(); } } while (0) BOOL CDocument::DoSave(LPCTSTR lpszPathName, BOOL bReplace) // Save the document data to a file // lpszPathName = path name where to save document file // if lpszPathName is NULL then the user will be prompted (SaveAs) // note: lpszPathName can be different than 'm_strPathName' // if 'bReplace' is TRUE will change file name if successful (SaveAs) // if 'bReplace' is FALSE will not change path name (SaveCopyAs) { CString newName = lpszPathName; if (newName.IsEmpty()) { CDocTemplate* pTemplate = GetDocTemplate(); ASSERT(pTemplate != NULL); newName = m_strPathName; if (bReplace && newName.IsEmpty()) { newName = m_strTitle; // check for dubious filename int iBad = newName.FindOneOf(_T(":/\\")); if (iBad != -1) newName.ReleaseBuffer(iBad); if (AfxGetApp() && AfxGetApp()->GetDataRecoveryHandler()) { // remove "[recovered]" from the title if it exists CString strNormalTitle = AfxGetApp()->GetDataRecoveryHandler()->GetNormalDocumentTitle(this); if (!strNormalTitle.IsEmpty()) newName = strNormalTitle; } // append the default suffix if there is one CString strExt; if (pTemplate->GetDocString(strExt, CDocTemplate::filterExt) && !strExt.IsEmpty()) { ASSERT(strExt[0] == '.'); int iStart = 0; newName += strExt.Tokenize(_T(";"), iStart); } } if (!AfxGetApp()->DoPromptFileName(newName, bReplace ? AFX_IDS_SAVEFILE : AFX_IDS_SAVEFILECOPY, OFN_HIDEREADONLY | OFN_PATHMUSTEXIST, FALSE, pTemplate)) return FALSE; // don't even attempt to save } CWaitCursor wait; if (!OnSaveDocument(newName)) { if (lpszPathName == NULL) { // be sure to delete the file TRY { CFile::Remove(newName); } CATCH_ALL(e) { TRACE(traceAppMsg, 0, "Warning: failed to delete file after failed SaveAs.\n"); DELETE_EXCEPTION(e); } END_CATCH_ALL } return FALSE; } // reset the title and change the document name if (bReplace) { SetPathName(newName); OnDocumentEvent(onAfterSaveDocument); } return TRUE; // success }
BOOL CDocManager::DoPromptFileName(CString& fileName, UINT nIDSTitle, DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate) { CFileDialog dlgFile(bOpenFileDialog, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, NULL, NULL, 0); CString title; ENSURE(title.LoadString(nIDSTitle)); dlgFile.m_ofn.Flags |= lFlags; CString strFilter; CString strDefault; if (pTemplate != NULL) { ASSERT_VALID(pTemplate); _AfxAppendFilterSuffix(strFilter, dlgFile.m_ofn, pTemplate, &strDefault); } else { // do for all doc template POSITION pos = m_templateList.GetHeadPosition(); BOOL bFirst = TRUE; while (pos != NULL) { pTemplate = (CDocTemplate*)m_templateList.GetNext(pos); _AfxAppendFilterSuffix(strFilter, dlgFile.m_ofn, pTemplate, bFirst ? &strDefault : NULL); bFirst = FALSE; } } // append the "*.*" all files filter CString allFilter; VERIFY(allFilter.LoadString(AFX_IDS_ALLFILTER)); strFilter += allFilter; strFilter += (TCHAR)'\0'; // next string please strFilter += _T("*.*"); strFilter += (TCHAR)'\0'; // last string dlgFile.m_ofn.nMaxCustFilter++; dlgFile.m_ofn.lpstrFilter = strFilter; dlgFile.m_ofn.lpstrTitle = title; dlgFile.m_ofn.lpstrFile = fileName.GetBuffer(_MAX_PATH); INT_PTR nResult = dlgFile.DoModal(); fileName.ReleaseBuffer(); return nResult == IDOK; }
CFileDialog dlgFile(FALSE, _T("md"), NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT | OFN_PATHMUSTEXIST | OFN_LONGNAMES, _T("Markdown (*.md)|*.md|") _T("Text (*.txt)|*.txt|") _T("HTML (*.html;*.htm)|*.html;*htm|") _T("全てのファイル(*.*)|*.*||"), NULL, 0); CString title; ENSURE(title.LoadString(bReplace ? AFX_IDS_SAVEFILE : AFX_IDS_SAVEFILECOPY)); dlgFile.m_ofn.lpstrTitle = title; dlgFile.m_ofn.lpstrFile = newName.GetBuffer(MAX_PATH); INT_PTR nResult = dlgFile.DoModal(); newName.ReleaseBuffer(); if (IDOK != nResult) return FALSE;CFileDialogクラスのコンストラクタ関数で、第二引数にデフォルトの拡張子を設定しておくと、
#include <UrlMon.h> CoInternetSetFeatureEnabled( FEATURE_DISABLE_NAVIGATION_SOUNDS, SET_FEATURE_ON_PROCESS, TRUE);
enum _tagINTERNETFEATURELIST{ FEATURE_OBJECT_CACHING = 0, FEATURE_ZONE_ELEVATION, FEATURE_MIME_HANDLING, FEATURE_MIME_SNIFFING, FEATURE_WINDOW_RESTRICTIONS, FEATURE_WEBOC_POPUPMANAGEMENT, FEATURE_BEHAVIORS, FEATURE_DISABLE_MK_PROTOCOL, FEATURE_LOCALMACHINE_LOCKDOWN, FEATURE_SECURITYBAND, FEATURE_RESTRICT_ACTIVEXINSTALL, FEATURE_VALIDATE_NAVIGATE_URL, FEATURE_RESTRICT_FILEDOWNLOAD, FEATURE_ADDON_MANAGEMENT, FEATURE_PROTOCOL_LOCKDOWN, FEATURE_HTTP_USERNAME_PASSWORD_DISABLE, FEATURE_SAFE_BINDTOOBJECT, FEATURE_UNC_SAVEDFILECHECK, FEATURE_GET_URL_DOM_FILEPATH_UNENCODED, FEATURE_TABBED_BROWSING, FEATURE_SSLUX, FEATURE_DISABLE_NAVIGATION_SOUNDS, FEATURE_DISABLE_LEGACY_COMPRESSION, FEATURE_FORCE_ADDR_AND_STATUS, FEATURE_XMLHTTP, FEATURE_DISABLE_TELNET_PROTOCOL, FEATURE_FEEDS, FEATURE_BLOCK_INPUT_PROMPTS, FEATURE_ENTRY_COUNT } INTERNETFEATURELIST;
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) { // 分割ウィンドウの作成 m_wndSplitter.CreateStatic(this, 1, 2); // Create FirstView CRuntimeClass* firstViewClass = RUNTIME_CLASS( CFirstView); pContext->m_pNewViewClass = firstViewClass; m_wndSplitter.CreateView(0,0, pContext->m_pNewViewClass, CSize(0,0), pContext); // Create SecondView CRuntimeClass* secondViewClass = RUNTIME_CLASS(CSecondView); pContext->m_pNewViewClass = secondViewClass; m_wndSplitter.CreateView(0,1, pContext->m_pNewViewClass, CSize(0,0), pContext); return TRUE; }
BOOL CMyApp::InitInstance() { CWinAppEx::InitInstance(); // SDI CSingleDocTemplate* pDocTemplate = new CSingleDocTemplate( IDR_MAINFRAME, RUNTIME_CLASS(CMyDoc), RUNTIME_CLASS(CMainFrame), NULL); // ViewにNULLを渡しておく if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); return TRUE; }
$ svn --force export http://apt-cyg.googlecode.com/svn/trunk/ /bin/;chmod +x /bin/apt-cyg
$ apt-cyg install openssh
$ apt-cyg install git
$ apt-cyg install ruby
hGroup = CreateWindowEx( 0, "BUTTON", "GroupBox", WS_CHILD | WS_VISIBLE | BS_GROUPBOX | WS_CLIPSIBLINGS, GroupX, GroupY GroupW, GroupH, hParent, (HMENU)GroupID, NULL, NULL); hRadio = CreateWindowEx( 0, "BUTTON", "RadioButton", WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, RadioX, RadioY, RadioW, RadioH, hParent, (HMENU)RadioID, NULL, NULL);
#include <sqlite3.h> #include <iostream> using namespace std; int main(int argc, char* argv[]) { sqlite3* db; int result = sqlite3_open("db.sqlite3", &db); if (result != SQLITE_OK){ cerr << sqlite3_errmsg(db) << endl; return -1; } cout << "接続成功!!" << endl; sqlite3_close(db); return 0; }