|
technically, Visual Studio .NET is not 2005 but 2002/2003 only.
they removed the ".NET" from 2005 name because it was confusing too much
|
|
|
|
|
But the OP specifically mentioned the number 2005.
And as the general procedure is the same, I told the steps for VC++ 2005
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
my post was more informative, not criticising anyone
|
|
|
|
|
M. Atul wrote: Is there any need to change in coding to run this project.
You won't know until you try compiling the code in VC03 or 05.
|
|
|
|
|
Hi! I'm trying to compile the below code with the command line compiler but I get a bunch of errors? Errors like 'System' is not a class or namespace name
Can the command line compiler be used on this type of code? This is for dynamic analysis of c code. I have to use the command line compiler.
#include <stdio.h>
#include <stdlib.h>
using namespace System::IO;
using namespace System::Text::RegularExpressions;
void main (void)
{
int index = 0;
String ^line;
Regex^ rx = gcnew Regex(",")
StreamReader^ sr = gcnew StreamReader(testfile.tif);
while ( line = sr->ReadLine() )
{
array<int>^ ia = rx->Split(line);
}
int a=array[index++];
int b=array[index++];
int c=array[index++];
if (a <= 42)
{
b--;
if (c > 1444)
c--;
}
else if (a > 42)
{
do {
a += b;
}
while (b <= 1000);
}
return;
}
|
|
|
|
|
You will probably get more help by asking that in the Managed C++ section.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
kybalion wrote: Can the command line compiler...
There's only one compiler. Even when you compile via the IDE, you are using the "command line compiler."
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
If you have a project that compiles the code ok then you can look at the compiler command line
in the project settings and maybe you'll see what's missing from your command line.
|
|
|
|
|
my project is base on unicode.
i am having a RichEdit control & i want to add unicoded strings on to it
with diffrent font ( BOLD, ITALIC,Diffrnt Font Size etc).
if anyone knows Please help me for it.
Thanks,
Swapnil.
|
|
|
|
|
|
Check out the EM_SETCHARFORMAT message. You can add the text to the control and use
EM_SETCHARFORMAT to alter its format.
Mark
|
|
|
|
|
Hi
All
I want to create Log file in my application to trap error messages in my application. So any body have code to do this, then plz forward me .
Thanks
Atool
Atool
|
|
|
|
|
|
i have writen the following function for open file its gives the selection for multiple files with ctrl+ but when i press ok it will gives folder name directly rather display the list of files in the listview control.
string Utility::GetFile(HWND hWnd)
{
try
{
OPENFILENAME ofn;
WCHAR file[MAX_PATH];
memset(file, 0, MAX_PATH);
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hWnd;
ofn.lpstrFilter = _T("Media Files (*.wmv)\0*.wmv\0All Files (*.*)\0*.*\0\0");
ofn.lpstrFile = file;
ofn.nMaxFile = MAX_PATH;
<code>ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT;</code>
ofn.lpstrDefExt = _T("wmv");
GetOpenFileName(&ofn);
char* tempFile = new char[wcslen(file) + 1];
WideCharToMultiByte(CP_ACP,0,file,-1,tempFile,MAX_PATH,NULL,NULL);
string fileName = tempFile;
if(tempFile != NULL)
{
delete[] tempFile;
tempFile = NULL;
}
return fileName;
}
catch(exception ex)
{
throw ex;
}
}
should i have some extra code for that?
Amit
|
|
|
|
|
amitmistry_petlad wrote: i press ok it will gives folder name directly rather display the list of files in the listview control.
This is what MSDN says:
If the OFN_ALLOWMULTISELECT flag is set and the user selects multiple files, the buffer contains the current directory followed by the file names of the selected files. For Explorer-style dialog boxes, the directory and file name strings are NULL separated, with an extra NULL character after the last file name.
|
|
|
|
|
If I remember correctly, each selection is returned in a single string and then has two null characters at the end. So you will need to read the first string as you have done, then set the pointer to the end of the string to get the next. Do this in a loop until the string is NULL, then you know you got them all.
|
|
|
|
|
yes that's i want.my logic is clear for that ,but the problem is in the file dialog the listed double qotted files in the ,how can i get because in filename string variable i can get the path name of the folder as per the given answer by Mr.Nibu babu thomas.
so if however i can get the list of files then i can do that way which you mention.
amit
|
|
|
|
|
It seems to me as if you havent' understood what WalderMort and Nibu said.
When you allow selecting a multitude of files in the file dialog, i.e. setting the OFN_ALLOWMULTISELECT flag, you should use ::FindFirstFile() / ::FindNextFile() if you're using the OPENFILENAME structure, or parse the string searching for NULL characters. If you're using CFileDialog then you should use CFileDialog::GetStartPosition() / CFileDialog::GetNextPathName() .
If you're unsure what this means, post the code where you're trying to retrieve the file names of the selected files and we can pin-point what you're doing wrong.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
ya now i understand !
thanks,
Amit
|
|
|
|
|
SHFILEINFO FileInfo1;
uploadedFile = util.GetFile(NULL);
the function Getfile is below
string Utility::GetFile(HWND hWnd)
{
try
{
OPENFILENAME ofn;
WCHAR file[MAX_PATH];
memset(file, 0, MAX_PATH);
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hWnd;
ofn.lpstrFilter = _T("Media Files (*.wmv)\0*.wmv\0All Files (*.*)\0*.*\0\0");
ofn.lpstrFile = file;
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT;
ofn.lpstrDefExt = _T("wmv");
WIN32_FIND_DATA data;
GetOpenFileName(&ofn);
char* tempFile = new char[wcslen(file) + 1];
WideCharToMultiByte(CP_ACP,0,file,-1,tempFile,MAX_PATH,NULL,NULL);
string fileName = tempFile;
<code> HANDLE hFind=NULL;
while(fileName.c_str()!=NULL)
{
::FindNextFile(hFind,&data);
}
</code>
if(tempFile != NULL)
{
delete[] tempFile;
tempFile = NULL;
}
return fileName;
}
catch(exception ex)
{
throw ex;
}
}
i am tring to do the red code but i dont how get the handle of the open file dialog and how toget the string which is in that handle.
Amit
|
|
|
|
|
First of all you should really check the return value of ::GetOpenFileName() to see whether the operation was successful or not.
I think the easiest way to get the filenames of the selected files would be to parse the ofn.lpstrFile string.
Something like this:
if( ::GetOpenFileName( &ofn ) )
{
char* pFilename = ofn.lpstrFile;
while( *pFilename++ );
if( !*pFilename )
{
TRACE( "A single file was selected: %s\n", ofn.lpstrFile );
}
else
{
TRACE( "Multilpe files were selected:\n" );
while( *pFilename )
{
TRACE( "%s\\%s\n", ofn.lpstrFile, pFilename );
while( *pFilename++ );
}
}
}
You should be able to just copy/paste the snippet above.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote
|
|
|
|
|
I have finding the such a same code from the MSDN.
is below.
<code>
WIN32_FIND_DATA FindFileData;
HANDLE hFind = INVALID_HANDLE_VALUE;
char DirSpec[MAX_PATH];
DWORD dwError;
printf ("Target directory is %s.\n", argv[1]);
strncpy (DirSpec, argv[1], strlen(argv[1])+1);
strncat (DirSpec, "\\*", 3);
hFind = FindFirstFile(DirSpec, &FindFileData);
if (hFind == INVALID_HANDLE_VALUE)
{
printf ("Invalid file handle. Error is %u\n", GetLastError());
return (-1);
}
else
{
printf ("First file name is %s\n", FindFileData.cFileName);
while (FindNextFile(hFind, &FindFileData) != 0)
{
printf ("Next file name is %s\n", FindFileData.cFileName);
}
dwError = GetLastError();
FindClose(hFind);
if (dwError != ERROR_NO_MORE_FILES)
{
printf ("FindNextFile error. Error is %u\n", dwError);
return (-1);
}
}
return (0);
i will follow your guidline.
thanks
Amit
|
|
|
|
|
its only give the current folder path not given the number of files.
thats why i am confused for last 4 hours .
its only give the current folder name path no number of files.
like
e.g.
D:\test\testfolder1(this is according Mr.Nibu babu thomas) it gives the current path,last folder in which the files stored.
i ask you one question when we open the file dialog and selecting multiple files we can select files
with ctr+ and dipslay it in the file name with double quotes like
File Name :<code>"x.wmv""y.wmv""z.wmv"</code> open
type:*.wmv
then it should come in the WIN32_FIND_DATA variable why it is not come ?
i have add D:\test\testfolder1\* in my sample but its not work.
amit
|
|
|
|
|
Haven't you tried the code I posted in my previous reply?
I thought you would since you said you would "follow my guideline"...
Use the code I sent. It parses the OPENFILENAME::lpstrFile string and it works. Just do whatever you have to do with the filenames at the TRACE locations in my code.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
ya I had try it.but when select number of files from the dialog and select ok . at that time
in (char*) ofn.lpstrFile; contain value c:\test\test1 no any files or serries of file name.when i debug it in pFileName it start with c then : the \ etc.. given the series of chars.
mean when i select it is not gives selected files but given the current folder in which selected files.
I follow your code and the above is result.i am also try with other one let see what happen???
Amit
|
|
|
|