|
It depends on the type of project that you want. If you are simply creating a C++ project that you would like to run from the command line, you will want to select:
WIN32 Console Application
If this will be a windows program choose:
WIN32 Application
Then if it will be a windows application with ATL support choose:
ATL COM Appwizard
Or if you would like MFC support:
MFC Appwizard
you can also create DLLs in order to use your c++ classes from an external executable, in this case simply select the correct project to create the DLL for you.
You can add this project to an existing Workspace that you are working in and have multiple projects to a single workspace by checking the Add to existing workspace checkbox if that choice is available.
Say that you add all of your files into a DLL, and you want that DLL to link into another project in the same workspace, you will go into the project settings for the executable, and click the link tab. Then on the Object/libaray modules edit box, add the name of your DLL project .lib to the line. this will enable the Linker to find all of the exported items from your DLL.
If this does not answer your question please reply.
|
|
|
|
|
yeah i want to use command line!
so i guess i'll just go ahead and use the WIN32 Console Application
right?
thanks again!
|
|
|
|
|
I have a class that formats a string and I am trying to send it to the dialog class.
CNetServerDlg* pNetServer = static_cast<CNetServerDlg*>(AfxGetMainWnd());
pNetServer->PrintLog(strLogOutput);
the strLogOutput is a CString and PrintLog is a function that processes the code. The problem is that PrintLog never gets called. Is there something wrong with the above code or is something else wrong?
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
Frankly AOL should stick to what it does best: Fooling millions of americans into believing that it, AOL, is the web. -Paul Watson
|
|
|
|
|
Have you stepped through with the debugger to see if your static cast is even being called? Because it seems that execution is not even reaching that point. Unless you are using exceptions and the static_cast is throwing an exception.
I need more info to answer your question.
|
|
|
|
|
What I am trying to do is create a dialog app using PJ Naughter's w3mfc class. I am converting his demo to a dialog app and can't get it to work. http://www.codeproject.com/internet/w3mfc.asp
I am trying to get PostLog to send info to my dialog. You can check out the demo if I'm not making sense.
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
Frankly AOL should stick to what it does best: Fooling millions of americans into believing that it, AOL, is the web. -Paul Watson
|
|
|
|
|
I figured it out. The function I was calling PrintLog from wasn't being called.
Thanks for trying though.
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
Frankly AOL should stick to what it does best: Fooling millions of americans into believing that it, AOL, is the web. -Paul Watson
|
|
|
|
|
Try this Matt:
CNetServerDlg* pNetServer = (CNetServerDlg*)AfxGetMainWn();
pNetServer->PrintLog(strLogOutput);
Other than that, If doesn't work let me know what you come up with? I usually create a function in the parent class of the dialog that I use to pass the information to the dialog.
|
|
|
|
|
For everyones information:
Jay Beckert wrote:
CNetServerDlg* pNetServer = (CNetServerDlg*)AfxGetMainWn();
pNetServer->PrintLog(strLogOutput);
is the same as:
CNetServerDlg* pNetServer = reinterpret_cast<cnetserverdlg*>(AfxGetMainWn());
pNetServer->PrintLog(strLogOutput);
reinterpret_cast simply says to the compiler "I know what I am doing, just go ahead and trust me."
Basically what you are doing is telling the compiler to use convert one data types binary format into another format that is completely different and may not even be compatible.
static_cast is safer because you are saying to the compiler, "I would like to conver this pointer to a compatible type." If that compatible type does not exist, then you will get a compiler error.
|
|
|
|
|
kilowatt wrote:
reinterpret_cast simply says to the compiler "I know what I am doing, just go ahead and trust me."
Basically what you are doing is telling the compiler to use convert one data types binary format into another format that is completely different and may not even be compatible.
static_cast is safer because you are saying to the compiler, "I would like to conver this pointer to a compatible type." If that compatible type does not exist, then you will get a compiler error.
Yes you are correct. I just tried this and had the same result as Matt's problem. I did a cheap hack to get around it. Hopefully we can hear from him how he came to a solution?
|
|
|
|
|
Jay Beckert wrote:
Yes you are correct. I just tried this and had the same result as Matt's problem. I did a cheap hack to get around it. Hopefully we can hear from him how he came to a solution?
No solution yet but I will let you not what happens
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
Frankly AOL should stick to what it does best: Fooling millions of americans into believing that it, AOL, is the web. -Paul Watson
|
|
|
|
|
I figured it out. The function I was calling PrintLog from wasn't being called.
Thanks for trying though.
Jay Beckert wrote:
CNetServerDlg* pNetServer = (CNetServerDlg*)AfxGetMainWn();
pNetServer->PrintLog(strLogOutput);
Thats what I ended up using. Thanks for the help.
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
Frankly AOL should stick to what it does best: Fooling millions of americans into believing that it, AOL, is the web. -Paul Watson
|
|
|
|
|
Matt Newman wrote:
CNetServerDlg* pNetServer = (CNetServerDlg*)AfxGetMainWn();
pNetServer->PrintLog(strLogOutput);
Thats what I ended up using. Thanks for the help.
Quick question Matt. How is your dialog being created?
I had the same problem and I NEVER did get it to work in one of my projects. I was using a dialog with an edit control that served as a log that just recieved strings and nothing else.
CNetServerDlg* pNetServer = (CNetServerDlg*)AfxGetMainWnd();
pNetServer->PrintLog(strLogOutput);
I know that is supposed to work, but didn't for me? LOL
|
|
|
|
|
Jay Beckert wrote:
Quick question Matt. How is your dialog being created?
I'm not sure what you mean. The class can't start until after the dialog is created.
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
Frankly AOL should stick to what it does best: Fooling millions of americans into believing that it, AOL, is the web. -Paul Watson
|
|
|
|
|
Matt Newman wrote:
Quick question Matt. How is your dialog being created?
I'm not sure what you mean. The class can't start until after the dialog is created.
Sorry. What I was getting at is it a modal or modeless dialog. Could I still call a function with in the dialog class regardless of modal or modeless?
|
|
|
|
|
this is rotation around Z (Plane figure)
newx:=x*cos(angle) - y*sin(angle));
newy:=x*sin(angle) + y*cos(angle));
How to rotate the figure around x and y?
So, how changes newx and newy in this case. I have x,y,z Coordinates,
but i have only two coordinates (newx and newy) to paint the figure at the screen
|
|
|
|
|
In order to do this properly you will need to view this problem as having two different coordinate spaces. The world coordinate space, and the screen coordinate space.
You will need to create a four parameter point to hold these values [X,Y,Z,W]. X,Y, and Z are self explanitory, however you will need the W parameter for homogenizing. This means to keep all of the other values in proportion after you transform the points from you 3D worldspace to your 2D screen space. In most cases W will be 1, but will be modified after you perform some sort of transformation on it (I will explain the rotation transformation below). After you perform a transformation you will want to normalize the vector that represents your point and replace the homonginized value in W with a 1.
The conversion between the 3D world space and 2d screen space is a little complicated to explain right now, and I do not remember the exact formulas in the top of my head, however you could probably find them without trouble on the graphics newsgroup comp.graphics.algorithms, try searching google newsgroups.
In order to rotate around the X or the Y access it is easiest to view this if you create a 4x4 matrix.
M11 M12 M13 M14
M21 M22 M23 M24
M31 M32 M33 M34
M41 M42 M43 M44
If you start with the identity matrix:
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
Then add the particular parameters for the axis of rotation that you want to perform, you will create a transformation matrix. Here are the three matrices that you will use to rotate around the
X, Y, and Z axis respectively.
X
1 0 0 0
0 cos(angle) -sin(angle) 0
0 sin(angle) cos(angle) 0
0 0 0 1
Y
cos(angle) 0 sin(angle) 0
0 1 0 0
-sin(angle) 0 cos(angle) 0
0 0 0 1
Z
cos(angle) -sin(angle) 0 0
sin(angle) cos(angle) 0 0
0 0 1 0
0 0 0 1
You will place your point at the right of your transformation matrix and perform a multiplication, the result will be a point that is rotated around the origin by the specified angle.
M11 M12 M13 M14 X
M21 M22 M23 M24 Y
M31 M32 M33 M34 Z
M41 M42 M43 M44 1
I know this was a fast introduction to a 3d rotation, however there is quite a bit o ground work that needs to be done in order to get a set of points that are located in 3d space to be properly shown on a 2d screen and to have the perspective of the image preserved.
There are quite a few sites on the internet that have good descriptions of the math and the transformations that are involved.
If you have any more questions feel free to ask.
|
|
|
|
|
I need to analyse some code from a txt file but I don't know how
to read it . I'd like to now the easyiest way to do so .
thanks
Pierre
|
|
|
|
|
magpierre wrote:
I need to analyse some code from a txt file but I don't know how
to read it .
Like personally, or under the debugger or profiler..?
Windows notepad? perhaps just rename the file to cpp and view it under VC++ so you get all that pretty syntax hiliting
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
CStdioFile
Cheers,
/Fredrik
Sonork ID: 100.11430:PhatBoy
|
|
|
|
|
C:\My Documents\DataStru\Investor.cpp(81) : error C2447: missing function header (old-style formal list?)
Error executing cl.exe.
thanks
I tried to fix it but i couldn't
|
|
|
|
|
My first thought when I see this message is that you've copy-and-pasted the function definition from your .h to .cpp and forgotten to take the semi-colon off the end:
bool CInvestor::MyFunction(int aiParam1, LPCTSTR apszParam2);
{
do_some_stuff;
do_some_other_stuff;
}
Just a guess.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
In C it was legal to do the following(The C programming language by: Kernighan & Ritchie)
index(s, t)
char s[], t[];
{
return 0;
}
In C++ however this is NOT allowed!
I'm thinking this is what would flag this error.
Perhaps you have something like
void MyFunc();
{
}
or maybe you've missed the open close brackets around the funtion
void MyFunc; //It looks to me more like a variable then a function so the compiler would also get confused.
Just some suggestions.
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Graphics graphics(dc.m_hDC);
Rect rect(20, 20, 100, 50);
Rect closingRect;
GetClientRect(closingrect); <- problem here
GraphicsPath path;
path.AddRectangle(rect);
// a region based on the path.
Region region(&path);
//clipping region
graphics.SetClip(& region);
//colour it just to see it
Pen pen(Color(255, 255, 0, 0));
graphics.DrawPath(&pen, &path);
Image image(L".\\banner.gif");
graphics.DrawImage(&image, 50, 50);
How do I figure out the size of the client rect? Using GetClientRect(closingrect) produces this error:
cannot convert parameter 1 from 'class Gdiplus::Rect *' to 'struct tagRECT *'
How to get the ClientRect using GDI+?
|
|
|
|
|
RECT midrect;
GetClientRect(&midrect); <- no problem here anymore
Rect closingRect(midrect.left, midrect.top, midrect.right - midrect.left, midrect.botton - midrect.top)
There might be minor spelling-errors because I'm just writing the code in IE...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Thank you Anders!!
I didn't understand struct RECT and Rect; know I can see the light. I'v notice things are a bit different between GDI and GDI+.
Anders Molin wrote:
Money talks, but all mine ever says is "Goodbye!"
I tell that to my wife; she still don't get it. LOL
|
|
|
|