|
So could someone please help me. The reason why I posted it in the C++ section because I could not find the DirectX message boards.
Thanks
Andrew McIntyre
|
|
|
|
|
You actually don't need a DirectX forum. If you need to post a job advertising, there is a Job Board [^] (however you have to pay for). There's even a Collaboration / Testing [^] one.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I just need someone maybe on here to help me with the DirectX or someone could point me to a website where I can post a job advertisement for FREE.
Andrew McIntyre
|
|
|
|
|
MrMcIntyre wrote: I just need someone maybe on here to help me with the DirectX or someone could point me to a website where I can post a job advertisement for FREE.
You may try the Collaboration/Testing forum (I've already given you the link).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Suppose I have a parent class CParent. Suppose I have two other classes, CChildA and CChildB, which both inherit from CParent. Suppose I need to load two instances in memory, but other application conditions affect whether I'm working with CChildA or CChildB. This is obviously do-able with polymorphism like this:
CParent *pChildX = 0, *pChildY = 0;
At some point later I can make the appropriate assignments according to my application conditions:
pChildX = new CChildA();
pChildY = new CChildB();
My question is, what happens when run this code:
delete pChildX;
delete pChildY;
Is the child object fully deleted? I think it would, but it I'm confusing myself by thinking somehow only the CParent component of the data would be deleted, and that there would be a memory leak since the "delete" was not called on explicit CChildA or CChildB variables.
Please someone tell me I'm overthinking this.
|
|
|
|
|
Never mind. I just answered my own question. The answer is my application has memory leaks coming out of my ears. I just found an article that explains you need the keyword "virtual" in your destructor declaration. I haven't been doing that. Shame, shame, shame!
In case anyone else finds it useful, here's the link to the article.
|
|
|
|
|
My code was compiled correctly, no errors or bugs. but when I run the program by the time I get to the end I get a fatal exception. Here is my code:
#include "stdafx.h"
#include <iomanip>
#include <iostream>
#include <fstream>
#include <conio.h>
#include <windows.h>
#include <string>
#include <stdio.h>
using namespace std;
struct resident{
char firstName[64];
char lastName[64];
char middleName[64];
unsigned short int ageRes;
string dob;
unsigned long int social;
string eyeColor;
string hairColor;
int height;
char gnd[12];
};
struct family {
string gContact_F;
string gContact_L;
string gContact_f;
string gContact_l;
};
struct term {
char Term[12];
unsigned short int monthTerm;
};
void Resident();
void Stats();
void Term();
void ouFstream();
int _tmain(int argc, _TCHAR* argv[])
{
Resident();
Stats();
Term();
ouFstream();
_getch();
return 0;
}
void Resident(){
resident r;
cout << "\n\tPlease input the residents information below." << endl << endl;
cout << " First Name: "; cin >> r.firstName;
cout << " Middle Name: "; cin >> r.middleName;
cout << " Last Name: "; cin >> r.lastName;
cout << " Age: "; cin >> r.ageRes;
cout << " Date of Birth: "; cin >> r.dob;
cout << " SSN#: "; cin >> r.social;
cout << " Eye Color: "; cin >> r.eyeColor;
cout << " Hair Color: "; cin >> r.hairColor;
cout << " Height: "; cin >> r.height;
cout << " Gender: "; cin >> r.gnd;
cout << endl << endl;
}
void Stats(){
family s;
cout << "Family Contact(1)." << endl << endl;
cout << " First Name: "; cin >> s.gContact_F;
cout << " Last Name: "; cin >> s.gContact_L;
cout << "\t---------" << endl;
cout << "Family Contact(2)." << endl << endl;
cout << " First Name: "; cin >> s.gContact_f;
cout << " Last Name: "; cin >> s.gContact_l;
cout << endl << endl;
}void Term(){
term t;
cout << "Long term/Short (L/S)" << endl << endl;
cout << " Term: "; cin >> t.Term;
cout << " Month(s): "; cin >> t.monthTerm;
cout << endl << endl;
}
void ouFstream(){
char MM[64];
char DD[12];
char YYYY[12];
char mm[64];
resident R;
cout << "Input date of application." << endl << endl;
cout << " Month: "; cin >> MM;
cout << " Day: "; cin >> DD;
cout << " Year: "; cin >> YYYY;
strcat (MM, "_");
strcat (MM, DD);
strcat (MM, "_");
strcat (MM, YYYY);
strcat (MM, "_mem#_");
strcat (MM, R.lastName);
ofstream output;
output.open("Healthcare_Statistics.txt");
if(output.fail()){
cout << "Failed opening file: " << output << "!" << endl;
exit(1);}
}
|
|
|
|
|
Well, your best friend is the debugger (see the call stack window). Anyway using cin & strcat that way can easily make exceptions occur.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Like CPallini replied, there is probably some buffer overflow that is happening with the cin/strcat combination.
I suggest you initialize all local variables and local structure variables to zero before using them.
Next I suggest you replace cin >> with cin.getline where you can specify a maximum count of characters to read.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
You should be able to eliminate 90% of this code and still be able to reproduce it. Narrow the problem down to just a handful of statements.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hello,
i need help regarding an ActiveX issue.
I have ported a graphical qt4.4 thread/socket application from an exe to a activeX dll.
--> ethernet/socket communication will be done in one sep. thread
The application displays a live image from a cam via ethernet/sockets.
Now i have following issue.
In the normal exe application the image displaying is fast/no interruptions.
If i test the activex dll in a container (same source as exe) the image updateing is not jerk-free!?
What can i do to improve it?
Please help.
I'm thankfully for any ideas, tipss etc...
thank you,
best regards,
|
|
|
|
|
If a file (maybe exe, txt, html, chm etc) is copied, installed or uploaded to everywhere - such as compressed or uncompressed Windows OS, UNIX, Apple etc and in different place (US, AU etc) - and viewed, executed (but not modified or edited):
does Last modified file time related to WIN32_FIND_DATA and function FindFirstFile(...) keep constant and unchanged?
I nned the info for auto-update software.
|
|
|
|
|
I will suggest you use a hash function, for example MD5, for checking if a file has been modified ot not.
-Saurabh
|
|
|
|
|
My static linked MFC exe file is over 7M now, I think it shouldn't be so large.
I have tried two ways to reduce its size:
- Change resource bmp files from 24 bits to 16 bits
What software can do the change?
As I tested, both PaintBrush and PhotoShop (version 6) can not do.
How about CorelDraw? I have CorelDraw but didn't install.
- Exclude some lib files.
I did nothing for this, because I don't know how to detect which lib is unused and how to disable it.
Do you have any idea to reduce exe size with detail hints?
|
|
|
|
|
If you link statically to MFC, you're exe size is going to get bigger.
You should have the option of using the shared version of MFC, if you want to really think about a small exe size.
There are also other techniques of combining sections and using the proper compiler switches.
Here are a few articles on reducing the size of the exe -
http://msdn.microsoft.com/en-us/magazine/cc301696.aspx[^]
http://www.catch22.net/tuts/minexe[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
the mspaint.exe can convert 24bit true color image to 16bit ones.
|
|
|
|
|
Member 4470227 wrote: the mspaint.exe can convert 24bit true color image to 16bit ones.
Paint sucks on decreasing color depth. Irfan View , for instance, is really better.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
try UPX to pack and compress your executeable files.
|
|
|
|
|
Member 4470227,
I don't know software you mentioned.
Is mspaint.exe PaintBrush or Paint program of Windows default tool?
Or how to get them for free?
|
|
|
|
|
|
The paint program is pbrush.exe, and has been part of the OS install since Windows 3, if not before. It's got better as the years go on though!
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
couldn't you use JPEG instead of BMP images? depending on size and complexity JPEG tends to compress images by a factor of 3 to 10 to 30.
Luc Pattyn
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
With Visual Studio 2005, under Linker Optimization, make sure you are eliminating unreferenced data, enable COMDAT folding and set Optimize for Windows98 to No.
Check if you are overusing templates. They tend to chew up a lot of space. You could also turn off intrinsic functions. Under code generation, turn off "Buffer Security Check" (some will disagree, if you read up on it, you'll find it's nearly useless, but does use space.) Under Language, i always turn of Run-Time Type Info (savings is small, but I never use it so why not?) Reexamine everything you are linking to; sometimes you use a tiny function that pulls in a huge amount of code even though you don't really need it.
If your resource bitmaps are big, consider PNG or JPG.
|
|
|
|
|
includeh10 wrote: Change resource bmp files from 24 bits to 16 bits
What software can do the change?
As I tested, both PaintBrush and PhotoShop (version 6) can not do.
How about CorelDraw? I have CorelDraw but didn't install.
Decreasing the color depth may do the trick, provided you have many big images. Anyway this doesn't affect the executable's size when it is loaded in memory, I guess (unless you dynamically load, and then discard, images).
IrfanView [^] a freeware image viewer, is very good in decreasing image color depth.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Decreasing the color depth may do the trick, provided you have many big images. Anyway this doesn't affect the executable's size when it is loaded in memory,
//-----------------------------------
It does affect exe size, when I change bmp from 24 bits to 256 color, exe size becomes smaller.
|
|
|
|