|
CFont m2;
m2.CreateFontA(20,0,0,0,FW_NORMAL,FALSE,FALSE,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH | FF_SWISS,_T("System"));
GetDlgItem(IDC_STATIC2)->SetFont(&m2);
|
|
|
|
|
|
|
one little problem it's showing char highlited and i want show in nornal font.
|
|
|
|
|
NewVC++ wrote: one little problem it's showing char highlited and i want show in nornal font.
Not sure what you mean but if your looking for the default dialog font it can be obtained by changing the font face to: _T("MS Shell Dlg 2") which is a Logical Font[^] that maps to default font used throughout the operating system on Windows 2000 and later.
Best Wishes,
-David Delaune
|
|
|
|
|
Can you more explain what is highlited ?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
I have static text more than one.And i set the font only one static text.Every things is working fine but problem is that it's showing highlited in related to other static text.But i want to set only it's size and all things i want to show nornmal as like all normal satic text show.Plz help me
Thanks in advance
|
|
|
|
|
I need to see your project.showing highlited??
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Hi, I'm trying to do this program in C++ without MFC that creates an owner-drawn listbox with the WS_VSCROLL style. Owner drawing the listbox and listbox items is not a problem, but how do I owner draw the vertical scrollbar within the listbox? Even if I set the listbox style to LBS_OWNERDRAWVARIABLE or LBS_OWNERDRAWFIXED, the scrollbar still seems to draw normally.
Thanks!
KR
|
|
|
|
|
|
That example uses MFC which I am not using in this program, also what I want to do is ownerdraw the internal scrollbar itself, I don't want to superimpose a new scrollbar control over top of the listbox. Isn't there a way to set the listbox's scrollbar to ownerdraw and handle that?
KR
|
|
|
|
|
|
Thanks, I was able to find what I needed in that article.
KR
|
|
|
|
|
OK everyone, heres the deal.
i have the following code written.
what this program is supposed to do is read from a file "program6.txt".
in that file are lines of text in the following format:
"0 Jack Simpson 330 Maple Overton MO 64155"
the number preceeding the name ranges from 0-2, with 0 meaning that line is student info, 1 meaning teacher info, and 2 meaning staff info.
after reading from the file, the program is supposed to write all students to one text file, all teachers to another, and all staff to another. (creating 3 text files).
i have the program to where it can read in the information, and it determines the classification of each person, and even creates the output files, however, it does not place the information into those text files.
i cannot figure out why.
any help would be greatly appreciated
Zak
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
using namespace std;
void readFile(int &type, string &fName, string &lName, int &houseNum, string &street, string &city, string &state, int &zip);
void printStudent(int &count, int &type, string &fName, string &lName, int &houseNum, string &street, string &city, string &state, int &zip);
void printTeacher(int &count, int &type, string &fName, string &lName, int &houseNum, string &street, string &city, string &state, int &zip);
void printStaff(int &count, int &type, string &fName, string &lName, int &houseNum, string &street, string &city, string &state, int &zip);
int main ()
{
int type, zip, houseNum;
string fName, lName, street, city, state;
readFile(type, fName, lName, houseNum, street, city, state, zip);
system("PAUSE");
return 0;
};
void readFile(int &type, string &fName, string &lName, int &houseNum, string &street, string &city, string &state, int &zip)
{
ifstream fin;
ofstream fout;
int count=0;
fin.open("program6.txt");
if(!fin)
{
cerr << "Error: file could not be opened" << endl;
system("PAUSE");
exit(1);
}
if(fin)
{
cout << "FILE OPENED" << endl;
}
do{
fin >> type >> fName >> lName >> houseNum >> street >> city >> state >> zip;
count++;
cout << count << endl;
if(type==0)
{
printStudent(count, type, fName, lName, houseNum, street, city, state, zip);
}
else if (type == 1)
{
printTeacher(count, type, fName, lName, houseNum, street, city, state, zip);
}
else if (type==2)
{
printStaff(count, type, fName, lName, houseNum, street, city, state, zip);
}
}while(!fin.eof());
fin.close();
fout.close();
cout << "End-of-file reached.." << endl;
system("PAUSE");
}
void printStudent(int &count, int &type, string &fName, string &lName, int &houseNum, string &street, string &city, string &state, int &zip)
{
ofstream fout;
fout << "Students: " << endl << "First Name Last Name House Number Street"
<< " City State Zip" << endl;
fout.open("students.txt",ios::app);
fout << fName << lName << houseNum << street << city << state << zip << endl;
fout.close();
}
void printTeacher(int &count, int &type, string &fName, string &lName, int &houseNum, string &street, string &city, string &state, int &zip)
{
ofstream fout;
fout << "Teachers: " << endl << "First Name Last Name House Number Street"
<< " City State Zip" << endl;
fout.open("teachers.txt",ios::app);
fout << fName << lName << houseNum << street << city << state << zip << endl;
fout.close();
}
void printStaff(int &count, int &type, string &fName, string &lName, int &houseNum, string &street, string &city, string &state, int &zip)
{
ofstream fout;
fout << "Staff: " << endl << "First Name Last Name House Number Street"
<< " City State Zip" << endl;
fout.open ("staff.txt",ios::app);
fout << fName << lName << houseNum << street << city << state << zip << endl;
fout.close();
}
</iomanip></string></fstream></iostream>
|
|
|
|
|
I'm no expert at C++ (MASM is my choice), BUT:
You have to do this once for each file at the same time you open the input file - remove the // comment:
Zak Forlow wrote: //fout.open ("students.txt",ios::app);
You don't want to open and close each time - open all of them once at the beginning and close all of them once when all done:
Zak Forlow wrote: fout.open("students.txt",ios::app);
Zak Forlow wrote: fout.close();
You also may need to Create the three files instead of just opening them.
I may be totally wrong, but that is what I'd try.
Dave.
|
|
|
|
|
Zak Forlow wrote: however, it does not place the information into those text files.
Most likely because each time the printXXX() function is called, the file is overwritten. Try adding ios::nocreate to the open() call.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Two thread access a std::list object, either of two will add to/(delete) the std::list.
When make critical section or mutex guard, I know can make the std::list safe.
But does std::list itself implemented thread-safe?
Thanks advanced for helping unlock my mind!
|
|
|
|
|
You failed to mention which implementation of STL you are using as there are several available. These include SGI-STL, STLPort, Dinkumware and other minor vendors. There are some slight differences in how each handle concurrency. With that being said, the C++ standards do not make any guarantees about thread safety with iterator reading/writing to std::list from multiple threads. This essentially means that it is up to the software engineer to ensure thread-safety.
Best Wishes,
-David Delaune
|
|
|
|
|
Really thank you. You do me a big favor!
|
|
|
|
|
Hi,
I got this linking error trying to build a project using GLUI in VisualStudio2005 on a WinXP media center SP2 machine:
warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
All the needed .dll, .lib, .h files are in the correct folders.
The libraries glui32.lib, glut32.lib, etc etc are correctly linked in the project properties.
As shown in http://www.codeproject.com/KB/bugs/linkererrors.aspx[^] I used the option Multi-Threaded Debug DLL in the code generation field of the C/C++ tab, in Project settings.
Last, I tried to add the MSVCRT library to the ignore list, and the program actually builds, but results in a crash when launched.
The only differences I see are that I started as "empty project" (not win32 console application) and I used options for debugging (I used Program database for edit and continue, disabled all the optimizations, and used a x86 machine as a target machine).
I'm getting quite mad to solve this, thank you in advance for any help
L.
|
|
|
|
|
Did you check this link[^]? It seems helpful.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Thank you Jijo,
I didn't notice that link but actually it didn't work out..sigh
Any other possible idea? Thanks
|
|
|
|
|
LostPitch wrote: Last, I tried to add the MSVCRT library to the ignore list, and the program actually builds, but results in a crash when launched.
What does the debugger tell you when you run it in Debug mode?
|
|
|
|
|
Thanks for the help Randor,
the debugger tells me
"Unhandled exception at 0x1023201c (msvcr80d.dll) in Robi.exe: 0xC0000005: Access violation writing location 0xcdcdcd00"
even if I ignored the libraries libc.lib, libcmt.lib, msvcrt.lib, libcd.lib, libcmtd.lib, as suggested in the previous reply..
It is possible to obtain the same error downloading the zip available at http://www.css.tayloru.edu/%7Ebtoll/resources/graphics/opengl/xp/msvc/gluiProject.zip[^], and ignoring the libraries as I did...
|
|
|
|
|
Problem solved: I post to help other user that are having the same problem:
If the project uses GLUI, just import the GLUI header file avoiding gl.h, glu.h, glut.h.
Then set c++ -> code generation -> runtime library -> multi-threaded DLL (/MD).
Don't use multi-threaded debug or it will conflict with MSVCRT, ignore the library will not give any result.
That should work fine.
If you're instead working with glut remember to put in the project properties -> c++ -> preprocessor definition use GLUT_BUILDING_LIB: it solves a conflict with the ridefinition of the exit() funcion in stdlib.h (more details on http://social.msdn.microsoft.com/Forums/en-US/Vsexpressvc/thread/4cf463c1-5fee-4daa-b135-be8b06ab7f8f/[^]).
|
|
|
|
|