|
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
|
|
|
|
|
I have a dialog app that runs for a while and gathers some information.
It then writes that information to three different text files in a tab delimited format.
I have an access database containing 3 tables (corresponding to the three text files). I also have a macro in the database that erases existing contents of the 3 tables, and then reloads the updated information from the text files.
Right now, I have to manually open up the access database and run the macro.
I am looking for a way to do it from within the program and save the trouble of having to open up the database myself.
1) Is it possible to get rid of the text files and macro and perform the actual erasing and importing of data from within my app? I'm not sure where to start on this one.
2) If that would turn out to be difficult, would it be possible to simply tell the database to run the macro?
If someone could give me some tips and point me in the right direction, I'd appreciate it..
Thanks for your help!
Adam Clauss
cabadam@tamu.edu
|
|
|
|
|
Of,course you can read data from file and put it in database,use CFile or CStudioFile to
read from files,then with ADO functions put it in database.
For the second way you mentioned I know SQLServer do it but I don't know about Access?
You can check this link about the second way:
http://lnrpc2.irb.hr/ebooks/0672313502/ch06/ch06.htm#SQLStoredProcedures
Mazy
You can find a solution (even a foolish one) for all problems (even big ones)
|
|
|
|
|
I have some local variables declared inside while loop
but the compiler does not recognize them when i try to use them outside of this loop?
can anyone tell mo how to solve this problem?
here is the code if you want to look at it!
case 'B':
{
count = 0;
while((c = cin.get()) != ' ')
{
inputLine[count] = c;
count++;
}
inputLine[count] = '\0'; //input line is storing the SS# here
count = 0;
//Here starts my binary search again
int low =0, mid, high=14;
while (low <= high)
{
mid = (low + high)/2;
// here i create a temporary investor to hold data of Buyer
Investor* tempIT = (*tempInvestors).getInvestor(mid);
int tempAccount = (*tempIT).getAccountBalance(); //AccountBalance Of Buyer
if (strcmp((*tempIT).getSocialSecurity(),inputLine ) < 0)
low = mid + 1;
else if (strcmp((*tempIT).getSocialSecurity(),inputLine ) > 0)
high= mid - 1;
else
mid = mid;
}
while((c = cin.get()) != ' ')
{
inputLine[count] = c;
count++;
}
inputLine[count] = '\0';
count = 0;
char tempTicker[30];
strcpy(tempTicker,inputLine); // now tempTicker stores thtickerSymbol
// Here i'm performing another binary search to look for the
// specific stock that has that same stockTicker
int lo =0, mi, hi=14;
while (lo <= hi)
{
mi = (lo + hi)/2;
Stock* tempST = (*tempStocks).getStock(mi);
int tempStockPrice = (*tempST).getCurStockPrice(); // storing the stockprice in tempStockPrice
if (strcmp((*tempST).getStockTicker(),inputLine ) < 0)
lo = mi + 1;
else if (strcmp((*tempST).getStockTicker(),inputLine ) > 0)
hi = mi - 1;
else
mi = mi;
}
while((c = cin.get()) != ' ')
{
inputLine[count] = c;
count++;
}
inputLine[count] = '\0';
count = 0;
int tempNumShares = atoi (inputLine); //tempInt is storing number of shares now.
if ( tempAccount >= (tempStockPrice * tempNumShares))
}break;
--------------------Configuration: main - Win32 Debug--------------------
Compiling...
main.cpp
C:\My Documents\DataStru\main.cpp(295) : error C2065: 'tempAccount' : undeclared identifier
C:\My Documents\DataStru\main.cpp(295) : error C2065: 'tempStockPrice' : undeclared identifier
C:\My Documents\DataStru\main.cpp(297) : error C2143: syntax error : missing ';' before '}'
Error executing cl.exe.
main.obj - 3 error(s), 0 warning(s)
|
|
|
|
|
I have some local variables declared inside while loop
but the compiler does not recognize them when i try to use them outside of this loop?
You're pointing to the solution yourself: declare those variables outside the loop.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
In the old days, compilers used to let you declare variables inside loops and still use them outside. However, it was decided to be bad practice, so modern compilers won't let you do it. Declare them outside of the loops beforehand if you wish for them to remain valid.
Simon
C++: Only friends can see your private parts.
Sonork ID 100.10024
|
|
|
|
|
make sure you are running win200, NT4.0 or winXP before downloading the sdk.
I am running 98se and spent a few days downloading it over 56k to find it wont install.
==================================================
When Your Mind Wonders...Where Does It Go???
|
|
|
|
|
Hi
I've always used the #ifndef guard to prevent multiple inclusion of a header file. I'm now considering to switch to #pragma once instead, much cleaner. But how widespread is this kind of compiler directives? Can I compile my code on most unix compilers if I use #pragma once?
|
|
|
|
|
Seems like #pragma once is recongnized by different compilers, some of them for the UNIX environment, but IMHO resorting to it is a bad idea, because it is not standard, and the #ifndef guard does the job in a very reasonable and widely known fashion.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
#pragma commands are by definition compiler-specific. If some *nix compilers support it too, great, but the world of *nix compiling is pretty hairy due to all the variants of OSes and compilers. Stick to the #ifndef method which is guaranteed to work everywhere.
--Mike--
"Everyone has figured out what 'service pack' really means, so they had to go and change the language. Perhaps this is what Bill was talking about in the 'security is top priority' letter."
-- Daniel Ferguson, 1/31/2002
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I have 2 questions the first is there a simple way to change the font size of a particlar control (eg. listbox).
The second is that I have a simple function (attached) which just reads a file and places it's textual contents into the clipboard. When I paste the info in notepad it is one continuous line with the crlf characters a little boxes though if i paste into other things (like in visual studio) it is fine. Is there some way I can preserve the carriage return/line feeds in the clipboard so that pasting into notepad and anything else will have the proper contents of the file?
EmptyClipboard();
GlobalBuff = GlobalAlloc(GMEM_MOVEABLE,size+1);
buffer = (char*)GlobalLock(GlobalBuff);
while(!feof(file)) {
fread(readbuffer,1,255,file);
if(ferror(file)) {
MessageBox(NULL,strerror(errno),"Error",MB_ICONERROR);
exit(1);
}
strcat(buffer,readbuffer);
memset(readbuffer,0,strlen(readbuffer));
}
GlobalUnlock(GlobalBuff);
if(SetClipboardData(CF_TEXT,GlobalBuff) == NULL)
return FALSE;
CloseClipboard();
If posting of this code is not appropriate please let me know and forgive my insolence.
Any help or suggestions are greatly appricated.
Thanks,
Sean Cody
|
|
|
|
|
As for the first question, use SetFont . Read Mike Dunn's C++ FAQ for common mistakes prople make when using this method.
With regard to your second problem, I guess what's happening is that notepad requires lines to be separated by CR-LF pairs ("\r\n" in C++ code) and you are feeding it with LF separated text. Try opening your file in binary mode ("b" flag in fopen ), that should fix the problem.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|