CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 18

Threaded View

  1. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: String passing between functions in VC++ SDI application

    Quote Originally Posted by maxer View Post
    Code:
    Void sendtext(CString str)
    {
       // do some operations
    ................
      pView->displaytext(str);
    }
     
    void displaytext(CString inr)
    {
      CListCtrl &ctlsde = this->GetListCtrl();
      ctlsde.InsertColumn(1,  _T("First "),   LVCFMT_LEFT,   80);
     
      int nItem;
    	nItem = ctlsde.InsertItem(0,  inr);
    }
    1. Better way to pass CString into a function is by const reference, not by value! Like
      Code:
      void sendtext(const CString& str)
      ...
      void displaytext(const CString& inr)
    2. What is pView?
    3. Is your displaytext a global function? Then what is this pointer within it?
    Last edited by VictorN; April 8th, 2013 at 05:11 AM.
    Victor Nijegorodov

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured