|
Hi
From what I understand I feel its very easy task.
All you need to know is how to read and write from a file and display those values, right ?
For this what I suggest is some thing like this.
The file should be as [length in byte][data].
Hope this would help..
regards
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
You might want to look at WritePrivateProfileString and GetPrivateProfileString. Tbey will handle this format very easily.
Good luck.
Karl
|
|
|
|
|
As has already been mentioned, this is the format of a standard .INI file. Several functions exist for processing files of this type.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
hi,
Thank you very much for your valuable reply.I browsed some articles and i got to know what an INI file is and it is matching with my File format.Thanx a lot for the information.
Now my requirement is that i should read the file from the disk and display it.But the user should not be able to edit it directly.I have to give some options for adding a section or key.when a user selects add section option a combo box should be diaplayed populated with all the section in the file.can u pls guide me in this reagrd.ie,How to populate the combo box with the sections?
|
|
|
|
|
shanil80 wrote:
Now my requirement is that i should read the file from the disk and display it.
This is where GetPrivateProfilexxx() comes in.
shanil80 wrote:
But the user should not be able to edit it directly.
You'll need to hide the file, or change its permissions at the OS level. Whatever you do, however, will not keep the most determined person from altering the file.
shanil80 wrote:
How to populate the combo box with the sections?
TCHAR szBuffer[1024];
GetPrivateProfileString(NULL, NULL, "", szBuffer, sizeof(szBuffer), ...); Now make multiple calls to CComboBox::AddString() .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
hi david,
Thank You very much for your valuable reply.I am taking about an application similar to DoneEx file manager.So if you can help me more in this plase do that.....I will be very thankful to you...
Can you suggest me some books or online documents where i can get some information on PrivateProfileString() and adding data to combo Boxes.
|
|
|
|
|
shanil80 wrote:
I am taking about an application similar to DoneEx file manager.
I'm not familar with it.
shanil80 wrote:
Can you suggest me some books or online documents where i can get some information on PrivateProfileString()...
Here.
shanil80 wrote:
...and adding data to combo Boxes.
Here.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
i want to run time image load.
image path folder is in the database.
fo example.."C:\Documents and Settings\mount top.bmp"
i have image load fail error..
please explain me..
for image load fail error.
following code is i using my demo.
void CTestbitmapView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
ResizeParentToFit();
if(m_hBmpNew != NULL )
DeleteObject(m_hBmpNew);
sourcex=sourcey=0;
CString file;
file="C:\Documents and Settings\mount top.bmp";
m_hBmpNew = (HBITMAP) LoadImage(
AfxGetInstanceHandle(),
file,
IMAGE_BITMAP,
0,
0,
LR_LOADFROMFILE);
if( m_hBmpNew == NULL )
{
AfxMessageBox("Load Image Failed");
}
else
{
m_stc.GetClientRect( &rectStaticClient );
rectStaticClient.NormalizeRect();
m_size.cx=rectStaticClient.Size().cx;
m_size.cy=rectStaticClient.Size().cy;
m_size.cx = rectStaticClient.Width();
m_size.cy = rectStaticClient.Height();
m_stc.ClientToScreen( &rectStaticClient );
ScreenToClient( &rectStaticClient);
m_pt.x = rectStaticClient.left;
m_pt.y = rectStaticClient.top;
GetObject( m_hBmpNew , sizeof(BITMAP), &m_bmInfo );
VERIFY(m_hBmpOld = (
HBITMAP)SelectObject
(m_dcMem,m_hBmpNew ) );
offsetx= m_pt.x;
offsety=m_pt.y;
InvalidateRect(&rectStaticClient);
}
}
|
|
|
|
|
hi,
Replace:
file="C:\Documents and Settings\mount top.bmp";
with
file="C:\\Documents and Settings\\mount top.bmp";
|
|
|
|
|
please make the following correction...
file="C:\\Documents and Settings\\mount top.bmp";
m_hBmpNew = (HBITMAP) LoadImage(
AfxGetInstanceHandle(),
file,
IMAGE_BITMAP,
0,
0,
LR_LOADFROMFILE);
cheerz..
|
|
|
|
|
Thank you !!
and another way i found...
file="C:/Documents and Settings/mount top.bmp";
m_hBmpNew = (HBITMAP) LoadImage(
AfxGetInstanceHandle(),
file,
IMAGE_BITMAP,
0,
0,
LR_LOADFROMFILE);
|
|
|
|
|
happy programmin.....;)
cheerz.....
|
|
|
|
|
Hi,
I am trying to display Japenese characters in my Unicode application's tree
view control. The English characters are displayed fine but it's not
displaying Unicode characters perfectly, insted it displays few junk
characters.
I tried changing the application to MBCS and Treeview control displays
Japenses characters fine in MBCS.
Can anyone please help me how can i enable TreeView control to display
Unicode characters. I tried with TreeView_SetUnicodeFormat API but with no
sucess .
Any idea ?
Reagrds
Alpha
|
|
|
|
|
Write a program that can be used as a math tutor for a young student. The program should display two random numbers which can be added, subtracted, multiplied or divided. The program should pause while the student works on the problem. When the student is ready to check the answer, he or she can press a key and the program will display a message of Congratulations if the result is correct. If the answer is incorrect, a message should be printed showing the correct answer.
Initially, the user to be prompted to enter a number to use a random number seed. The program should include a menu allowing the user to select Addition, Subtraction, Multiplication or Division. The final selection should allow the user to Quit the program. After the user has finished the math problem, the program should display the menu again. This process should be repeated until the user chooses to quit the program.
|
|
|
|
|
My Suggestion is start writing your program ,if any problem persisit then write that problem here.
no body going to do homework of yours
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Hello everyone,
My question is how to change the font color of slide.
I have Automated PowerPoint Using Visual C++ MFC,such as:
_Application app;
Presentations presentations;
_Presentation presentation;
Slides slides;
_Slide slide;
ShapeRange shaperange;
Shapes shapes;
Shape shape;
TextFrame textframe;
TextRange textrange;
Font font;
FillFormat fillformat;
ColorFormat colorformat;
ShadowFormat shadow;
if(!app.CreateDispatch("Powerpoint.Application", &e))
{
CString str;
str.Format("CreateDispatch() failed w/err 0x%08lx", e.m_sc),
AfxMessageBox(str, MB_SETFOREGROUND);
return;
}
app.SetVisible(TRUE); Presentations presSet(app.GetPresentations());
_Presentation pres(presSet.Add(TRUE));
Slides slideSet(pres.GetSlides());
_Slide slide1(slideSet.Add(1, 2));
// Add text to slide, by navigating the slide as follows:
// slide1.shapes(#).TextFrame.TextRange.Text
{
Shapes shapes(slide1.GetShapes());
Shape shape(shapes.Item(COleVariant((long)1)));
TextFrame textFrame(shape.GetTextFrame());
TextRange textRange(textFrame.GetTextRange());
textRange.SetText("My first slide");
}
{
Shapes shapes(slide1.GetShapes());
Shape shape(shapes.Item(COleVariant((long)2)));
TextFrame textFrame(shape.GetTextFrame());
TextRange textRange(textFrame.GetTextRange());
textRange.SetText("Automating PowerPoint is easy\r\n"
"Using Visual C++ is powerful!");
font = textrange.GetFont();
font.SetName("Comic Sans MS"); //Set the font name.
font.SetSize((float)48);
}
Now the question is how to change the font color????
Help me,please!!
Thanks a lot!!;P
|
|
|
|
|
Hello everyone,
My question is how to change the font color of slide.
I have Automated PowerPoint Using Visual C++ MFC,such as:
_Application app;
Presentations presentations;
_Presentation presentation;
Slides slides;
_Slide slide;
ShapeRange shaperange;
Shapes shapes;
Shape shape;
TextFrame textframe;
TextRange textrange;
Font font;
FillFormat fillformat;
ColorFormat colorformat;
ShadowFormat shadow;
if(!app.CreateDispatch("Powerpoint.Application", &e))
{
CString str;
str.Format("CreateDispatch() failed w/err 0x%08lx", e.m_sc),
AfxMessageBox(str, MB_SETFOREGROUND);
return;
}
app.SetVisible(TRUE); Presentations presSet(app.GetPresentations());
_Presentation pres(presSet.Add(TRUE));
Slides slideSet(pres.GetSlides());
_Slide slide1(slideSet.Add(1, 2));
// Add text to slide, by navigating the slide as follows:
// slide1.shapes(#).TextFrame.TextRange.Text
{
Shapes shapes(slide1.GetShapes());
Shape shape(shapes.Item(COleVariant((long)1)));
TextFrame textFrame(shape.GetTextFrame());
TextRange textRange(textFrame.GetTextRange());
textRange.SetText("My first slide");
}
{
Shapes shapes(slide1.GetShapes());
Shape shape(shapes.Item(COleVariant((long)2)));
TextFrame textFrame(shape.GetTextFrame());
TextRange textRange(textFrame.GetTextRange());
textRange.SetText("Automating PowerPoint is easy\r\n"
"Using Visual C++ is powerful!");
font = textrange.GetFont();
font.SetName("Comic Sans MS"); //Set the font name.
font.SetSize((float)48);
}
Now the question is how to change the font color????
Help me,please!!
Thanks a lot!!
cengyikun
|
|
|
|
|
Is there a way to add html code to a property sheet. I've done it with my About dialog by subclassing from CDHtmlDialog. But I've tried doing the same thing with a property sheet and cannot get it to work. It compiles OK, but I can't see how to display the page. For my About dialog, I just called DoModal. But when I ty that with the property sheet, it fails with Ambigous Call, probably because I also did an AddPage call to get the sheet added in the first place. Does anyone have any suggestions as to how to do this?
Jack
|
|
|
|
|
i'm trying to design a program that prompts the user for an integer adn then prints out all prime numbers up to that integer. i'm a beginner and i'm kind of stumped can anyone help
j pena
|
|
|
|
|
#include <iostream>
bool IsPrime (unsigned int);
int main(int argc, char* argv[])
{
unsigned int max;
cout << "Give an integer number: "; cout.flush;
cin >> max;
cout << endl;
for (unsigned int n = 1; n <= max; n++)
if (IsPrime(n))
{
cout << n << ", ";
cout.flush;
}
cout << endl;
return 0;
}
|
|
|
|
|
DaFrawg wrote:
I don't know how you are going to check that, there are several ways to do that
then why did u posted this ?
redindian
|
|
|
|
|
I'm not making his homework. I just give him a sample skeleton, not the solution. Sure I know a way to find out if it is a prime or not, I've done that before. But if you can't think of one by yourself, you just have to take math classes.
|
|
|
|
|
herez one way of doing it.....;)
#include<iostream.h>
#include<conio.h>
void main(void)
{
int number;
BOOL flag=0;
clrscr();
cout<<"Enter the number : ";
cin>>number;
cout<<"The numbers are :"\n";
for(int j=1;j<=number;j++)
{
flag=0;//reset the flag.....
for(int i=1;i<j/2 && flag==0;i++)
{
if(j%i==0)//if no remainder.....then set the flag
flag=1;
}//end of for(int i=1;i<j/2 && flag==0;i++)
if(flag==0)
cout<<j<<"\n";
}//end of for(int j=0;j<=number;j++)
}//end of void main(void)
hope that helpz.....
cheerz.....
|
|
|
|
|
Looks like homework to me, so I won't give you answers. I don't like the ones others have given, though they will work. (I even have a book someplace that tells how to check if a number is prime, but it fails on Newton primes - I can't recall exactly what they are called)
What I would do, and what I suspect your professor wants: create a linked list of all known primes, up to the current number. This list starts empty. You start by checking the lowest unknown number against the list. If anything in the list divides your number it is not prime. If the number is prime place it in the list. Either way move to the next highest number.
If this isn't enough, google will reveal several C programs that do the same thing. Don't bother handing them in though. Professors are fairly good at spotting those programs even after students hide the origions. Besides, I might get a job with you latter, and I'll want you to have done the work then.
|
|
|
|
|
I have not been working on a native C++ program of mine for a while and today I tried to compile it (using Visual C++ .NET 2003) and I got the error:
Command line error D2022 : cannot open 'o:\...\Debug\RSP00000F.rsp'
Does anyone have any idea what is going on?
Happy Programming and may God bless!
"Your coding practices might be buggy, but your code is always right."
Internet::WWW::CodeProject::bneacetp
N-Tech Productions
http://www.n-tp.com/
|
|
|
|