|
Does anyone have a way of drawing with the GDI API (LineTo, ArcTo, etc) and create anti-alising (smoother looking vectors) ? Adobe Illustrator, CorelDraw do it, are they drawing to an off screen image and bitblting ? or is there some other way ? I don't want to use GDI+
Thanks in advance
Tony Teveris
Gerber Scientific Products
Senior Software Engineer
Phone: 860 648 8151
Fax: 860 648 8214
83 Gerber Road West
South Windsor, CT 06074
|
|
|
|
|
Okay here's a problem I am having:
I create a pointer to a char like so:
char *test = new char;
then I pass that pointer to a class member function which fills it with data from a file. Heres the code for that:
bool FileManager::ReadString(LPSTR StringData)
{
char SingleChar;
bool done = false;
while (done != true)
{
if(ReadData(&SingleChar, 1)==2)
{
return true;
}
switch (SingleChar)
{
case 10:
case 13:
{
done=true;
}break;
default:
{
*StringData = SingleChar;
StringData++;
}break;
}
}
*StringData = 0;
StringData++;
return true;
}
Then afterwards in the function that called the member function I do a:
delete test;
When it runs this piece of code I get:
Debug Error!
Program: c:\JD's Projects\FileManager\Debug\FileManager.exe
DAMAGE: after Normal block (#38) at 0x00851FC0.
Any Ideas?
thanks,
JD
|
|
|
|
|
Your test variable is a pointer to a SINGLE char value. If you want to store an array of chars i.e. a string, you will have to declare an array:
char* pArray = new char[NumChars + 1];
where NumChars is the number of characters you want to store. If you don't know in advance how many you want to store, pick a large constant value. Note the extra one added to accommodate the null-terminator at the end of the string. This is a style issue, you may wish to include the null-terminator in the NumChars count.
Now when you use your pointer arithmetic:
StringData++;
you will be using valid allocated memory. Remember that when you come to deallocate an array, the syntax is as follows:
delete []pArray; // Note the square brackets
On a related note, you might want to look at the standard library's basic_string<> template (STL). use MSDN - it can simpify string handling a great deal and is a good way to learn about templates.
Hope that helps.
|
|
|
|
|
I'm working on a program that at one point needs to display the user's "public" IP address. I'm sure I'm forgetting the technical name for this, so for now "public" will have to do. Assuming their running through a router, all the techniques I know will return addresses like 192.168.1.100 or something similar provided by their router. How do I find (programatically) one IP address as seen by external sites?
Thanks!
|
|
|
|
|
Assuming the router supports SNMP. You will have to interogate the routers routing table in order to determine the public ip addresses used.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Hello,
it seems something has drastically changed on Windows 2003, if we write to the registry.
I was using the code example from JOHN11 (How to Save and Restore Registry Keys) which is working without any problems on Windows 2000.
If I use the same tool on 2003, export the registry to a file works fine, but importing takes very long. (using option "/R" from JOHN11's tool) The function "RegRestoreKey" hangs some how. I was using the same registry key (which was generating about an 8 MB file). No problems on 2000 (about 30 seconds). On windows 2003 the function returned after about 15 minutes.
I was also chaning the possible parameters without success (REG_NO_LAZY_FLUSH)
Do you have any clue if there is a new "registry" feature on 2003 which delays the "RegRestoreKey" ?
Can we tune this somewhere?
Thanks a bunch for your hints!
Best regards
Farby
|
|
|
|
|
I just finished making a file splitter, and im stumped as to what i should move on to, i would like to do something else with file io, anyone got any suggestions as to what i could make?
|
|
|
|
|
A file joiner ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
When I was in undergraduate school, we did quite a few programs that used stdio as the input, and stdout as the output. We were on a Unix box so piping was a big deal, too. Here are some smaller projects that taught, and at the same time, were easy to implement:
Create a file with random numbers, one per line. Pipe that file through an averager, and a sorter (not the one that comes with the OS).
A grading program. Each line of the file should contain the student's name, followed by 0 or more scores, each separated by a vertical bar (or some other easy-to-read character). Pipe that file through a grading program to give each student's average score, and perhaps a letter grade. Sort students by average score.
Roman numeral to arabic converter.
Palindromes
A program that, given a .h or .c file as a starting point, will go through the file and show the #include hierarchy. Each #include encounter will be a "recursive" call. Determine if a circular dependency exists.
A program that will determine if a pattern matches an input string.
A program that will determine if a number is prime.
These are just some off the top of my head.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Is it possible to create a class with template parameters that is derived from a CView and then dynamically create it in an MDI/SDI framework? If so, how would one go about doing this?
Thanks!
|
|
|
|
|
this is a two-part question. First, I'd like to know how I can allow the user to drop down the combobox's list without being able to select anything (because they're viewing a record and shouldn't be allowed to actually change the selection while in browse mode and I don't want the combo disabled). The second question is what function should I override to stop the user from closing the CFormView screen if they're in edit mode? I've tried the WM_DESTROY and the WM_CLOSE, but they're still able to close the form. Any help is appreciated. Thanks in advance.
[insert witty comment here]
bdiamond
|
|
|
|
|
bdiamond wrote:
...how I can allow the user to drop down the combobox's list without being able to select anything (because they're viewing a record and shouldn't be allowed to actually change the selection while in browse mode and I don't want the combo disabled).
Having a screen where some of the controls are enabled, other controls are disabled, and none of them are updateable, is a bit confusing. The selection in the combobox should be that of the current record, and the combobox should be disabled.
bdiamond wrote:
what function should I override to stop the user from closing the CFormView screen if they're in edit mode? I've tried the WM_DESTROY and the WM_CLOSE, but they're still able to close the form.
What if someone got into edit mode but changed their mind?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Okay, I think you're right about the combobox being disabled, but I just hate the way it looks when it's disabled. Is there any way to have it disabled but not have that funky color?
With most of the projects I've done for my company (mostly in VB), it has usually been policy to not let a user exit a screen while in 'NEW' or 'EDIT' mode. If they're in either one of these modes, they have to click 'CANCEL' before they can exit the app. This is just a small in-house program I'm writing, but I was trying to stay consistent with what we've been doing.
Thanks for all your help!!
BTW, are there any free online tests you know of that I could use to test my C++ knowledge? I'm the only one at my company who knows any C++, and I'm self-taught (besides what help programmers like yourself have given me the past few months).
[insert witty comment here]
bdiamond
|
|
|
|
|
bdiamond wrote:
Is there any way to have it disabled but not have that funky color?
I'm not sure to which color you are referring, but disabled controls on my machine are gray. Maybe it's my color scheme.
bdiamond wrote:
With most of the projects I've done for my company (mostly in VB), it has usually been policy to not let a user exit a screen while in 'NEW' or 'EDIT' mode. If they're in either one of these modes, they have to click 'CANCEL' before they can exit the app. This is just a small in-house program I'm writing, but I was trying to stay consistent with what we've been doing.
Understood. When in New or Edit mode, does a modal dialog have focus, with the application sitting in the back? If so, how does one go about closing down the application without first dismissing the dialog?
bdiamond wrote:
BTW, are there any free online tests you know of that I could use to test my C++ knowledge? I'm the only one at my company who knows any C++, and I'm self-taught (besides what help programmers like yourself have given me the past few months).
You could try brainbench.com[^]. I've taken one test. They last about 45 minutes.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I have a problem when starting any application from my VC++IDE (running or steppping), a 30 seconds delay occurs before the program starts.
Do you have any idea ? (this is not a application defined delay )
Tx for any help.
GuimaSun
www.nexsun.com.br
NEXSUN TechZone
|
|
|
|
|
If it is a large project with lots of files, the IDE is most likely going out and checking dependencies. What keystrokes/menu are you using to start the application?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
If ur project contains more files then usaually ur workspace will be very slow
After you open ur project, close all the files, and kept open only the required file which makes it faster.
vidya
|
|
|
|
|
My current project has nearly 450 files. The IDE is fine except for the very first compile. It is at this time that a dependency check is done (and cached). All subsequent compiles behave just like any of my smaller projects.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Guys, the problem is the same with any project, even with a "hello world" with just one source file. Just typing F10/F5 after compile\link and the delay appear
Tx anyway.
GuimaSun
www.nexsun.com.br
NEXSUN TechZone
|
|
|
|
|
Hmmm, there is the remote possibility that the computer's AV software is getting in the way. If no AV software is installed, I'm out of guesses.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I have some experience programming in C# .NET but am new to C++. Could somebody please tell me what the difference between "->" and "." are in C++, which is to say:
when is it appropriate to use
someclass.whatever
and when is it correct to use
someclass->whatever.
Thanks!
|
|
|
|
|
Nevermind, I found it in the documentation. Thanks anyway!
|
|
|
|
|
crushinghellhammer wrote:
someclass.whatever
CSomeClass myClass;
myClass.whatever;
crushinghellhammer wrote:
someclass->whatever
CSomeClass *myClass;
myClass->whatever;
The "." operator is used to directly access the object's members.
Artificial intelligence is no match for natural
stupidity.
|
|
|
|
|
-> dereferences a class object pointer.
SomeClass
{
public :
int a;
};
So if you have SomeClass *oSomeClass = new oSomeClass();
Accessing member variable a is done by first dereferencing the pointer and using the '.'operator: (*oSomeClass).a = 5; which is equivalent to the statement oSomeClass->a = 5;
|
|
|
|
|
In VC6 when creating a CFormView-based app I could still utilize the printing capabilities of the Doc/View architecture. In .Net when I started my app I chose to enable Print/Print Preview, but since I selected CFormView as the base class for my view it told me that I wouldn't be able to have printing functionality. Does anyone know a way around this? Thanks
[insert witty comment here]
bdiamond
|
|
|
|