Thank you
wangyiming
Posts
-
how set Cursor spot Position? -
how set Cursor spot Position?how set Cursor spot posotion at Center of the Cursor, not at (0,0)? SetCursor( AfxGetApp()->LoadCursor(IDC_CURSOR1)); .... Thank you!
-
Pointer in a .txt file?1. whether the length of bufLine1 is more than 22, if not, the pointer(pNext1) maybe is out of control 2. you can use substr function
-
How can I get the net adapter address?Just want to get the adapter unique id! Thank you
-
How can I get the net adapter address?How can I get the net adapter address? all the adapter is validate, but at some machine, I can get the adapter address, at some machine, I cann't (address is all Zero). The codes: ----------------------------------------------------------- #include typedef struct _ASTAT_ { ADAPTER_STATUS adapt; NAME_BUFFER NameBuff[30]; } ASTAT; void getNetID() { NCB ncb; UCHAR ch; memset(&ncb,0,sizeof(ncb)); ncb.ncb_command = NCBRESET; ch = Netbios(&ncb); // at some machine, ch = NRC_BRIDGE 0x23 // ncb_lana_num field invalid memset(ncb.ncb_callname,' ',sizeof(ncb.ncb_callname)); ncb.ncb_callname[0] = '*'; //lstrcpy(ncb.ncb_callname,"* "); ncb.ncb_command = NCBASTAT; ASTAT AST; ncb.ncb_lana_num = 0; ncb.ncb_length = sizeof(AST); long *pASTAT; pASTAT = (long *)HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY, ncb.ncb_length); if ( pASTAT == 0 ) { AfxMessageBox("memory allocation failed!"); return; } ncb.ncb_buffer = (unsigned char *)pASTAT; ch = Netbios(&ncb); CopyMemory(&AST, ncb.ncb_buffer, sizeof(ASTAT)); CString str( _T("") ); for(int i=0; i<6; i++) { if( i > 0 ) str += ' '; unsigned char c = (unsigned char)AST.adapt.adapter_address[i]; unsigned char m = (c>>4)&0xf; unsigned char n = c&0xf; str += (m>=10) ? (char)('A'+(m-10)) : (char)('0'+m); str += (n>=10) ? (char)('A'+(n-10)) : (char)('0'+n); } HeapFree(GetProcessHeap(), 0, pASTAT); AfxMessageBox( str ); } --------------------------------------- What's wrong? Thanks
-
Modifying CDocument Member Objects :: MFCCString cStr = "testing"; string temp = ""; char p[80]; strcpy(p,"testing"); temp = p; memset(p,0,sizeof(p)); // or temp = cStr; AfxMessageBox( temp.c_str() ); char szBuffer[80]; strcpy(szBuffer, temp.c_str() ); AfxMessageBox( szBuffer ); ------------------------------- both show messageBox "testing"
-
Tabs and List Control Box??I try it. no problems! maybe you should look: 1. use IsBOF before while ( oracle happen error when the recordset is empty) 2. sure Close Database at any condition
-
Multi subitem selection Tree controlplease see: http://www.codeguru.com/mfc/comments/26400.shtml
-
Modifying CDocument Member Objects :: MFCDid you run the program in Debug mode? please try run in Release mode! or in Debug mode: ----------------------------- if( array.GetSize() > 0 ) array.RemoveAll();
-
Inhibe the ENTER and ESC KEYS ?void CMyDialog::OnOk() { } void CMyDialog::OnCancel() { }
-
CRecordset and Oracle 8Maybe oracle only support open with: CRecordset::forwardOnly
-
Formatting rebarsDo you want to embed word control into a Dialog? If: I can send a app to you!
-
Formatting rebarsDo you want to embed word control into a Dialog? If: you can send a app to you!
-
calling CDatabase in a worker thread*.h -------------------------------------- class CAutoObList : public CObject { public: CAutoObList() { size = 10; p = new int[size]; for(int i=0; iSuspendThread(); delete pThread; pThread = NULL; } } void testThread(); }; *.cpp -------------------------------------------------------- CAutoObList autoList; UINT CAutoObListThread(LPVOID object) { // A *pA = ((A*) object); for(;;) { autoList.Output(); Sleep( 2000 ); } return 0; } void A::testThread() { if( pThread == NULL ) pThread = AfxBeginThread(CAutoObListThread, this,THREAD_PRIORITY_HIGHEST); } output: ----------------- 0: 0 1: 1 ... 9: 9 hope can help!
-
How can get the CPU unique ID?Thank you very much
-
How can get the CPU unique ID?Thanks
-
How to save DC's content as bitmap!CBitmap m_pGenBitmap = new CBitmap(); CClientDC dc(NULL); int nWidth = 128; int nHeight = 128; HDC hDCScreen = dc.GetSafeHdc(); HBITMAP hbm = ::CreateCompatibleBitmap(hDCScreen,nWidth,nHeight); if (hbm != NULL) { HDC hDCGlyphs = ::CreateCompatibleDC(hDCScreen); HBITMAP hbmOld = (HBITMAP)::SelectObject(hDCGlyphs, hbm); CDC *pDC2 = CDC::FromHandle(hDCGlyphs); CRect r(0,0,nWidth,nWidth); // your owner draw pDC2->FillRect(&r,&CBrush(RGB(0xff,0xff,0xff))); m_pFillUnit->Draw(pDC2,&r,0); // end SelectObject(hDCGlyphs, hbmOld); m_pGenBitmap->m_hObject = hbm; ::DeleteDC(hDCGlyphs); } return m_pGenBitmap;
-
how can get the CPU info!Thank you
-
how can get the CPU info!how can get the CPU unique id? Thanks
-
how draw Region border with pen style?I get region by: CombineRgn or CreateRectRgn ... or Create a standard region, then rotate it Thanks