|
I'm trying to rename the exiting folder, let's say folder1 to folder2
then I create a new folder called folder1.
1) but my renaming, rename(), method doesn't work, it only works for renaming file name. not for folder name.
2) a new folder didn't get created..
what's wrong..
here's my code
<br />
#include <direct.h>
<br />
void JobAction::renamefolder(char *oldpath)<br />
{<br />
<br />
cout<<" renaming folder"<<endl;<br />
<br />
char newpath[_MAX_PATH];<br />
strcpy(newpath,oldpath);<br />
int oldpathlen = strlen(oldpath);<br />
newpath[oldpathlen]=NULL;<br />
<br />
<br />
parseAstring(newpath,'\\',RIGHT);
<br />
strcat(newpath,"\\output1");
cout<<"oldpath: "<<oldpath<<endl<<"newpath: "<<newpath<<endl;<br />
<br />
rename(oldpath,newpath);
createDirectory(newpath);<br />
<br />
<br />
}<br />
<br />
<br />
bool JobAction::createDirectory(char *dir)<br />
{<br />
<br />
if(strlen(dir) > 3)<br />
{<br />
parseAstring(dir,'\\',RIGHT); <br />
cout<<dir<<endl;<br />
createDirectory(dir);<br />
} <br />
_mkdir((const char*)dir);<br />
return true;<br />
}<br />
thank you
|
|
|
|
|
Use
int SHFileOperation(<br />
LPSHFILEOPSTRUCT lpFileOp<br />
);
Mustafa Demirhan
http://www.macroangel.com
Sonork ID 100.9935:zoltrix
<nobr>They say I'm lazy but it takes all my time
|
|
|
|
|
Return Value
Each of these functions returns 0 if it is successful. On an error, the function returns a nonzero value and sets errno to one of the following values:
EACCES
File or directory specified by newname already exists or could not be created (invalid path); or oldname is a directory and newname specifies a different path.
ENOENT
File or path specified by oldname not found.
EINVAL
Name contains invalid characters.
For other possible return values, see _doserrno, _errno, syserrlist, and _sys_nerr.
Remarks
The rename function renames the file or directory specified by oldname to the name given by newname. The old name must be the path of an existing file or directory. The new name must not be the name of an existing file or directory. You can use rename to move a file from one directory or device to another by giving a different path in the newname argument. However, you cannot use rename to move a directory. Directories can be renamed, but not moved.
_wrename is a wide-character version of _rename; the arguments to _wrename are wide-character strings. _wrename and _rename behave identically otherwise.
Check errno to see what the error was.
Todd Smith
|
|
|
|
|
Hi
My application is C++ using MFC, generated by VC6++ AppWizard (exe), is a MDI and has a CView and a CScrollView in a splitted window. It has the usual status bar generated by the AppWizard.
Now I want to add a second status bar right above the first one.
Until now I just "duplicated" the code of the CStatusBar in MainFrm.h and MainFrm.cpp - and it works: the status bar is there, I can define and access several panes.
The problem is: the second status bar although has this "resizing triangle" - which produces unwanted effects when used.
The question is: how to remove this "resizing triangle"?
Screenshot is here.
Thanks,
Matthias
|
|
|
|
|
TeeTeeHaa wrote:
The problem is: the second status bar although has this "resizing triangle" - which produces unwanted effects when used.
The size grip appears because the parent window is resizable. trace into the CStatusBar::Create() and you will see:
if (pParentWnd->GetStyle() & WS_THICKFRAME)<br />
dwStyle |= SBARS_SIZEGRIP;<br />
This is why the size grip appears, even if you create it without the SBARS_SIZEGRIP flag. I think you can acomplish what you want by creating your own class derived from CStatusBar, and override PreCreateWindow().
Enis Arif
-----------
"I am enough of an artist to draw freely upon my imagination. Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world." (Albert Einstein)
|
|
|
|
|
I have the following problem: i use mapi library in visual c++. All works fine, except that I need to set the delivery receipt option to the message I send. There is a flag for read receipt, but not for the delivery receipt. Does anyone know a solution for this?
Thaks!
Enis Arif
-----------
"I am enough of an artist to draw freely upon my imagination. Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world." (Albert Einstein)
|
|
|
|
|
I have inserted a number of files from another project into my own.
I would like to link some of the menu items to functions in the Classes I have imported but VC6 seems to ignore all ON_COMMAND macros that I place into the imported files. Leaving the menu item greyed etc...
And class wizard ignores the classes i have imported in its list of available classes to link associate resources to?!?
Does anyone know how i can solve this?
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
normally deleting your clw file will do the trick.
STL is a religeon. Enquiries to Reverend Christian Graus
|
|
|
|
|
Thanks,
that did it.
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
I've added a X to the title bar using the dialog property sheet, where do I intercept this to do some processing before it exits?
Thanks!
|
|
|
|
|
Handle WM_CLOSE
STL is a religeon. Enquiries to Reverend Christian Graus
|
|
|
|
|
Thanks, I actually added the wm_close and didn't know that it would work with the X also. I thought there would be a wm_exit for that one.
Thanks for the info.
|
|
|
|
|
Does somebody knows where I can find the download for the EXCEL DEVELOPPERS KIT (any version will do)?
I've crawled the msdn site from top to bottom and 20 times back again, but nothing shows up.
Is it on the office installation cd? Do you have to buy it in a store?
tnx.
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
You will have to buy Office Developer's Kit from MS (I don't know it they have sepparate versions for Excel, Word..)
Enis Arif
-----------
"I am enough of an artist to draw freely upon my imagination. Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world." (Albert Einstein)
|
|
|
|
|
That's an MSPRESS book basically.
It was published in MSDN library until 1998, but MS decided to remove it to encourage people to use only VBA for Excel, and now Excel Xml,
And I swallow a small raisin.
|
|
|
|
|
I've just found the library and header files. It was included in some example zipfile
There're no docs but everything that's in the example is very clear.
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Hi,
I got some troubles with VC6 and STL, I found on google's usenet archive that a SP is recommended. Which one should I apply, latest SP5? Any problems or new bugs that I should know?
Thanks
|
|
|
|
|
go ahead! can't believe you still running VC6 without SP,
And I swallow a small raisin.
|
|
|
|
|
okay, it's done.
Still the same problems and I need to run a workaround still. Is it known that STL implementation is a little clumpsy? Had no problems on Unix platform.
|
|
|
|
|
Regarding STL compliancy with ISO, indeed you are very unlikely to be able to compile without a slight change, such like project settings or one or more #ifdef#define. Post a code snippet if you are stuck, I am sure one of the people out there will help you in no time,
And I swallow a small raisin.
|
|
|
|
|
okay - thanks a lot for offering help! I got the hint already to use 'stlport' or other supplementary STL libraries. I'll post problems, when it can't be solved with a little googeling.... have a nice weekend
|
|
|
|
|
What problem are you running into? There may be a fix you can apply or the other option is to use another implementation of STL such as http://www.stlport.org[^]
I've run into problems before (can't remember exactly what) and had to work around them.
Todd Smith
|
|
|
|
|
I have an MDI application where the view class has a dialog box as a member. When I change between the views I want to hide the dialog box. In the CView::OnActivateView function i hide the dialog when I change between the two views.
My problem is when i change from the dialog box to the the other view. I don't know how to hide the dialog box i that case. Can somebody please help?
I also committed the crime of posting a programming question in the Lounge.
|
|
|
|
|
Hi.
I want to display thumbnails of images. I tried using the "Imaging for Windows" ActiveX control imgthumb.ocx (Kodak image thumbnail) that comes along with Windows2000. I use VC++6.0.
I want to dynamically create the thumbnails. I am unable to figure out which functions to call.
Here is my code snippet.
It does not show any error, but nothing is displayed.
Can you point out what is wrong?
m_thumb = new CImgThumbnail;
BOOL res = m_thumb->Create("Thumbnail", WS_CHILD | WS_VISIBLE | WS_BORDER,
CRect(100, 100, 170, 170), this, 1341);
m_thumb->SetThumbWidth(50);
m_thumb->SetThumbHeight(50);
m_thumb->SetImage("c:\\flowers.jpg");
m_thumb->SetEnabled(true);
m_thumb->SetThumbCaption("seen???");
m_thumb->SetThumbBackColor(0);
m_thumb->SetThumbCaptionColor(100);
VARIANT image, page;
BSTR bst;
CString str="c:\\database_n\\flowers\\21099_wallpaper110.jpg";
bst = (unsigned short *)str.GetAt(0);
image.vt = VT_BSTR;
image.bstrVal = bst;
page.vt = VT_I2;
page.iVal = 1;
m_thumb->UISetThumbSize(image, page);
VARIANT thumbno, options;
thumbno.vt = VT_I4;
thumbno.lVal = 1;
options.vt = VT_I2;
options.iVal = 0;
CString str1 = m_thumb->GetImage();
m_thumb->DisplayThumbs(thumbno, options);
//m_thumb->Refresh();
However, the thumbnail is displayed when I put the control in a dialog box (using the editor), and set its properties.
Where am I going wrong in the dynamic creation process?
Hope somebody can throw some light.
Thanks.
Logic is a systematic method of coming to the wrong conclusion with
confidence.
|
|
|
|
|
I did that in CDlg::OnInitDialog() implementation :
CRect rect(10,10,150,150);
m_pCtrl = new CThumbnailctrl1();
BOOL bOk = m_pCtrl->Create(NULL,
"thumb",
WS_CHILD|WS_VISIBLE,
rect,
this,
100);
m_pCtrl->SetImage("c:\\011.jpeg");
And when I ran tha dialog-based MFC app, I saw the actual image on screen. At least this works so far.
And I swallow a small raisin.
|
|
|
|