How to Change File Extension

Hi All,

           I am new to VC++.NET. I have a stuck with a problem. I am
creating a temporary file in C:\Windows\Temp directory. The file name
would be <filename>.tmp. Now if I want to change the extension to some
other extension like ".doc" or ".xml" , how can I do it? Is it possible
in VC++.NET.

          In one of the post, I saw we have to invoke IDR_MAINFRAME.
But I am not finding any such thing in VC++.NET. 


Thanks,
Yesh

0
10/13/2006 8:53:34 AM
vc.mfc 33608 articles. 0 followers. Follow

5 Replies
1330 Views

Similar Articles

[PageSpeed] 1

use CFile::Rename

"yesh" <yeshwanth.hv@gmail.com> wrote in message 
news:1160729614.279921.50800@b28g2000cwb.googlegroups.com...
> Hi All,
>
>           I am new to VC++.NET. I have a stuck with a problem. I am
> creating a temporary file in C:\Windows\Temp directory. The file name
> would be <filename>.tmp. Now if I want to change the extension to some
> other extension like ".doc" or ".xml" , how can I do it? Is it possible
> in VC++.NET.
>
>          In one of the post, I saw we have to invoke IDR_MAINFRAME.
> But I am not finding any such thing in VC++.NET.
>
>
> Thanks,
> Yesh
> 


0
10/13/2006 10:22:16 AM
Here's a function I use:

//
// Exchanges one file extension for another and returns the new fiel path
//
CString RenameFileExt(LPCTSTR Path, LPCTSTR Ext)
{
    CString cs = Path;
    ::PathRenameExtension(cs.GetBuffer(_MAX_PATH), Ext);
    return cs;
}

Tom

"yesh" <yeshwanth.hv@gmail.com> wrote in message 
news:1160729614.279921.50800@b28g2000cwb.googlegroups.com...
> Hi All,
>
>           I am new to VC++.NET. I have a stuck with a problem. I am
> creating a temporary file in C:\Windows\Temp directory. The file name
> would be <filename>.tmp. Now if I want to change the extension to some
> other extension like ".doc" or ".xml" , how can I do it? Is it possible
> in VC++.NET.
>
>          In one of the post, I saw we have to invoke IDR_MAINFRAME.
> But I am not finding any such thing in VC++.NET.
>
>
> Thanks,
> Yesh
> 


0
tserface (3861)
10/13/2006 7:10:21 PM
yesh wrote:
> Hi All,
>
>            I am new to VC++.NET. I have a stuck with a problem. I am
> creating a temporary file in C:\Windows\Temp directory. The file name
> would be <filename>.tmp. Now if I want to change the extension to some
> other extension like ".doc" or ".xml" , how can I do it? Is it possible
> in VC++.NET.
>
>           In one of the post, I saw we have to invoke IDR_MAINFRAME.
> But I am not finding any such thing in VC++.NET.
>


If you are talking about changing extension associated with your app,
you can change it in resource editor (string table for
IDR_PROJECTNAMETYPE). The string has your app's extension at couple of
places. 

---
Ajay

0
ajaykalra (6842)
10/14/2006 11:56:58 AM
Hi Ajay,

I thought OP was trying to change the actual file name in the file system. 
If OP wants to change the file extension the document class works with 
you're right of course.

Of course, if the file is on disc they'd want to use something like 
CFile::Rename()

http://msdn2.microsoft.com/en-us/library/0y89a13f.aspx

Once they have the new file name they want.  It's tough to tell from the 
question exactly what OP is trying to do.  Thanks for the different 
perspective.

Tom

"Ajay Kalra" <ajaykalra@yahoo.com> wrote in message 
news:1160827018.827042.136570@b28g2000cwb.googlegroups.com...
>
> yesh wrote:
>> Hi All,
>>
>>            I am new to VC++.NET. I have a stuck with a problem. I am
>> creating a temporary file in C:\Windows\Temp directory. The file name
>> would be <filename>.tmp. Now if I want to change the extension to some
>> other extension like ".doc" or ".xml" , how can I do it? Is it possible
>> in VC++.NET.
>>
>>           In one of the post, I saw we have to invoke IDR_MAINFRAME.
>> But I am not finding any such thing in VC++.NET.
>>
>
>
> If you are talking about changing extension associated with your app,
> you can change it in resource editor (string table for
> IDR_PROJECTNAMETYPE). The string has your app's extension at couple of
> places.
>
> ---
> Ajay
> 


0
tserface (3861)
10/14/2006 2:38:31 PM
> I thought OP was trying to change the actual file name in the file system.
> If OP wants to change the file extension the document class works with
> you're right of course.

Dont know what exactly OP wanted but IDR stuff threw me in that
direction.

---
Ajay

0
ajaykalra (6842)
10/14/2006 5:26:42 PM
Reply:

Similar Artilces:

Excel file e mail addresses into address group list
I want to take the .csv file from excel into my outlook express address book then copy addresses (select members) into a group list. Then I want to keep that address in the group list, but erase from the address book. Hi Jack, First back up your Windows Address Book ( .WAB) Export your address book to a .csv format so that you are sure you have the formatting correct (all the fields). When you import your .csv file to the address book, you must add one more column to your Excel file and fill it with a single blank. This will generate the need comma at the end of each row -- fail...

Log changes to full access permission
Exchange 2007 SP1. Is there a log, or is it possible to log, whenever anyone is granted full access to a mailbox or mailboxes? Thank you. Adrian What do you mean by "anyone"? Please make your request more specific. -- Ed Crowley MVP "There are seldom good technological solutions to behavioral problems." .. "Adrian" <NoSpam@Hotmail.com> wrote in message news:%23eQ58rEaKHA.1640@TK2MSFTNGP06.phx.gbl... > Exchange 2007 SP1. > > Is there a log, or is it possible to log, whenever anyone is granted full > access to a ma...

How to change the return of a textbox from TRUE/FALSE to YES/NO?
I have a long colum full of textboxes in excel. When the boc is checked it returns true, and false for unchecked. I would like to change this so that it returns Yes for checked and No for unchecked. How can I make this happen You mean Checkboxes? You can use a helper cell: =if(a1=true,"Yes","No") Then hide that linkedcell (if you want). Gldenboy2 wrote: > > I have a long colum full of textboxes in excel. When the boc is checked it > returns true, and false for unchecked. I would like to change this so that > it returns Yes for checked and No for un...

Moving files Outlook 2003
I am moving my outlook files to a new computer. Does anyone know how to accomplish this move? Wayne <was2480@msn.com> wrote: > I am moving my outlook files to a new computer. Does > anyone know how to accomplish this move? http://www.slipstick.com/config/backup.htm tells the files. The easiest is to simply copy your PST to the new PC, put it in some folder, giving it a name that doesn't match any other PST, make sure it's not read-only, and use Outlook's File>Open>Outlook Data File to open it. -- Brian Tillman ...

How to change The height of the Split Window in a frame?
Hi: Every one, I make a 2-rows , 1 col CSplitterWnd i n a frame, Now i want to hide one of them, Or change the height of the window to 0, How to do,? Thanks Hi Jerry, Check SetRowInfo() and RecalcLayout() Normand "Jerry" <tghu@163.net> a �crit dans le message de news: eCW9GVIoEHA.644@tk2msftngp13.phx.gbl... > Hi: > Every one, > I make a 2-rows , 1 col CSplitterWnd i n a frame, > Now i want to hide one of them, > Or change the height of the window to 0, > How to do,? > Thanks > > > ...

Excel asking for save with no changes #5
Dave Peterson Wrote: > And xl2002 added an option that allows you to have more control: > Edit|links|startup prompt button. > check the "don't display the alert and update links" This sounds like exactly what I'm looking for! Unfortunately, I' running an older version of Excel. I'll have to hit up my IT perso for an update. Thanks! -Tomm -- tommy2 ----------------------------------------------------------------------- tommy20's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=281 View this thread: http://www.excelforum.com/sh...

how to extact a compressed file
I cannot uzip my zipped files ..Help Winnie Hello Winnie Winnie wrote: > I cannot uzip my zipped files ..Help is this a Word problem? Have you inserted ZIP files as objects in word, for instance? If not, better ask in a forum/newsgroup for your ZIP application or your operating system HTH Robert -- /"\ ASCII Ribbon Campaign | MSFT | \ / | MVP | Scientific Reports X Against HTML | for | with Word? / \ in e-mail & news | Word | http://www.masteringword.eu/ ...

How Change default "look in" location in EXCEL for Importing Exte.
I am importing data contained in a text file. When I get to Import Data, the "Look In" folder location always defaults to "My Data Sources". How do I change that to the folder where my data is? (files are on my computer). thanks ...

Missing Measures in .cub file created in Excel
After using Excel's Offline OLAP features which create a local cube file (.cub), many of the desired measures which I included in the wizard setup are not displayed. I'm looking for a reason for this. The data populating this cube file is from a virtual cube, so background calculations take place. I considered that those measures requiring calculation would not be included once seperated from the original virtual cube... but many calculated measures WERE included so I don't think that's the complete explination. I've varied the measures included in the .cub file...

Get rid of "folder sizes" and "data file management" links
at the bottom of the folder list? I'd love to remove these to make more space available in the list. Thanks. ...

Track Changes Query
Hi I wonder if someone could help me please with a problem that's been baffling for a few weeks now. I am trying to create a query, which in turn feeds a report, that shows tracked changes. I have previously posted on this forum and got some great advice that's really helped me along but I'm really struggling with the query to extract the data. I am relatively new to Access in particular VBA but I am willing to learn. What I would like to do is to use a date parameter to extract those fields with an updated time stamp within a given time period, which in turn I can sho...

working with default data files
I am using IMAP and I would like to config outlook to bring all my emai to the default "personal folders" or delete that folder. Is tha possible -- g.garrett ----------------------------------------------------------------------- g.garrette's Profile: http://www.officehelp.in/member.php?userid=491 View this thread: http://www.officehelp.in/showthread.php?t=124989 Posted from - http://www.officehelp.i g.garrette <g.garrette.2gnhe4@NoSpamPleaze.com> wrote: > I am using IMAP and I would like to config outlook to bring all my > email to the default "personal fo...

Problem restoring backup file from money 98 to money 04
Just upgraded to a new computer with Money 2004 --- Have transferred my money back-up file to the new computer --- Everytime I try to open using Money 2004 it begins the process of converting the file and then times out (stops responding) Any ideas??? Extremely frustrating as I don't want to lose 6 years of financial data ---- Thanks How long have you waited? It could take a long time--like tens of minutes. While it is in this state, it will be "not responding." This doesn't mean it's dead, just hat it's busy. "jh227" <anonymous@discussions.micr...

How to statically linking 2 files for 32 bit and 64 bit in VC++ 2005
I am trying to statically link a xyz.lib file to my 32-bit VC++ 2005 MFC app in order to use a .sys file. I have two xyz.lib files, one for win32 and one for amd64. I know I should add the .lib file to ['Property Pages' > 'Linker' > 'Input' > 'Additional Dependencies'] But which file do I add, how do I add both files, and how do I ensure the 32-bit app can use the linked .sys on 32-bit as well as 64-bit? Thanks! Hi, Just use the 32 bit lib, your app will run on 64 bit via WOW64. 64 bit development would involve setting up a new cpu platform, whi...

How can I change background color of DateTimePicker?
I know that subj is possible because of Borland C++ Builder allow to change background color of DateTimePicker just assigning a color to Color property of TDateTimePicker component. When I try to make this subj using MFC I've got nothing. Can anybody help me? My code : m_date.Create(WS_CHILD | WS_VISIBLE | DTS_SHORTDATEFORMAT, CRect(36, 0, 116, topHeight), this, 1006); m_date.SetFormat("dd.MM.yyyy"); m_date.Invalidate(TRUE); CDC *dc=m_date.GetDC(); assert(dc->SelectObject(&greenBrush)); ReleaseDC(dc); With best regards, Sergiy Yakovyn. "Sergiy ...

Change size of name box
This is a multi-part message in MIME format. ------=_NextPart_000_003C_01C3D233.5A184190 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Is it possible to change the size of the name box ? And how do you do it = ? Some of my range's names are to long to fit in the actual name box. Thanks in Advance, and may all of you have a healthy 2004 Gilbert ------=_NextPart_000_003C_01C3D233.5A184190 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HT...

changed time and date and messed up appointments
Hi I recently went to UK from Australia, then to italy, I must have changed the time zones, and now my appointments are all over the place, Is there a way of getting them back to original times and dates. for the future is there a better way of handling time zones. i also use a pocket pc where i probably changed zones as well. thanks tim See the following MSKB article for a workaround: http://support.microsoft.com/?kbid=197480 -- Jocelyn Fiorello MVP - Outlook *** Messages sent to my e-mail address will NOT be answered -- please reply only to the newsgroup to preserve the mes...

trouble openning file
I am drawing a blank again regarding the correct way to read files. Here is the pertinent section of code I am troubled by: CString JobFile="C:\\temp\\1.dat"; CFile in; CByteArray buffer; if(!in.Open(JobFile, CFile::modeRead)){ AfxMessageBox("Error opening file"); return; } buffer.SetSize(in.GetFileSize()); if(in.Read(buffer.GetData(), buffer.GetSize()) != buffer.GetSize()){ AfxMessageBox("Error reading file"); return; } in.Close(); When I compile I get the following error: error C2039: 'GetFileSize' : is not a member ...

GDI+ mfc save Bitmap to File Stream
Hi, I am using GDI+ in mfc. I have a file pointer declared as File *fpOut; This file pointer is also used for writing to other text data to the file. I am not sure how to save an image to this file stream. When Bitmap.Save function to save to stream the first parameter is of type IStream and not FILE. Any suggestions on what can be done? Thanks, -Asfar ...

Change to foreign currency in POS 1.0 SP 1a
I am new to MS Dynamics POS and would appreciate assistance in changing the default currency from US$ to Nigeria currency. Simply, I would like the $ symbol change to N. Thanking you for your assistance. Thank you folks. I found the answer in Junaid Idrees'response to Tim Simth's post on 7/24/06. "Sokan33" wrote: > I am new to MS Dynamics POS and would appreciate assistance in changing the > default currency from US$ to Nigeria currency. Simply, I would like the $ > symbol change to N. > > Thanking you for your assistance. ...

Import/Export sql tables to an XML file?
Hi, How can I export/import data from SQL server tables to/from an XML file? Note: I want to tdo this from a desktop application written in c# and uses sql server tables for storing data. Is there a way to do this? Also, are there libraries that already do this? Thanx in advance... ...

importing excel files into outlook 2007
I did an import and it worked perfectly. I tried to ddo a second, and am receiving a message that - an error occuredwhile importing or exporting and the import/export was terminated. MAPI error 0x80070057 was reported. please try again. I have rebuild the file, changes names and still receive the same message. I looked on ms faq but can't find how to fix the problem. Can anyone help. Thanks Dick Take a look at both of these sights... http://www.pcreview.co.uk/forums/thread-854669.php http://support.microsoft.com/kb/329295/EN-US/ Anvil22 wrote: >I did...

Max limit in resource.h file of VC++
Hi, We specify the next step number for the resources, commands and control by the following. _APS_NEXT_RESOURCE_VALUE _APS_NEXT_COMMAND_VALUE _APS_NEXT_CONTROL_VALUE Do we have any way to restrict the numbers or specify the max limit. eg. I want my resource to have command values from 1 to 100. So #define _APS_NEXT_COMMAND_VALUE 1 // Next command number Can I specify somewhere in the resource.h file saying 100 is the max if it goes beyond 100, throw an error? Thanks, Prashant. ...

Can't open XP file in Windows
We have XP machines and Windows machines. A Publisher file was created in XP and I am unable to open it in Windows. The error message is "You cannot open a file from a different version". I would appreciate any assistance on this issue. Hi gwen (anonymous@discussions.microsoft.com), in the Microsoft� newsgroups you posted: || We have XP machines and Windows machines. A Publisher file || was created in XP and I am unable to open it in Windows. || The error message is "You cannot open a file from a || different version". I would appreciate any assistance on || this issu...

Opening Publisher 2000 file with Publisher 2003
I have been sent a file created in 2000, but use 2003, which says it cannot open earlier versions. Is there a download solution to this? -- Ghento Publisher 2003 will open 2000 documents. Some things to try: Disable your anti-virus software. Try opening the file in safe mode. Publisher 2000 and 2003 uses different WordArt, this could be a problem. Publisher 2003/2002 Add-in: WordArt Compatibility http://www.microsoft.com/downloads/details.aspx?FamilyId=897AA11B-A37D-4586-A1A7-54BBEA375AE2&displaylang=en How to troubleshoot a damaged publication in Publisher http://support.microsoft....