|
|
cmk wrote:
Constructive Solid Geometry
Thanks for that. To bad there is no article on CP.
I've looked at the link. Do you have others
_____________________________
...and justice for all
APe
|
|
|
|
|
I think CSG that was mentioned in previous post is too complex for your task.
What you need is indeed a simple mesh object and elements of it were mentioned above as well.
Let's start with a simple class for 3D point (you can call it vector if you want) with all possible geometrical manipulations like add, sub, mul, dev with point, with scalar, dot and cross products.
After that you have to create a class to represent a face. If you remember geometry you know that three points in space is enough to represent a plane, so your "face" class have to include those three poins. Plus I suggest to include Normal Vector (normalized cross product of two differences between our three points, like p=b-a, q=c-a, n=cross(p,q) N=n/length(n)) which will represend visible side of a face and some props like single/double faced, shading method etc. Normal vector is very important cuz it'll help you to eliminate invisible faces on rendering stage.
Another thing that we have to include in our face class is info about edges. That's all.
Now to represent a normal 4-point plane you need 2 faces, so to represent a cube you need 12 faces.
All boolean operation are very simple to perform on such objects. You need to solve only one equation to find points in space where two faces intersect and create new faces there.
Hope it'll help.
|
|
|
|
|
One way is to trap WM_SETTEXT for the main window and insert the new logic there.
Another way is to act in WM_NCPAINT, when the title area is painted. I wouldn't do that though.
Look in the MFC sources how/where the default title is composed.
--
The Blog: Bits and Pieces
|
|
|
|
|
Maybe GetWindowText(astring) and SetWindowText(astring) is an option, but I'm not sure you can get the whole string. you could try it and see.
Good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Hi Santosh,
I hope I'm on target with this.
In order to set the title of a document, hence the title of the MDI child window/main app window if the application is maximized, use CDocument::SetTitle().
You can call this in the view or in the document itself; the former would require GetDocument()->SetTitle(_T("Title"));
Jeff
|
|
|
|
|
hai,
i am doing a project on voice chat.I have some problems when it is used in the net.problems like echo,data loss.
(I had already posted this question and got the answer to use compression techniques)
My question is , is it necessary to go for VOIP concepts or just we can use compression techniques to solve that problem.
plz give some suggestions..
Thanks for all,
M.Kailasam
|
|
|
|
|
By default, in an MFC MDI application, when a child window is maximized, the
title of the child window is appended to the main window's title. Here I
want to display it in a custom format. How do I go about doing this ?
The application is an MFC MDI application.
The title bar text of the main window contains some values taken from a database.
So let's say the main title bar text is [Field1] - <field2> MainWindow
I have a MDI child window whose title bar text is Child1.
When the MDI child is maximized, the main window title will by default
become [Field1] - <field2> MainWindow - [Child1].
I want to change this and it should become - [Field1] - <field2> [Child1] -
MainWindow
Santosh
« Superman »
|
|
|
|
|
I have seen people use these macros on string literals, what are these for?
|
|
|
|
|
typedef WORD WCHAR;
#ifdef UNICODE
typedef WCHAR TCHAR;
#else
typedef char TCHAR;
#endif
so if UNICODE is defined TCHAR is WORD, else its char
|
|
|
|
|
Josh Gray wrote:
so if UNICODE is defined TCHAR is WORD
A typo. You mean TCHAR is WCHAR, of course.
And WCHAR is wchar_t.
--
The Blog: Bits and Pieces
|
|
|
|
|
_T is not the same as _TCHAR or TCHAR in respect to functionality.
_T , TEXT and also L are used to convert string literals to wide or multi-byte type. While _T and TEXT converts to wide if UNICODE is defined and to multi-byte if UNICODE is undefined, L will always force the string literal to wide independent of the UNICODE define.
So,
_T("This will be a string of WCHAR characters "
"if UNICODE is defined and of ordinary char "
"characters if UNICODE is undefined.");
_T("This will also be a string of WCHAR characters "
"if UNICODE is defined and of ordinary char "
"characters if UNICODE is undefined.");
L"This, however, will always be a string of WCHAR characters."; And WCHAR is just a wchar_t .
I highly recommend the article The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)[^] by Joel Spolsky.
--
The Blog: Bits and Pieces
|
|
|
|
|
Thanks. and what is a wide character wchar_t? the question is, when should I care to use these macros? or is it okay to not use them.
also, why do you use "L" like that - what does it expand to?
|
|
|
|
|
Normus wrote:
what is a wide character wchar_t
A UNICODE character. It uses (mostly) 2 bytes of storage instead of 1. Therefore "wide".
Normus wrote:
when should I care to use these macros
If you ask me - always (I come from Europe, where old ASCII is insufficient). If you ask an American - "What's Europe?"
Seriously, if you want anyone who needs a UNICODE alphabet to use your code, then it better be UNICODE enabled.
Normus wrote:
why do you use "L" like that - what does it expand to
L forces UNICODE type of the string literal. For example, code that targets no other OS than Windows CE, which is a UNICODE OS from bottom to top, can use L on all string literals and be sure to always work.
--
The Blog: Bits and Pieces
|
|
|
|
|
dont worry, I am not an american either
Regarding L, I am curious about the C syntax. Is it an operator or a macro or what is it?
Thanks.
|
|
|
|
|
I guess L is an MS compiler extension, because it's not a macro.
--
The Blog: Bits and Pieces
|
|
|
|
|
I want to do one project in VC++, that is in our Laboratory we are using one equipment for Blood Test & Urine Test that Equipment itself generating one report for us. But I want to connect that equipment to my system through Printer port and want to have control over equipment.This is my project brief description.
For to start this project I want some functions which will help to send the Data to equipment and to get response & Data from the equipment.kindly help.
|
|
|
|
|
The first thing to do is to find out if the equipment actually ACCEPTS commands through the printer port (which would be a little unusual - that type of control is usually done through a serial port). Are there any manuals for the equipment that describe the remote control capabilities and message and command formats? If so, then that is the place to start. Once you find out FROM THE MACHINE HOW IT WANTS TO TALK, then you can start the process of how to implement a communication protocol in VC++.
Hope this helps,
John
|
|
|
|
|
Hi
I careate a secondary worker thread in my application.
I read a sample that uses PostQuitMessage(0); to exit the thread..
But I know that I can just use return 0; instead..
when should each method be used ?
|
|
|
|
|
hspc wrote:
I read a sample that uses PostQuitMessage(0); to exit the thread..
But I know that I can just use return 0; instead..
yes there are three way to end worker thread.
1.return(0);
2.AfxEndThread(0);
3.PostQuitMessage(0);
hope u understand
-----------------------------
"I Think It will Work"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
i would use PostQuitMessage() when you want to stop the thread from another thead
for example if you have a CWinThread pointer called pAnotherThread
pAnotherThread->PostQUotMessage(0);
WaitForSingleObject(*pAnotherThread, INFINITE);
this will post the stop message and wait untill the thread has exited
However, if the thread is stopping itself then return(0) is fine
for example
void myThread(LPVOID)
{
while(workToDo)
{
doSomeWork();
}
return 0;
}
|
|
|
|
|
Thank you
this made it clear..
|
|
|
|
|
But
PostQuitMessage() function is not a part of CWinThread
here My VC 6.0 Compiler Error Message
D:\Alok\Currently Working\PhaseTwo\SecureNM9x\NMPClass.cpp(284) : error C2039: 'PostQuitMessage' : is not a member of 'CWinThread'<br />
C:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxwin.h(3791) : see declaration of 'CWinThread'<br />
Error executing cl.exe.<br />
<br />
SecureNM9x.exe - 1 error(s), 0 warning(s)
-----------------------------
"I Think It will Work"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
use PostThreadMessage(WM_QUIT, 0, 0);
|
|
|
|
|
Shamelessly ripped from Chris Becke:
PostQuitMessage() is typically called to terminate
a UI thread, and UI threads typically need to be terminated when all the
windows depending on the thread have been destroyed.
In situations when there is one frame or parent window the PostQuitMessage
is placed somewhere in the windows destruction code. Either in a message
handler: WM_DESTROY, WM_NCDESTROY, or in some c++ function that gets called
when the window is destroyed - prehaps even the destructor.
Sometimes you might have a situation where more than one top-level window
can exist on the UI thread. In that case you want to do some refrence
counting or some other system - every WM_CREATE or ctor increases a ref
count, every WM_DESTROY, OnHesDeadJim, or dtor the ref count is decreased.
When it hits zero all windows are dead and PostQuitMEssage is called to
terminate the UI thread.
Basically there are many ways to kill a UI thread, and to a large degree the
method used will cahnge according to the requirements of the class
library(s) used and other enviromental constraints.
Chris Becke
|
|
|
|