thank you :)
rxgmoral
Posts
-
How to LPCTSTR Convert to char * -
How to LPCTSTR Convert to char *How to LPCTSTR Convert to char * thank :)
-
about VC+MySQL problem:)about VC+MySQL problem:) i install mysql odbc V5.0 driver i need to ADO Connect MYSQL DB; code: _ConnectionPtr m_CMConnect; ::CoInitialize(NULL); m_CMConnect.CreateInstance(__uuidof(Connection)); m_CMConnect->Open("Provider=MySQL;server=localhost;DataBase=test;port=3306;uid=root;pwd=","","",-1); but Program run error..... how to Ado Connect MYSQL DB; thank:)
-
dll problem,help me:)dll problem,help me:) i create dll project ,the dll is Use MFC in a Static Library i hope exe call ListCtrl class from dll ==================DLL==================== <<<<<<<<<>>>>>>>>>>>>>> #pragma once class AFX_EXT_CLASS ListCtrl :public CListCtrl { public: __declspec(dllexport) ListCtrl(); __declspec(dllexport) ~ListCtrl(); public: DECLARE_MESSAGE_MAP(); public: afx_msg void OnNMClick(NMHDR *pNMHDR, LRESULT *pResult); }; <<<<<<<<<<>>>>>>>>>> #include "Stdafx.h" #include "ListCtrl.h" ListCtrl::ListCtrl() {} ListCtrl::~ListCtrl() {} BEGIN_MESSAGE_MAP(ListCtrl,CListCtrl) ON_NOTIFY_REFLECT(NM_CLICK, &ListCtrl::OnNMClick) END_MESSAGE_MAP() void ListCtrl::OnNMClick(NMHDR *pNMHDR, LRESULT *pResult) { AfxMessageBox(_T("OK")); *pResult = 0; } =====================EXE============================ i Create Exe,the exe is Use MFC in a Static Library <<<<<<<<<<>>>>>>>>>>> #pragma comment(lib,"Dll.lib") #include "ListCtrl.h" class TestDlg : public CDialog { DECLARE_DYNAMIC(TestDlg) public: TestDlg(CWnd* pParent = NULL); // standard constructor virtual ~TestDlg(); enum { IDD = IDD_DIALOG1 }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support DECLARE_MESSAGE_MAP() ListCtrl m_ListCtrl; }; <<<<<<<<<<<<<<>>>>>>>>> #include "stdafx.h" #include "Test.h" #include "TestDlg.h" IMPLEMENT_DYNAMIC(TestDlg, CDialog) TestDlg::TestDlg(CWnd* pParent /*=NULL*/) : CDialog(TestDlg::IDD, pParent) {} TestDlg::~TestDlg() {} void TestDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_LIST1, m_ListCtrl); } BEGIN_MESSAGE_MAP(TestDlg, CDialog) ON_BN_CLICKED(IDOK, &TestDlg::OnBnClickedOk) END_MESSAGE_MAP() ====================== the exe project call ListCtrl from dll project Mouse click the m_ListCtrl window,error why???? help me,thank you :)
-
about dll problem,thank:)about dll problem,thank:) i have two file a static dll file ,another static Exe file i think Exe call List Class in dll,but.......... ************************static dll****************************** <<<<>>>>>>> #pragma once class AFX_EXT_CLASS List:public CListCtrl { public: __declspec(dllexport) List(); __declspec(dllexport) ~List(); __declspec(dllexport) void CMCreate(CWnd *pWnd); DECLARE_MESSAGE_MAP(); public: __declspec(dllexport) afx_msg void OnNMClick(NMHDR *pNMHDR, LRESULT *pResult); }; <<<<<>>>>>>>> #include "Stdafx.h" #include "List.h" List::List() {} List::~List() {} BEGIN_MESSAGE_MAP(List,CListCtrl) ON_NOTIFY_REFLECT(NM_CLICK, &List::OnNMClick) END_MESSAGE_MAP() void List::OnNMClick(NMHDR *pNMHDR, LRESULT *pResult) { AfxMessageBox(_T("OK")); *pResult = 0; } void List::CMCreate(CWnd *pWnd) { this->Create(WS_VISIBLE | WS_BORDER|SS_NOTIFY | WS_TABSTOP | WS_CHILD | LVS_ALIGNTOP | LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_OWNERDRAWFIXED, CRect(20, 20, 800, 200), pWnd, 123); } *************************Exe************************ List *m_pList; m_pList=new List(); m_pList->CMCreate(this); why ,i Click m_pList not show "ok"??? my english is not good,sorry :( thank you:)
-
problem about fonti am sorry,i write error...... =============New=========== problem about font i write CMFont class,it inheritance CFont e.g: class CMFont:public CFont {..........}; ************COMBOBOX*********** CMFont font; font.CreateFont(...); GetDlgItem(COMBOBOXID)->SetFont(&font); error error C2664: 'CWnd::SetFont' : cannot convert parameter 1 from 'CMFont **__w64 ' to 'CFont *' how to CMFont convert CFont thank:)
-
problem about fontproblem about font i write CMFont class,it inheritance CFont e.g: class CMFont:public CFont {..........}; ======================== CMFont font; font.CreateFont(...); GetDlgItem(IDC_FONTID)->SetFont(&font); error error C2664: 'CWnd::SetFont' : cannot convert parameter 1 from 'CMFont **__w64 ' to 'CFont *' how to CMFont convert CFont thank:)
-
about ComboBox problemabout ComboBox problem <<<<<<>>>>>>> ......... public: CComboBox Cbx; struct Data { LPCTSTR lpszName; LPCTSTR lpszValue; int ID; }; <<<<<<>>>>>> Data d; d.lpszName=_T("Name"); d.lpszValue=_T("Value"); d.ID=1; Cbx.InsertString(0,d.lpszName); Cbx.SetItemDataPtr(0,(void *)d); how to struct data append to ComboBox Control,thank:)
-
CString Convert to LPCTSTRCString Convert to LPCTSTR i write DLL file,it is static dll i want CString type Convert to LPCTSTR but error Code: <<<<<<<<<<>>>>>>>> <<<<<<>>>>>> class AFX_NOVTABLE dll { public: __declspec(dllexport) LPCTSTR Fun(); }; <<<<<<>>>>> LPCTSTR dll::Fun() { CString Rxg=_T("rxg"); LPCTSTR lpszStr=Rxg.GetBuffer(); return lpszStr; } <<<<<<<>>>>>>>> #pragma comment(lib,"dll.lib") #include "A.h" .................. dll d; LPCTSTR b=d.Fun(); error,why thank:)
-
about templateabout template i create template class <<<<>>>>>>> template struct CTDbNode { T Data; CTDbNode(T Value):Data(Value){} }; <<<<<<>>>>>>>>>> #pragma once #include "m_TemplateData.h" templateclass CTDbList { public: CTDbList() { pCurrent=NULL; } void CTInsert(T Value) { pCurrent=new CTDbNode(Value); } public: CTDbNode *pCurrent; }; example CTDbList d; d.CTInsert(_T("ddd")); error: e:\mystudio\project\shared\shared\m_templatestructure.h(12) : error C2955: 'CTDbNode' : use of class template requires template argument list e:\mystudio\project\shared\shared\m_templatedata.h(15) : see declaration of 'CTDbNode' e:\mystudio\project\shared\shared\m_templatestructure.h(11) : while compiling class template member function 'void CTDbList::CTInsert(T)' with [ T=CString ] e:\mystudio\project\shared\shared\cm_selectquery.cpp(6) : see reference to class template instantiation 'CTDbList' being compiled with [ T=CString ] e:\mystudio\project\shared\shared\m_templatestructure.h(12) : error C2514: 'CTDbNode' : class has no constructors e:\mystudio\project\shared\shared\m_templatedata.h(15) : see declaration of 'CTDbNode' thank:)
-
About CView problem,thank:)About CView problem,thank:) <<<<<<<<>>>>>> class Preview : public CView { public: virtual void OnDraw(CDC* pDC); virtual BOOL OnPreparePrinting(CPrintInfo *pInfo); void OnPrint(CDC *pDC, CPrintInfo* pInfo); }; <<<<<>>>>>>>> void Preview::OnDraw(CDC* /*pDC*/) { } BOOL Preview::OnPreparePrinting(CPrintInfo* pInfo) { return DoPreparePrinting(pInfo); } void Preview::OnPrint(CDC *pDC, CPrintInfo* pInfo) { CString str=_T("rrr"); pDC->TextOut(0,30,str); } <<<<<<<<<<>>>>>>> Preview * p=new Preview(); p->GetDC()->TextOutW(1,2,_T("rxg")); i think add char to p; Debug no Error,but run Error how to add char to TextOutW function in p sorry,My English isn't good thank:)
-
Ask Function problem?thanksAsk Function problem?thanks <<<<<<<<<>>>>>>>>> #pragma once class Class { public: int get_return(int a,int b,int (*compare)()); int Rxgmoral(int a,int b); void Fun(); }; <<<<<<<<>>>>>>> #include "Stdafx.h" #include "Class.h" int Class::get_return(int a,int b,int(* compare)()) { return (compare(a,b)); } int Class::Rxgmoral(int a, int b) { return a+b; } void Class::Fun() { int a; a=get_return(1,2,&Rxgmoral); } error: e:\mystudio\project\test\test\class.cpp(6) : error C2197: 'int (__cdecl *)(void)' : too many arguments for call e:\mystudio\project\test\test\class.cpp(17) : error C2276: '&' : illegal operation on bound member function expression thanks:)
-
Ask a problem,About CEdit controlAsk a problem,About CEdit control i write code..... <<<<<<<<>>>>>>> ****************CmEdit.h********** class AFX_NOVTABLE CmEdit : public CEdit { public: __declspec(dllexport) CString CmGetDlgItem(int nID); }; ***************CmEdit.Cpp********** CString CmEdit::CmGetDlgItem(int nID) { CString Str; GetDlgItem(nID)->GetWindowTextW(Str); return Str; } <<<<<<<<<<<>>>>>>>>>>>> #pragma comment(lib,"Dll.lib") #include "CmEdit.h" void SocialSecurityData::OnBnClickedOk() { CmEdit d; CString r=d.CmGetDlgItem(IDC_EDIT1); MessageBox(r); } Start Debugging..... Error............... Why???? thank:)
-
Ask a problem,about template:)thank you:)FarPointer
-
Ask a problem,about template:)Ask a problem,about template:) i write template class <<<<<<<<>>>>>>> #pragma once template class Tem { public: T rxg(T a); }; <<<<<<<<>>>>>>> #include "stdafx.h" #include "class.h" templateT Tem::rxg(T a) { return a; } <<<<<<<<<<>>>>>>>> #include "Class.h" ................................ Tem moral; int a=moral.rxg(10); Error: Test.obj : error LNK2019: unresolved external symbol "public: int __thiscall Tem::rxg(int)" (?rxg@?$Tem@H@@QAEHH@Z) referenced in function "public: void __thiscall CAboutDlg::OnBnClickedOk(void)" (?OnBnClickedOk@CAboutDlg@@QAEXXZ) thank:)
-
Ask a problem,about inheritance :)Ask a problem,about inheritance :) ****************static DLL***************** <<<<<<<<>>>>>>>>>> #pragma once class AFX_NOVTABLE CmView :public CView { public: __declspec(dllexport) CmView(); }; <<<<<<<<>>>>>>> #include "stdafx.h" #include "CmView.h" CmView::CmView() { } ******************static EXE****************** <<<<<<<>>>>>>>> #pragma once #include "CmView.h" #pragma comment(lib,"dll.lib") class EXEView : public CmView { ........... }; <<<<<<<<>>>>>>>> #include "stdafx.h" #include "EXEView.h" #ifdef _DEBUG #define new DEBUG_NEW #endif IMPLEMENT_DYNCREATE(CInfoEngineView, CmView) ....................... error: error C2039: 'classCmView' : is not a member of 'CmView' see declaration of 'CmView' error C2065: 'classCmView' : undeclared identifier why...... thank you:)