Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
J

jw81

@jw81
About
Posts
33
Topics
11
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Dialog box on Toolbar Control
    J jw81

    I have set a dialog box on the toolbar. There is a Editbox with a Button on the dialog box. The Editbox supposed to get a value from the user and once the Button is pressed, the value will be transfered into a variable in CView. I added a CDialogBar variable m_pointDistro but since there is no class for the dialogbox, I dont know how to add this variable. Editbox ID is IDC_NPOINTS. I selected new class of the Dialogbox as CView but I was forbided to do that. So the Dialogbox ended up as no class. I chose the Button and added a function called OnDistro().

    void CProgramView::Distro() {

    CMainFrame* pMainFrame = (CMainFrame*)GetParentFrame();
    CEdit* pArray = (CEdit*)(pMainFrame->m_pointDistro.GetDlgItem(IDC_NPOINTS));
    .
    .
    }

    1. If I accidentally made the dialogbar has no class, how can i revert back? 2) The coding I used to get value from the dialogbox couldnt work. How can I fix it? Thanks,
    C / C++ / MFC question help tutorial

  • Using CDoc variable in MainFrm
    J jw81

    Hi Thanks for the advice. Now, I created a new dialog class and i wanna use CDoc variable. AfxGetMainWnd doesnt work. I have tried GetActiveDocument and GetActiveFrame but it is for MainFrm. THanks.

    C / C++ / MFC help

  • Using CDoc variable in MainFrm
    J jw81

    Hi Both of them cannot solve my problem. I got error C2440 for both of them. THanks

    C / C++ / MFC help

  • Using CDoc variable in MainFrm
    J jw81

    Hi I have trouble using CDoc variable in MainFrm. I have included Cdoc.h in MainFrm but the error of undeclared variable still existed.

    CDoc& pDoc = GetDocument();
    ASSERT_VALID(pDoc);

    This is how I normally getting CDoc variable from CView but it doesnt work in MainFrm. Please advise. THanks.

    C / C++ / MFC help

  • Problem with public variables
    J jw81

    Thx Astham There are 3 kinds of member variables/functions: public: Can be used/called by objects of any class private: Can be used by objects of this class only protected: Can be used by objects of this class and derived classes only. So if you want to use the variable from somewhere else than a CProgView member function, you need to make the variable public. If you use Add Member Variable there's three radio buttons at the bottom of the dialog. Or you could just write public: at the line before the variable declaration. THis is my header code,

    // Implementation
    public:
    float pointX[100];
    float pointY[100];
    virtual ~CMyProgView();
    #ifdef _DEBUG
    virtual void AssertValid() const;
    virtual void Dump(CDumpContext& dc) const;
    #endif

    ] This is my public variable declaration. Why cant I use it? How to use it from my CMyProgDoc? I have #include CMyProgView.h and use it such as below: CMyProgView obView; obView.pointX[i] = something;

    C / C++ / MFC c++ help tutorial question

  • Problem with public variables
    J jw81

    It is public variable from CView. I use it in CDoc, how to declare it? THanks

    C / C++ / MFC c++ help tutorial question

  • Problem with public variables
    J jw81

    I declared a variable through ClassView>Add Member Variable in my Cview. I included header in my MainFrm.cpp. How to use the variable because it doesnt recognise my variable. Do I need to make an object inside my MainFrm.cpp? I tried to use CProgView cview; cview.myvariable; but it says cannot access protected member declared in class. Thanks

    C / C++ / MFC c++ help tutorial question

  • Array question
    J jw81

    I guess Alok answered my question, thanks.

    C / C++ / MFC data-structures tutorial question

  • Using CArray From Dialog Box
    J jw81

    Cant solve the CDoc error.

    C / C++ / MFC c++ tutorial question

  • Array question
    J jw81

    Hi I wrote a small program to count how many points are clicked using array. My count array doesnt work even though i wrote the declaration before or in the function itself. For example: int count=0; if((nFlags & MK_LBUTTON) == MK_LBUTTON){ count++ } and if((nFlags & MK_LBUTTON) == MK_LBUTTON){ int count; count++; } From what I can see is everytime a left mouse is clicked the array reset itself. The code is inside a OnMouseMove(UINT nFlags CPoint point) class. Thanks

    C / C++ / MFC data-structures tutorial question

  • Using CArray From Dialog Box
    J jw81

    CMainFrame for the menu

    C / C++ / MFC c++ tutorial question

  • Using CArray From Dialog Box
    J jw81

    Hi The CDoc* GetDocument(); error is not solved yet. It only happens when I included my CView.h into the cpp. Thanks

    C / C++ / MFC c++ tutorial question

  • CArray can't add
    J jw81

    Hi thanks Do you mean outside the class or outside the onmouseover? It is actually outside the onmouseover and inside the class. Do you mean declaring as public variable? What kind of type of variable shld I use? CArray ? The VC++ doesnt allow me the declare this type. Someone in the forum mentioned to create another header file and include it before declaring it. I got a lot of errors after I did that.

    C / C++ / MFC

  • CArray can't add
    J jw81

    I understand but it tried to create member variable but the VC++ doesnt allow me to add CArray type of variable. I need more detail solution. I am new to VC++ but have C b/ground. THanks.

    C / C++ / MFC

  • CArray can't add
    J jw81

    Hi thanks, Can you give me some guides?

    C / C++ / MFC

  • CArray can't add
    J jw81

    I have a struct struct CoData { float x; float y; }; // Adding position of mouse every left click CArray arrayPoint; CoData strRawCoords, strOut; CString m_list; if((nFlags & MK_LBUTTON) == MK_LBUTTON) { strRawCoords.x = point.x; strRawCoords.y = point.y; arrayPoint.Add(strRawCoords); } // Print out the coordinates when right click if((nFlags & MK_RBUTTON) == MK_RBUTTON) { for(int i=0;iTextOut(0,0,m_list); pDC->SetTextColor(RGB(0,0,0)); pDC->SelectObject(NormalPen); } } Cant work.

    C / C++ / MFC

  • Using CArray From Dialog Box
    J jw81

    There are quite a number of errors: typedef CArray MyStructArray; error C2143: syntax error : missing ';' before '<' So, after I construct mystruct.h, I can add Add Member Variable (public) for Variable Type (MyStructArray)? Besides, I always get error on CDoc* GetDocument(); in my CView.h.

    C / C++ / MFC c++ tutorial question

  • Using CArray From Dialog Box
    J jw81

    I have a struct under CDoc struct MyStruct { float x; float y; }; I use it for CArray. I dont know how to define a public variable with struct. Thanks

    C / C++ / MFC c++ tutorial question

  • Using CArray From Dialog Box
    J jw81

    &array is the array from my view? It is from different class. Myarray is from CView however CDialog is a different class. I need to know how to use myarray in CDialog. THanks.

    C / C++ / MFC c++ tutorial question

  • Using CArray From Dialog Box
    J jw81

    Thanks Abyss, But I still dont get the idea. Let me explain the task I need the program to do. I have a coordinate display in CView (I use OnDraw to draw out the x-axis and y-axis) that allows user to use mouse pointer to pick out coordinate points on CView. Each points will be collected into an array (CArray). I made a struct that contents two elements x & y to store x and y coordinates. Next, I have a dialog to list out the points. The dialog can be accessed from the menu. I am new to VC++ but I have b/ground in C. How can use MFC to ease my coding? 1) Must I use struct so store x & y in CArray? Is there another way? 2) How can I use the CArray in my listing dialog? I tried to declare public variables in CView (CArray myarray) but it doesnt allow me to declare. Thanks a million.

    C / C++ / MFC c++ tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups