Add text to CEdit

how do i load a string of text to an edit box

give all necessary #includes and where they go and send source code only no links.








 
the_hood00Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SteHCommented:
CString csTmp; // assign a value to csTmp as you like
CEdit m_Edit1;
m_Edit1.SetWindowText (csTmp); // this sets the value.

If you create a SDI/MDI/dialog base application using the wizard you don't need to add any includes. They are added to stdafx.h automatically. Otherwise the includes depends on other parts you use. Try to copy and paste from a wizard base application.
0
SteHCommented:
The CEdit control can be easily cretaed using the class wizard. Go to the "Member variable" tab and select to create a variable of type "control" for the corresponding control ID.
0
AndyAinscowFreelance programmer / ConsultantCommented:
SetDlgItemText(IDC_MYEDIT, "some text");

Thats all you require.  No headers etc.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

the_hood00Author Commented:
How do i copy a folder of .txt documents and subfolders quickly

if you want more points ill will add them upon request

send no links code only
0
AndyAinscowFreelance programmer / ConsultantCommented:
You really ought to create a new question but

SHFileOperation
Copies, moves, renames, or deletes a file system object

SHFILEOPSTRUCT
Contains information that the SHFileOperation function uses to perform file operations.



typedef struct _SHFILEOPSTRUCT{
    HWND hwnd;
    UINT wFunc;
    LPCTSTR pFrom;
    LPCTSTR pTo;
    FILEOP_FLAGS fFlags;
    BOOL fAnyOperationsAborted;
    LPVOID hNameMappings;
    LPCTSTR lpszProgressTitle;
} SHFILEOPSTRUCT, *LPSHFILEOPSTRUCT;
 
Members
hwnd
Window handle to the dialog box to display information about the status of the file operation.
wFunc
Value that indicates which operation to perform. This member can be one of the following values:
FO_COPY
Copy the files specified in the pFrom member to the location specified in the pTo member.
0
the_hood00Author Commented:
also can i use SetDlgItemText(IDC_MYEDIT, "some text");
for a static text box as well if not what can i use to do that
0
SteHCommented:
Yes you can. It works for all CWnd derived controls which have a sensible text variable. Else the function will modify the title of the control.
0
the_hood00Author Commented:
this is my last question: how do i put the copied file in a folder on the current users desktop
0
the_hood00Author Commented:
also i cant figure out how to use

typedef struct _SHFILEOPSTRUCT{
    HWND hwnd;
    UINT wFunc;
    LPCTSTR pFrom;
    LPCTSTR pTo;
    FILEOP_FLAGS fFlags;
    BOOL fAnyOperationsAborted;
    LPVOID hNameMappings;
    LPCTSTR lpszProgressTitle;
} SHFILEOPSTRUCT, *LPSHFILEOPSTRUCT;
 
could you enlighten me a little
0
AndyAinscowFreelance programmer / ConsultantCommented:
something like

     SHFILEOPSTRUCT sFileOp;
     ZeroMemory(&sFileOp, sizeof(SHFILEOPSTRUCT));

     sFileOp.wFunc = FO_COPY;
     sFileOp.pFrom = pszFrom;  <-------- source
     sFileOp.pTo = pszTo;          <-------- target
     sFileOp.fFlags = FOF_SILENT|FOF_NOCONFIRMATION|FOF_NOERRORUI;

     SHFileOperation(&sFileOp);


0
the_hood00Author Commented:
is there a tag or something that would allow me to make a directory on the curremt users desktop
0
AndyAinscowFreelance programmer / ConsultantCommented:
Excerpt from help
CWnd::GetDlgItem  
CWnd* GetDlgItem( int nID ) const;

void CWnd::GetDlgItem( int nID, HWND* phWnd ) const;

Return Value

A pointer to the given control or child window. If no control with the integer ID given by the nID parameter exists, the value is NULL.

The returned pointer may be temporary and should not be stored for later use.     ***************************


You MUST NOT store the returned hwnd in the OnInitDialog.  You need to use that code to get it each time you intend to use it.

0
AndyAinscowFreelance programmer / ConsultantCommented:
Sorry wrong thread.
0
AndyAinscowFreelance programmer / ConsultantCommented:
This is a Basic code sample

http://support.microsoft.com/download/support/mslfiles/sfolder.exe


I have also found this snippet

 #include  <windows.h>
#include  <shlobj.h>

int  MyGetSpecialFolderPath (int nFolder, LPSTR lpszPath)
{
LPITEMIDLIST  pidl ;

if (SHGetSpecialFolderLocation(NULL,nFolder,&pidl) != NOERROR)
  return 0 ;

return SHGetPathFromIDList(pidl,lpszPath) ;
}


to find desktop try
char  szDesktopPath[MAX_PATH] ;
int iRet = MyGetSpecialFolderPath(CSIDL_DESKTOP,szDesktopPath) ;



0
the_hood00Author Commented:
cant figure it out i cant get the link to work either
0
the_hood00Author Commented:
is there a diffrent way to delete a folder of files and subdirectories other then with SHFileOperation() and the string of the path to the folder has variables in it
0
AndyAinscowFreelance programmer / ConsultantCommented:
yes.
0
the_hood00Author Commented:
do you know it ill give you 80 points 40 now and 40 when it works
0
AndyAinscowFreelance programmer / ConsultantCommented:
The alternative is to recursively move down the directory tree, deleting files as you go, when you come up a level the directory has been cleaned so you then delete that.
It's much simpler with SHFileOperation.
0
AndyAinscowFreelance programmer / ConsultantCommented:
     //remove all .asc files in the target directory
      {
            TCHAR szTrgt[MAX_PATH];
            ::ZeroMemory(szTrgt, sizeof(szTrgt));

            _tcscpy(szTrgt, szPath);
            _tcscat(szTrgt, _T("\\*.asc"));

            SHFILEOPSTRUCT fileOp;
            fileOp.hwnd = GetSafeHwnd();
            fileOp.wFunc = FO_DELETE;
            fileOp.pFrom = szTrgt;
            fileOp.pTo = _T("");
            fileOp .fFlags = FOF_NOCONFIRMATION | FOF_SILENT  | FOF_NOERRORUI;
            fileOp.hNameMappings = NULL;
            fileOp.lpszProgressTitle = NULL;

            SHFileOperation(&fileOp);
      }
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SteHCommented:
unsubscribing
0
the_hood00Author Commented:
i cant get the code to work it still gives me the same error but i am not trying to copy anymore i got a different way for that but this time i want to delete a folder this is the path of the folder to delete

CString csfile=("c:\\Program Files\\Geoffism Studios\\np\\"+csMsg);

when the user pushes a button the folder is deleted

if you write the code for me with SHFileOperation. ill give you all 290 and if you want more i will change it to your desired amount and do i need to add any #inlcudes for SHFileOperation.

0
the_hood00Author Commented:
i think i got it thankyou for your assistance you will get all 290 points
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.