|
VC6's template support was not complete, especially when dealing with complex classes like your example. Sometimes, you just have to say it ain't gonna work in 6.
BTW, "dtor" is the abbreviation for "destructor" (along with "ctor" for "constructor")
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
VB > soccer
|
|
|
|
|
How to get device context from the runtime class used in multithreading application. For the application I am using single document interface.
Is there any easy way to get device context whenever and whereever you want?
The way of Creating device context with CreateDC seems to be worse than creating
another application. Where to get driver file name which drivers are installed by windows automatically.
|| ART OF LIVING ||
|
|
|
|
|
A CDC* is passed to the view's OnDraw() method. The view's OnPaint() method creates a local CDC -derived object. Where else are you needing it?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
In multithreading application we do pass RUNTIME CLASS.
In that runtime class we write the all the stuff which the thread is suppose to do.
Now my thread is going to draw something on document. My question is how to
achieve device context for the same purpose, and where to achieve
Moreover my application is crashing as I am not getting device context at the point
where I start using device context
|| ART OF LIVING ||
-- modified at 9:43 Tuesday 27th June, 2006
|
|
|
|
|
shivditya wrote: Now my thread is going to draw something on document.
How? The document is not something that can be drawn on. You can only draw on CWnd -derived objects (e.g., CView ).
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Friend sorry Its Single document interface application,CView is there.
|| ART OF LIVING ||
|
|
|
|
|
Of course. It stands to reason that if you have a document, you will also have a view. What makes no sense is that you wanted to draw on the document.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Actually I dint get your question.
It is possible to get device context by passing Window handle to ::GetDC function.
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
I tried all the stuff but how to get handle of SDI window from the class instance which is used inside runtimeclass which is being called by SDI using
AfxBeginThread
void CMy5CYLINDERView::support()
{
for(int ii = 0;ii < 1;ii++)
{
x[ii] = AfxBeginThread(RUNTIME_CLASS(SHIV)); //SHIV is my RunTime class.
}
}
//FOllowing is constructor which is using another simulate class instance engine.
SHIV::SHIV()
{
engine.getdata(0);
engine.nextpos();
}
//And this nextpos method requires DC to draw
void simulate::nextpos()
{
CWnd* cc;
cc = (CWnd*)GetWindow(();
CDC* pDC = cc->GetDC();
CBrush bluebrush,old,white;
white.CreateSolidBrush(RGB(200,
|| ART OF LIVING ||
|
|
|
|
|
shivditya wrote: CWnd* cc;
cc = (CWnd*)GetWindow(();
CDC* pDC = cc->GetDC();
CBrush bluebrush,old,white;
white.CreateSolidBrush(RGB(200,
which windows DC you want? MainFrame? Try AfxGetMainWnd() instead of GetWindow
SaRath.
"It is your attitude, not your aptitude, that determines your altitude - Zig Ziglar."
My Blog | Understanding State Pattern in C++
|
|
|
|
|
See AfxGetApp()->m_pMainWnd->GetDC()
whitesky
|
|
|
|
|
Thanks A Lot
Your suggestion worked very very well.
Yours faithfully
Aditya
|| ART OF LIVING ||
|
|
|
|
|
This is something you can check with Spy++, but i'll expect at least something like WM_CLOSE or/and WM_DESTROY or/and WM_NOTIFY.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
hi all
plz tell me how can i made animated a text or picture on a dialog box
i have made a dialog based application in which i want to show some data as animated
plz help
Ashish Dogra
|
|
|
|
|
Use GetDC() to get the DC of the dialog and use that to draw on the dialog.
TextOut to output the text.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
where i use getdc() in oninitdialog on on paint
plz tell me an example for this
Ashish Dogra
MCA
Noida
-- modified at 9:17 Tuesday 27th June, 2006
|
|
|
|
|
You should use the function GetDC() whenever you want to draw something and ReleaseDC() ASAP.It's not suggested to hold on to a device context for long.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I USE IT IN ONPAINT WHAT I WANT TO ANIMATE THE TEXT ON STATIC OR EDIT CONTROL THEN HOW
WHERE I USE THAT ID BECAUSE GETDC () HAS NO PARAMETER
Ashish Dogra
MCA
Noida
|
|
|
|
|
No need to shout.
GetDC() returns a device context ( a CDC object ), which has plenty of member functions you can use to draw text or anthing. Search for CDC in the MSDN toget some infos about hte possibilities you have.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
PLZ SOLVE MY PROBLEM AS I CAN NOT SOLVE ITP LZ..............
....................................
plz tell me with some example as i am not so intelligent plz yar
and i am not shouting sorry for that.
i am new to vc++
as i do it myself and with the help of u people plz tell me clearly
Ashish Dogra
MCA
Noida
-- modified at 10:02 Tuesday 27th June, 2006
|
|
|
|
|
Create the DC where you need to draw.
You can use ::GetDC(HWND) if you have the handle to a window.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
ashish dogra wrote: plz tell me how can i made animated a text...dialog box
This should give you a general idea.
For an animated picture, can you use an animated GIF file?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
In my project, if I want to stop a work thread without waiting for it, how can I terminate it safely and compulsively as windows task management does?
|
|
|
|
|
There are some ways to stop a thread .
1) AfxEndThread()
2) TerminateThread()
3) _endthreadex()
IT's not safe to terminate a thread using the above functions.
You should check for a condition to be true. Whenever that condition turns true and the thread is still running, use return to exit safely from the thread function.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|