I did that : DDV_MinMaxInt internally calls _AfxFailMinMaxWithFormat function AFX_STATIC void AFXAPI _AfxFailMinMaxWithFormat(CDataExchange* pDX, long minVal, long maxVal, LPCTSTR lpszFormat, UINT nIDPrompt) { ASSERT(lpszFormat != NULL); if (!pDX->m_bSaveAndValidate) { TRACE0("Warning: initial dialog data is out of range.\n"); return; // don't stop now } TCHAR szMin[32]; TCHAR szMax[32]; wsprintf(szMin, lpszFormat, minVal); wsprintf(szMax, lpszFormat, maxVal); CString prompt; AfxFormatString2(prompt, nIDPrompt, szMin, szMax); AfxMessageBox(prompt, MB_ICONEXCLAMATION, nIDPrompt); prompt.Empty(); // exception prep pDX->Fail(); } The prompt variable comes out to be empty. Do I have to explicitly create a String Resource and pass that resource in one of these functions ? Regards Dinesh
Dinesh Ahuja
Posts
-
DDV functions -
DDV functionsHi Everybody, I have a class which is being derived from CDialog class. class CEventDialog : public CDialog { private: CString m_sEventDesc; int m_iHours; int m_iMin; // Other implementation has been removed from the class. }; The deifination for DoDataExchange is as follows: void CEventDialog::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Text(pDX,IDC_ADDSTRHR,this->m_iHours); DDV_MinMaxInt(pDX,this->m_iHours,1,24); DDX_Text(pDX,IDC_EDITDESC,this->m_sEventDesc); DDV_MaxChars(pDX,this->m_sEventDesc,20); DDX_Text(pDX,IDC_ADDSTRMIN,this->m_iMin); DDV_MinMaxInt(pDX,this->m_iMin,1,59); } The problem which i am facing is that if i enter an invalid value for iMin data variable , the DDV_MinMaxInt function displays a message box without any message in it. How should i display the used defined message in the Message Nox which is being created by DDV_MinMaxInt function? Regards Dinesh
-
IShellExtInit and IContextMenu;Hi Hunter, Hope this will help you. WIN32_FIND_DATA wFindData; ZeroMemory(&wFindData,sizeof(WIN32_FIND_DATA)); hResult = SHGetDataFromIDList(pShellFolder,pPIDL,SHGDFIL_FINDDATA,&wFindData,sizeof(WIN32_FIND_DATA)); In this, pShellFolder is the Address of parent folder and pPIDL is the PIDL corrosponding to the selected item. if (wFindData.dwFileAttributes && FILE_ATTRIBUTE_DIRECTORY) { // It is a directory!. } else { // It is a file!. } Regards Dinesh
-
Calling C++ code from CThis will help you in accessing the static member function of C++ in C. //Test1.cpp #include typedef int (* pFunc) (int,int); class D { public : static int Calculate(int iNum1,int iNum2); };` extern "C" { int D::Calculate(int iNum1, int iNum2) { return iNum1 + iNum2; } pFunc p = D::Calculate; } // Test.c #include typedef int (* pFunc) (int,int); extern pFunc p; int main() { int iResult = (*p)(10,20); printf("Value is %d",iResult); return 0; } Hope this will help you! Regards Dinesh
-
Derived CFrameWnd and attaching a View with it.Hi Everybody, Whenever i create an object of Derived CFrameWnd class, it doesn't have any view attached to it. Can I associate a CHtmlView class with Derived CFrameWnd class by calling SetActiveView ? Is there any other way to attach the CHtmlView with the Derived CFrameWnd class, so that i should be able to display the dynamically prepared HTML in that Derived CFrameWnd object. Regards Dinesh