Exemplo n.º 1
0
void AFXAPI DDX_Control(CDataExchange* pDX, int nIDC, CWnd& rControl)
{
	if (rControl.m_hWnd == NULL)    // not subclassed yet
	{
		ASSERT(!pDX->m_bSaveAndValidate);

		HWND hWndCtrl = pDX->PrepareCtrl(nIDC);

		if (!rControl.SubclassWindow(hWndCtrl))
		{
			ASSERT(FALSE);      // possibly trying to subclass twice?
			AfxThrowNotSupportedException();
		}
#ifndef _AFX_NO_OCC_SUPPORT
		else
		{
			// If the control has reparented itself (e.g., invisible control),
			// make sure that the CWnd gets properly wired to its control site.
			if (pDX->m_pDlgWnd->m_hWnd != ::GetParent(rControl.m_hWnd))
				rControl.AttachControlSite(pDX->m_pDlgWnd);
		}
#endif //!_AFX_NO_OCC_SUPPORT

	}
}
Exemplo n.º 2
0
void CStdioFile::UnlockRange(DWORD /* dwPos */, DWORD /* dwCount */)
{
	ASSERT_VALID(this);
	ASSERT(m_pStream != NULL);

	AfxThrowNotSupportedException();
}
COXFileWatcher::COXFileWatcher(BOOL bAddBackupPrivilege/*=TRUE*/) :
	m_hrError(ERROR_SUCCESS),
	m_bThreadIsRunning(FALSE),
	m_mxThreadShouldStop(TRUE),
	m_mxThreadStopped(FALSE),
	m_mxThreadCanContinue(FALSE),
	m_eventStartThread(FALSE,TRUE,NULL,NULL),
	m_pHandles(NULL),
	m_pNewHandles(NULL),
	m_pWatcherThread(NULL),
	m_nNumHandles(0),
	m_bDeletingThread(FALSE)
{
#if defined(_WIN32_WINNT)
	if(bAddBackupPrivilege)
	{
		if(!SetBackupPrivilege(TRUE))
		{
			AfxThrowNotSupportedException();
		}
	}
#else
	UNREFERENCED_PARAMETER(bAddBackupPrivilege);
#endif
}
Exemplo n.º 4
0
CFile* CConverter::Duplicate() const
{
	AfxThrowNotSupportedException();
#if _MSC_VER < 1400
	return NULL;
#endif
}
Exemplo n.º 5
0
BOOL CMFCControlContainer::ReSubclassControl(HWND hWndCtrl, WORD nIDC, CWnd& control)
{
	if (hWndCtrl == NULL)
	{
		return FALSE;
	}

	int nIndex = -1;
	for (int i = 0; i < m_arSubclassedCtrls.GetCount(); i++)
	{
		CWnd* pWnd = (CWnd*)m_arSubclassedCtrls [i];
		if (pWnd->GetSafeHwnd() == hWndCtrl)
		{
			nIndex = i;
			break;
		}
	}

	if (nIndex != -1)
	{
		CWnd* pWnd = DYNAMIC_DOWNCAST(CWnd, m_arSubclassedCtrls [nIndex]);
		
		if (pWnd->GetSafeHwnd() != NULL)
		{
			ASSERT_VALID(pWnd);

			// get init state
			DWORD dwSize = 0;
			BYTE* pbInitData = NULL;
			GetControlData(nIDC, dwSize, pbInitData);

			// Free old subclassed control:
			m_arSubclassedCtrls [nIndex] = NULL;

			// unsubclass
			PreUnsubclassControl(pWnd);
			VERIFY(pWnd->UnsubclassWindow() == hWndCtrl);
			// destroy
			delete pWnd;

			// subclass
			if (!control.SubclassWindow(hWndCtrl))
			{
				ASSERT(FALSE);      // possibly trying to subclass twice?
				AfxThrowNotSupportedException();
			}

			// set init state
			if (dwSize > 0)
			{
				control.SendMessage(WM_MFC_INITCTRL, (WPARAM)dwSize, (LPARAM)pbInitData);
			}

			return TRUE;
		}
	}

	return FALSE;
}
Exemplo n.º 6
0
CFile* CStdioFile::Duplicate() const
{
	ASSERT_VALID(this);
	ASSERT(m_pStream != NULL);

	AfxThrowNotSupportedException();
	return NULL;
}
Exemplo n.º 7
0
void CDoc::Serialize(CArchive& ar)
{
	AfxThrowNotSupportedException();

	if (ar.IsStoring())
	{
		// TODO: 格納するコードをここに追加してください。
	}
	else
	{
		// TODO: 読み込むコードをここに追加してください。
	}
}
Exemplo n.º 8
0
void DDX_FileTreeControl(CDataExchange* pDX, int nIDC, CTreeFileCtrl& ctrlFileTree, DWORD dwFlags)
{
  HWND hWndCtrl = pDX->PrepareCtrl(nIDC);
  if (!pDX->m_bSaveAndValidate && ctrlFileTree.m_hWnd == NULL) // not subclassed yet
  {
    if (!ctrlFileTree.SubclassWindow(hWndCtrl))
    {
      ASSERT(FALSE);      // possibly trying to subclass twice ?
      AfxThrowNotSupportedException();
    }
  }
  ctrlFileTree.SetFlags(dwFlags);
}
Exemplo n.º 9
0
void DDV_FileEditCtrl(CDataExchange *pDX, int nIDC)
{
	// verify the files or folder entered actually exists
	// verify that files are entered when looking for files
	// and that folders are entered when looking for folders
	CWnd *pWnd = pDX->m_pDlgWnd->GetDlgItem(nIDC);
	if(!pWnd->IsKindOf(RUNTIME_CLASS(CFileEditCtrl)))	// is this control a CFileEditCtrl control?
	{
		TRACE (_T("Control %d not subclassed to CFileEditCtrl, must first call DDX_FileEditCtrl()"),nIDC);
		ASSERT(FALSE);
		AfxThrowNotSupportedException();
	}
	if(!pDX->m_bSaveAndValidate)				// not saving data
		return;

	if ( !pWnd->IsWindowEnabled() )
		return;

	CFileEditCtrl *pFEC = (CFileEditCtrl *)pWnd;
	pDX->PrepareEditCtrl(nIDC);
	POSITION pos = pFEC->GetStartPosition();
	if (!pos)
	{	// no name entered
		AfxMessageBox(FEC_IDS_NOFILE);
		pDX->Fail();
	}
	while(pos)
	{
		CString szMessage;
		CString szFile = pFEC->GetNextPathName(pos);
		DWORD dwAttribute = GetFileAttributes(szFile);
		if (dwAttribute == 0xFFFFFFFF)			// GetFileAttributes() failed
		{										// does not exist
			szMessage.Format(FEC_IDS_NOTEXIST, szFile);
			AfxMessageBox(szMessage);
			pDX->Fail();
		}
		if (pFEC->GetFindFolder() && !(dwAttribute & FILE_ATTRIBUTE_DIRECTORY))
		{										// not a folder
			szMessage.Format(FEC_IDS_NOTFOLDER, szFile);
			AfxMessageBox(szMessage);
			pDX->Fail();
		}
		if (!pFEC->GetFindFolder() && dwAttribute & FILE_ATTRIBUTE_DIRECTORY)
		{										// not a file
			szMessage.Format(FEC_IDS_NOTFILE, szFile);
			AfxMessageBox(szMessage);
			pDX->Fail();
		}
	}
}
Exemplo n.º 10
0
void DDX_GetFileControl(CDataExchange* pDX, int nIDC, CGetFileControl& rCGetFileControl, DWORD dwFlags, const CUString& strExt)
{
	HWND hWndCtrl = pDX->PrepareEditCtrl(nIDC);
	if (!pDX->m_bSaveAndValidate && rCGetFileControl.m_hWnd == NULL)    // not subclassed yet
	{
		if (!rCGetFileControl.SubclassEdit(hWndCtrl))
		{
			ASSERT(FALSE);      // possibly trying to subclass twice ?
			AfxThrowNotSupportedException();
		}
	}

	rCGetFileControl.SetFlags(dwFlags, strExt );
}
Exemplo n.º 11
0
CIPEnum::CIPEnum()
{
  m_bWinsockInitialied = FALSE;

  //Initialise the winsock stack
  WORD wVersionRequested = MAKEWORD(1, 1);  
  WSADATA wsaData; 
  int err = WSAStartup(wVersionRequested, &wsaData); 
  if (err != 0) 
  {
    TRACE(_T("Failed in call to WSAStartup, return value was %d\n"), err);
    AfxThrowNotSupportedException();
  }

  //remember that we have opened winsock
  m_bWinsockInitialied = TRUE;

  //Code requires at least Winsock 1.1
  if ((LOBYTE(wsaData.wVersion) != 1) || (HIBYTE(wsaData.wVersion) != 1)) 
  { 
    TRACE(_T("Failed to find a usable winsock stack which supports Winsock 1.1\n"));
    AfxThrowNotSupportedException();
  } 
}
Exemplo n.º 12
0
CWnd* CDataExchange::PrepareOleCtrl(int nIDC)
{
	ASSERT(nIDC != 0);
	ASSERT(nIDC != -1); // not allowed
	CWnd* pWndCtrl = m_pDlgWnd->GetDlgItem(nIDC);
	if ((pWndCtrl == NULL) || (pWndCtrl->m_hWnd == NULL))
	{
		TRACE1("Error: no data exchange control with ID 0x%04X\n", nIDC);
		ASSERT(FALSE);
		AfxThrowNotSupportedException();
	}
	m_hWndLastControl = pWndCtrl->m_hWnd;
	m_bEditLastControl = FALSE; // not an edit item by default
	return pWndCtrl;
}
Exemplo n.º 13
0
HWND CDataExchange::PrepareCtrl(int nIDC)
{
	ASSERT(nIDC != 0);
	ASSERT(nIDC != -1); // not allowed
	HWND hWndCtrl;
	m_pDlgWnd->GetDlgItem(nIDC, &hWndCtrl);
	if (hWndCtrl == NULL)
	{
		TRACE1("Error: no data exchange control with ID 0x%04X.\n", nIDC);
		ASSERT(FALSE);
		AfxThrowNotSupportedException();
	}
	m_hWndLastControl = hWndCtrl;
	m_bEditLastControl = FALSE; // not an edit item by default
	ASSERT(hWndCtrl != NULL);   // never return NULL handle
	return hWndCtrl;
}
Exemplo n.º 14
0
void DDX_FileEditCtrl(CDataExchange *pDX, int nIDC, CString& rStr, BOOL bFindFolder)
{
	// Subclasses the edit control with Id nIDC. Coordinates the window text
	// with the CString. bFindFolder determines if the control is used to
	// browse for files or folders.
	CWnd *pWnd = pDX->m_pDlgWnd->GetDlgItem(nIDC);
	if (pDX->m_bSaveAndValidate)				// update string with text from control
	{
		// ensure the control is a CFileEditCtrl control
		if (pWnd->IsKindOf(RUNTIME_CLASS(CFileEditCtrl)))
		{
			// copy the first file listed in the control to the string
			rStr.Empty();
			CFileEditCtrl *pFEC = (CFileEditCtrl *)pWnd;
			POSITION pos = pFEC->GetStartPosition();
			if (pos)
				rStr = pFEC->GetNextPathName(pos);
		}
	}
	else										// create the control if it is not already created
	{											// set the control text to the text in string
		CFileEditCtrl *pFEC = NULL;
		if (!pWnd->IsKindOf(RUNTIME_CLASS(CFileEditCtrl)))    // not subclassed yet
		{
			// create then subclass the control to the edit control with the ID nIDC
			HWND hWnd = pDX->PrepareEditCtrl(nIDC);
			pFEC = new CFileEditCtrl(TRUE);		// create the control with autodelete
			if (!pFEC->SubclassWindow(hWnd))
			{									// failed to subclass the edit control
				ASSERT(FALSE);
				AfxThrowNotSupportedException();
			}
			// Force a call to CFileEditCtrl::OnNcCalcSize() to calculate button size
			pFEC->SetWindowPos(NULL,0,0,0,0,SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
			// call CFileEditCtrl::FindFolder() to initialize the internal data structures
			pFEC->SetFindFolder(bFindFolder);
		}
		else									// control already exists
			pFEC = (CFileEditCtrl *)pWnd;
		if (pFEC)
			pFEC->SetWindowText(rStr);			// set the control text
	}
}
Exemplo n.º 15
0
void DDX_SliderButtonCtrl(CDataExchange *pDX, int nIDC, wcSliderButton &rCFEC, BOOL LeftBut)
{
	// Subclass the specified wcSliderButton class object to the edit control
	// with the ID nIDC. dwFlags is used to setup the control
	ASSERT (pDX->m_pDlgWnd->GetDlgItem(nIDC));
	if (rCFEC.m_hWnd == NULL)					// not yet subclassed
	{
		ASSERT (!pDX->m_bSaveAndValidate);
		// subclass the control to the edit control with the ID nIDC
		HWND hWnd = pDX->PrepareEditCtrl(nIDC);
		if (!rCFEC.SubclassWindow(hWnd))
		{										// failed to subclass the edit control
			ASSERT(FALSE);
			AfxThrowNotSupportedException();
		}
		// call wcSliderButton::SetFlags() to initialize the internal data structures
		rCFEC.SetLeftButton(LeftBut);
		// Force a call to wcSliderButton::OnNcCalcSize() to calculate button size
		rCFEC.SetWindowPos(NULL,0,0,0,0,SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
	}
}
Exemplo n.º 16
0
void DDX_FileEditCtrl(CDataExchange *pDX, int nIDC, CFileEditCtrl &rCFEC, BOOL bFindFolder)
{
	// Subclass the specified CFileEditCtrl class object to the edit control
	// with the ID nIDC. bFindFolder determines if the control is used to
	// browse for files or folders.
	if (rCFEC.m_hWnd == NULL)					// not yet subclassed
	{
		ASSERT (!pDX->m_bSaveAndValidate);
		// subclass the control to the edit control with the ID nIDC
		HWND hWnd = pDX->PrepareEditCtrl(nIDC);
		if (!rCFEC.SubclassWindow(hWnd))
		{										// failed to subclass the edit control
			ASSERT(FALSE);
			AfxThrowNotSupportedException();
		}
		// Force a call to CFileEditCtrl::OnNcCalcSize() to calculate button size
		rCFEC.SetWindowPos(NULL,0,0,0,0,SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
		// call CFileEditCtrl::FindFolder() to initialize the internal data structures
		rCFEC.SetFindFolder(bFindFolder);
	}
	else if (pDX->m_bSaveAndValidate)
		rCFEC.GetStartPosition();				// updates the data from the edit control
}
Exemplo n.º 17
0
HWND CDataExchange::PrepareCtrl(int nIDC)
{
	ASSERT(nIDC != 0);
	ASSERT(nIDC != -1); // not allowed
	HWND hWndCtrl;
   COleControlSite* pSite = NULL;
	m_pDlgWnd->GetDlgItem(nIDC, &hWndCtrl);
	if (hWndCtrl == NULL)
	{
	  // Could be a windowless OCX
	  pSite = m_pDlgWnd->GetOleControlSite(nIDC);
	  if (pSite == NULL)
	  {
		   TRACE(traceAppMsg, 0, "Error: no data exchange control with ID 0x%04X.\n", nIDC);
		   ASSERT(FALSE);
		   AfxThrowNotSupportedException();
	  }
	}
	m_idLastControl = nIDC;
	m_bEditLastControl = FALSE; // not an edit item by default

   return hWndCtrl;
}
Exemplo n.º 18
0
//	Daten importieren
void CImportOdbcData :: ImportData (void)
{               
//	prüfe externe Parameter
	ASSERT (g_pCOdbcExtension != NULL);

//	prüfe Import-Parameter
	if (!CanImport ())
	{								
		DEX_Error (RC_OdbcImport, EC_ILLPARS);
		return;
	}

//	Voreinstellungen machen
	CActivateWindow aw (g_pCOdbcExtension -> hWnd ());		//	Parent-Fenster deakt.

//	ODBC-Infos
	CDataBaseExt *pCDataBase = NULL;		// DataSource-Objekt
	CColumnObjArray *pCColList = NULL;		// Container mit Spalten-Infos
	CRecSet *pCRecSet = NULL;				// Record-Container 

	#ifdef WIN32
	IProgressIndicator *pIStatus = NULL;
	TRY
	{
	//	Status-Fenster erzeugen
		HRESULT hr = g_pCOdbcExtension -> m_pXtnSite -> CreateInstance (NULL, CLSID_ProgressIndicator,
                                            	    		IID_IProgressIndicator, (LPVOID*)&pIStatus);
		if (FAILED (hr)) 
			AfxThrowUserException ();
		HWND hNewWnd = pIStatus -> InitNew (g_pCOdbcExtension -> hWnd (), 0L);
    	if (NULL == hNewWnd) 
			AfxThrowUserException ();						

		hr = pIStatus -> Restart (0L, 1L, PIFLAG_CAPTION | PIFLAG_FILENAME | PIFLAG_FILE | PIFLAG_STATUS);

	//	1. Tabellen-Objekte Recherche durchführen
		CString strInfo;
		strInfo.LoadString (IDS_IMP_SEL_REC);			
		pIStatus -> ChangeText (PIFLAG_CAPTION, strInfo);			

	//	Tabellen-Namen
		strInfo.LoadString (IDS_IMP_TABLE);		
		pIStatus -> ChangeText (PIFLAG_FILE, strInfo);
		pIStatus -> ChangeText (PIFLAG_FILENAME, m_pCImportParams -> m_strTableName);

	//	Anzeige akt. 
		pIStatus -> SetPosition (1);					

	//	DataSource-Objekt erzeugen
		pCDataBase = new CDataBaseExt (m_pCImportParams -> m_strDataSource);
		if (! pCDataBase -> Open ())
		{
			DEX_Error (RC_OdbcImport, EC_NOOPENDSN);
			AfxThrowNotSupportedException ();
		}		
		
	//	DatenSätze aus Tabelle lesen
		long lMaxCnt = 0;				// Anzahl der Sätze oder Trias-Objekte
		if (!GetTableRecords (pCDataBase, pCColList, pCRecSet, lMaxCnt) || pIStatus -> WasCanceled ())
			AfxThrowNotSupportedException ();		// bereits ausgewerteter Fehler oder Nutzer-Abbruch

	// hr = pIStatus -> Restart (0L, 20, PIFLAG_CAPTION | PIFLAG_STATUS | PIFLAG_FILENAME | PIFLAG_RESULT | 
	//								      PIFLAG_TIME | PIFLAG_ADJUSTPERCENT | PIFLAG_FILE);
	// 	strInfo.LoadString (IDS_IMP_STAT_PERCENT);					// Prozent-Anzeige
	// 	pIStatus -> ChangeText (PIFLAG_ADJUSTPERCENT, strInfo);	

	//	lese Trias-Objekte

	//	führe Abgleich durch

	//	lösche ggf. nicht existierende Objekte/Datensätze

	//	schreibe ODBC-Anbindungen

	//	zeige ImportErgebnis

	//	Definition-Page
	}
	CATCH (CMemoryException, me)
	{
		DEX_Error (RC_OdbcImport, EC_NOMEMORY);
	}
Exemplo n.º 19
0
void CSocketFile::Abort()
{
	AfxThrowNotSupportedException();
}
Exemplo n.º 20
0
void CSocketFile::UnlockRange(DWORD /*dwPos*/, DWORD /*dwCount*/)
{
	AfxThrowNotSupportedException();
}
Exemplo n.º 21
0
DWORD CSocketFile::GetLength() const
{
	AfxThrowNotSupportedException();
	return 0;
}
Exemplo n.º 22
0
void CSocketFile::SetLength(DWORD /*dwNewLen*/)
{
	AfxThrowNotSupportedException();
}
Exemplo n.º 23
0
CFile* CSocketFile::Duplicate() const
{
	AfxThrowNotSupportedException();
	return NULL;
}
Exemplo n.º 24
0
BOOL CSocketFile::Open(
	LPCTSTR /*lpszFileName*/, UINT /*nOpenFlags*/, CFileException* /*pError*/)
{
	AfxThrowNotSupportedException();
	return FALSE;
}
Exemplo n.º 25
0
CFile* CMemFile::Duplicate() const
{
	ASSERT_VALID(this);
	AfxThrowNotSupportedException();
	return NULL;
}
Exemplo n.º 26
0
void CConverter::SetLength(DWORD)
{
	AfxThrowNotSupportedException();
}
Exemplo n.º 27
0
void CConverter::UnlockRange(DWORD, DWORD)
{
	AfxThrowNotSupportedException();
}
Exemplo n.º 28
0
CFile* COutputViewFile::Duplicate() const
{
	AfxThrowNotSupportedException();
	return NULL;
}
Exemplo n.º 29
0
LONG CConverter::Seek(LONG lOff, UINT nFrom)
{
	if (lOff != 0 && nFrom != current)
		AfxThrowNotSupportedException();
	return 0;
}
Exemplo n.º 30
0
void COutputViewFile::UnlockRange(DWORD dwPos, DWORD dwCount)
{
	AfxThrowNotSupportedException();
}