the_hood00
asked on
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.
give all necessary #includes and where they go and send source code only no links.
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.
SetDlgItemText(IDC_MYEDIT, "some text");
Thats all you require. No headers etc.
Thats all you require. No headers etc.
ASKER
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
if you want more points ill will add them upon request
send no links code only
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.
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.
ASKER
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
for a static text box as well if not what can i use to do that
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.
ASKER
this is my last question: how do i put the copied file in a folder on the current users desktop
ASKER
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
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
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_NOCONFIRMAT ION|FOF_NO ERRORUI;
SHFileOperation(&sFileOp);
SHFILEOPSTRUCT sFileOp;
ZeroMemory(&sFileOp, sizeof(SHFILEOPSTRUCT));
sFileOp.wFunc = FO_COPY;
sFileOp.pFrom = pszFrom; <-------- source
sFileOp.pTo = pszTo; <-------- target
sFileOp.fFlags = FOF_SILENT|FOF_NOCONFIRMAT
SHFileOperation(&sFileOp);
ASKER
is there a tag or something that would allow me to make a directory on the curremt users desktop
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.
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.
Sorry wrong thread.
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 (SHGetSpecialFolderLocatio n(NULL,nFo lder,&pidl ) != NOERROR)
return 0 ;
return SHGetPathFromIDList(pidl,l pszPath) ;
}
to find desktop try
char szDesktopPath[MAX_PATH] ;
int iRet = MyGetSpecialFolderPath(CSI DL_DESKTOP ,szDesktop Path) ;
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 (SHGetSpecialFolderLocatio
return 0 ;
return SHGetPathFromIDList(pidl,l
}
to find desktop try
char szDesktopPath[MAX_PATH] ;
int iRet = MyGetSpecialFolderPath(CSI
ASKER
cant figure it out i cant get the link to work either
ASKER
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
yes.
ASKER
do you know it ill give you 80 points 40 now and 40 when it works
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.
It's much simpler with SHFileOperation.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
unsubscribing
ASKER
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.
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.
ASKER
i think i got it thankyou for your assistance you will get all 290 points
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.