第ï¼åãæ¥ã¦ãã¾ãã¾ããã第ï¼åããï¼å¹´ãããã§ããããï¼ ç§ãMFCã§å¶å¾¡ç³»ã®ã¢ããªããããããç¾½ç®ã«ãªããã®éã®ãã¯ããã¯ãªã©ãããã¨ãã¾ãã MFCã§ã¹ã¬ããã使ã MFCã§ã¹ã¬ããã使ãã«ã¯ AfxBeginThread ãå©ç¨ãã¦CWinThreadåã®ãªãã¸ã§ã¯ããä½ãããã§ãããéä¿¡ã¢ããªã¨ãå¶å¾¡ç³»ã®ã¢ããªã®å ´åãã°ãã°ãã¹ã¬ããã®çµäºãå¾ ã¡ããï¼ãã¨è¨ãè¦æ±ãçºçãã¾ããã§ããã®ããæ¹ã§ãã class CHogeHoge { public: CHogeHoge(); // ã³ã³ã¹ãã©ã¯ã¿ ~CHogeHoge(); // ãã¹ãã©ã¯ã¿ void Start(void); // ã¹ã¬ããã®éå§ void Stop(void); // ã¹ã¬ããã®çµäº protected: static UINT ThreadEntry(LPVOID pParam); // ã¹ã¬ããéå§ä½ç½®
æ»ã 32ãããã¢ããªã±ã¼ã·ã§ã³ãä½æããããã®ç°å¢ãæ´ãï¼16ããã ã¢ããªã±ã¼ã·ã§ã³ãæ°è¦ã«ä½æãããã¨ã¯å°ãªããªã£ã¦ãã¦ããã®ã§ã¯ãªãã㨠æããã¾ãï¼16ãããã¢ããªã±ã¼ã·ã§ã³ã¨ç°ãªãï¼32ãããã§ã¯å®å ¨ãª ï¼ããªã¨ã³ãã£ããªï¼ãã«ãã¹ã¬ããã»ãã«ãã¿ã¹ã¯ã§ããã»ã¹ãå®è¡ã§ããããã« ãªã£ã¦ãã¾ãï¼ ãããï¼æè¿ã¹ã¬ããã®ä½¿ãæ¹ã誤ããã¨ã«ãããã©ãã«ãããè¦æã ã¾ãï¼ã¹ã¬ããã使ãæ¹ãééããã¨ã·ã¹ãã ã®ããã©ã¼ãã³ã¹ãä½ä¸ããããï¼ ã·ã¹ãã ãªã½ã¼ã¹ãä¸å¿ è¦ã«æ¶è²»ããã¦ãã¾ãã¾ãï¼ã¾ãï¼åã¹ã¬ããã§å ±æãã ã·ã¹ãã ãªã½ã¼ã¹ãï¼ããããã®ã¹ã¬ãããåæã«ç ´æ£ãããï¼ã¹ã¬ãããä½ãã®å¦ç ãè¡ã£ã¦ããéä¸ã§ããã»ã¹ãçµäºãã¦ãã¾ãã¨ä½ãèµ·ãããåããã¾ããï¼ ããã§ï¼åºæ¬çãªã¹ã¬ããã®æ±ãã«ã¤ãã¦ã¾ã¨ãã¦ã¿ããã¨æãã¾ãï¼ 19-1 ã¹ã¬ããã¨ã¯ ãã¾ããã¹ã¬ããã説æãããã¨
ãã¹ã¬ããããããã¯ãå¦çåä½ãã®ãã¨ã§ãã å®è¡ãããã¢ããªã±ã¼ã·ã§ã³ã²ã¨ã¤ã²ã¨ã¤ããããã»ã¹ãã¨å¼ã³ã¾ããããã»ã¹ã¯æåã«ã¹ã¬ãããã²ã¨ã¤æã¡ã¾ããã¦ã£ã³ãã¦ãããã¤ãä½ããã¦ã£ã³ãã¦ããã·ã¼ã¸ã£ãè¤æ°ãã£ã¦ããã¹ã¬ãããåããªãã¡ãã»ã¼ã¸ã¯ã²ã¨ã¤ã²ã¨ã¤å¦çããã¾ãã ãã®åé¡ã¯ã¦ã¼ã¶ã¼ã¤ã³ã¿ã¼ãã§ã¤ã¹ãèããæãªãã¾ããä¾ãã°ã¦ã£ã³ãã¦ã®ããã¤ã¹ã³ã³ããã¹ãã«è¤éãªæç»ãããã¨ãã¾ããæç»ã«æéãæããããããã¼ã«ããã¯ã¹ã«ãåæ¢ããã¿ã³ãä½è£½ãã¾ããããã¦ãããæç»ãã·ã³ã°ã«ã¹ã¬ãããã¤ã¾ãããæ®éã«å¦çããå ´åãææªãæç»ä¸ã«ã¯ãã®ãã¿ã³ãæ¼ããã¨ããä¸å¯è½ã«ãªãã¾ãã ãã®åé¡ã解決ããæ¹æ³ãããã«ãã¹ã¬ããã§ããæ°ãã«ã¹ã¬ãããä½è£½ãããã®ã¹ã¬ããã®ä¸ã§ã¡ã¢ãªããã¤ã¹ã³ã³ããã¹ãã¸ã®æç»ããããæå¾ã«ã¦ã£ã³ãã¦ããã¤ã¹ã³ã³ããã¹ãã¸ã¨ã³ãã¼ãã¦ã¹ã¬ãããçµäºããããã¨ããæ¹æ³
ã¢ããªä½æã®ç¬¬ä¸æ©ã¯ããããã°åºåã¦ã£ã³ãã¦ã«æååãåºåããããã¨ã§ããå¿ ãããããã§ããã¨ã¯è¨ãã¾ããããããã§ã¯ãããã°ç¨ã®åºåã¦ã£ã³ãã¦ã«æååãåºåãããæ¹æ³ã¨ãã«ãã´ãªã¨ã¬ãã«ã«ããåºåã®å¶å¾¡æ¹æ³ã«ã¤ãã¦èª¬æãã¾ãã OutputDebugString é¢æ° OutputDebugString é¢æ°ã¯ãååã®éããããã°æååãåºåãã¾ãããã®é¢æ°ã¯ããããã°ãã«ãã ãã§ã¯ãªãããªãªã¼ã¹ãã«ãã®ã¨ãããåºåããã¾ãã OutputDebugString(_T("for debug\n")); ãããã°ãã«ãæã®ã¿æååãåºåãã ãªãªã¼ã¹ãã«ãã®å ´åã«ãåºåã¦ã£ã³ãã¦ã«æååãåºåãããããã¨ããªããã°ãTRACE ã¾ãã¯Â ATLTRACE2 ãã¯ãã使ã£ã¦ããããã°ãã«ãæã®ã¿åºåã¦ã£ã³ãã¦ã«æååãåºåããããã¨ãã§ãã¾ãã æ¬ãã¯ã㯠printf é¢æ°ã®ããã«ãåºåæå
ã¹ã¿ãã£ãã¯ããã¹ãã®ãµã¤ãºå¤æ´ã«ã¤ãã¦ã ã¹ã¿ãã£ãã¯ããã¹ãã®æ¨ªå¹ ãµã¤ãºããæ ¼ç´ãããæååã«ãã èªåã§ãµã¤ãºãå¤ããããã«ãããã®ã§ããããªããªãä¸æãããã¾ããã ã©ãªãããæ示ãã ããã ãããããé¡ãè´ãã¾ãã ç°å¢ï¼VC++ãMFC /*表示*/ CString test; test.Format("ã%5s:%6s,%s%s%sã",test1,test2,test3,test4,test5) ; //CWindowDC dc(this); //CSize sizesize = dc.GetTextExtent(m_ddx_v_com_info); //CEdit* editedit = (CEdit*)GetDlgItem(IDC_STATIC_COM_INFO); //editedit->SetWindowPos(editedit,0,0,sizesize.cx-96
æ¨ªå¹ ãããããå¤ãããè¤æ°è¡è¡¨ç¤ºå¯è½ãªã¨ãã£ããã³ã³ããã¼ã«ããæååã«ãããã¦ãé«ãã調ç¯ãããã DrawText é¢æ°ã«ã DT_CALCRECT ãã©ã°ãè¨å®ãããã¨ã§ãæå®ããå¹ ã«åã¾ãæååã表示ããã®ã«å¿ è¦ãªç©å½¢ã®åå¾ã ãããããã¨ãã§ãã(æç»ãããªã)ã ã³ã¬ã使ã£ã¦ã³ã³ããã¼ã«ã®é«ããè¨ç®ãç´ãã°å®ç¾ã§ããã ä¸ã®ã¨ãã£ããã³ã³ããã¼ã«ãæ¸ãæããã¨ããã®æååãä¸ã®ã¨ãã£ããã³ã³ããã¼ã«ã«åæ ããããµã¤ãºãå¤æ´ããããããªãµã³ãã«ãä½ã£ãã ã°ãã°ã ATL/WTL 使ã£ãã³ã¼ãã ããåºæ¬çã«æ®éã«Win32APIå¼ãã§ãåãããã«ã§ããã äºã¤ã®ã¨ãã£ããã³ã³ããã¼ã«( IDC_EDIT1 㨠IDC_EDIT2 )ãããããããCEditã«ã¢ã¿ãããã¦ãã( CEdit ce1 㨠CEdit ce2 )ã ã¨ããããããµã¤ãºãå¤æ´ãããã¨ãã¨ãIDC_EDIT1
CreateProcess()çã§ç»é¢ãæã¤ï¼¡ï¼°èµ·åããå ´åã«ã ãã©ã¼ã«ã¹ãã¡ã¤ã³ã®ã¦ã£ã³ãã¦ããèµ·åããAPã¸ç§»åãã¦ãã¾ãã ã¾ããå½ããåã§ã¯ãããããã®åé¿æ¹æ³ãªã SDK ç void SetAbsoluteForegroundWindow(HWND hWnd) { int nTargetID, nForegroundID; DWORD sp_time; // ãã©ã¢ã°ã©ã¦ã³ãã¦ã£ã³ãã¦ãä½æããã¹ã¬ããã®IDãåå¾ nForegroundID = GetWindowThreadProcessId(GetForegroundWindow(), NULL); // ç®çã®ã¦ã£ã³ãã¦ãä½æããã¹ã¬ããã®IDãåå¾ nTargetID = GetWindowThreadProcessId(hWnd, NULL ); // ã¹ã¬ããã®ã¤ã³ãããç¶æ ãçµã³ä»ãã AttachThread
æå®ãããã¦ã£ã³ãã¦ã®è¡¨ç¤ºç¶æ ãè¨å®ãã¾ãã BOOL ShowWindow( HWND hWnd, // ã¦ã£ã³ãã¦ãã³ãã« int nCmdShow // 表示ç¶æ ); USER32.DLL å¼æ° hWnd 表示ç¶æ ãå¤æ´ããã¦ã£ã³ãã¦ã®ãã³ãã«ãæå®ãã¾ãã nCmdShow ã¦ã£ã³ãã¦ã®è¡¨ç¤ºç¶æ ãæå®ãã¾ããã¢ããªã±ã¼ã·ã§ã³ãèµ·åããããã»ã¹ããèµ·åæã« STARTUPINFO æ§é ä½ãæä¾ãã¦ããå ´åã«ã¯ãã¢ããªã±ã¼ã·ã§ã³ãæåã«å¼ã³åºãã ShowWindow é¢æ°ã§ã¯ãã®ãã©ã¡ã¼ã¿ã¯ç¡è¦ããã¾ãã以ä¸ã®å¤ã®ãããããæå®ãã¾ãããã以å¤ã®å ´åãã¢ããªã±ã¼ã·ã§ã³ãæåã«å¼ã³åºã ShowWindow é¢æ°ã«ã¯ã WinMain é¢æ°ã® nCmdShow ãã©ã¡ã¼ã¿ã®å¤ãæå®ããã¹ãã§ãããã以éã®å¼ã³åºãã§ã¯ã以ä¸ã®å¤ã®ãããããæå®ãããã¨ãã§ãã¾ãã å¤ æå³
ã¡ãã»ã¼ã¸ãããã¸ã®ãã¡ãã»ã¼ã¸ãã¯ãã®è¿½å BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) ON_WM_CREATE() // ã¡ãã»ã¼ã¸ãã¯ã ON_WM_PAINT() // END_MESSAGE_MAP() ã¡ãã»ã¼ã¸ ããã (MFC) | MSDN BEGIN_MESSAGE_MAPã®ãã©ã¡ã¼ã¿ã§ã¯ãã¡ãã»ã¼ã¸ããããã©ã®ã¦ã£ã³ãã¦ã«å±ããããæå®ãã¾ãã BEGIN_MESSAGE_MAP( ããããå±ããã¯ã©ã¹å, ããããå±ããã¯ã©ã¹ã®åºæ¬ã¯ã©ã¹å ) BEGIN_MESSAGE_MAP | MSDN ã¦ã£ã³ãã¦ã¯ã©ã¹ã¸ã®ãã¡ãã»ã¼ã¸ãã³ãã©ã®è¿½å ã¡ãã»ã¼ã¸ãã³ãã©ã®ãããã¿ã¤ãããã¯ã©ã¹å®£è¨ã«è¨è¿°ãã¾ãã class CMainFrame : public CFrameWnd { CMainFrame(); protected: a
追è¨ã ã³ã³ãã¤ã«ããã¦ãã¾ããããã¨ã©ã¼ãã§ãã¯ãæå°éã®ãã®ã¨ãªã£ã¦ããã®ã§ã注æãã¦ãã ããã ã¯ãªãããã¼ãã¸ã®ã³ãã¼ã«ã¤ãã¦ã¯ãCWnd::OpenClipboard() ã®ãªãã¡ã¬ã³ã¹ã«ãµã³ãã«ã½ã¼ã¹ãåºã¦ãã¾ãã®ã§ãã¨ã©ã¼å¦çãªã©ã¯ãã¡ããåèã«ãã¦ãã ããã ãããã¾åç,Microsoft MVP for Visual C++(Oct 2005-) http://blogs.wankuma.com/tocchann/ ãªã¼ã¯ãããã¤ããéè¤åé¤ãããã¤ãããã ã¾ããããhdcScreen ã¯ãCClientDC ãå®ä½ç®¡çãã¦ãã¾ãã®ã§ãåé¤ãã¦ã¯ããã¾ããã ã¾ããç¾è¡OSãªããDeleteDCãã¨ã©ã¼ãè¿ãã¦ããã¨æããªã³ã§ãããããªããã¨ã¯ãªãã§ããããã©ããã ããã¨ãhBitmap ãåé¤ããã¦ãã¾ããã ãã¡ãã¯ãã¯ãªãããã¼ãã«ã³ãã¼ããå¾å©ç¨ããªããªãã
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}