|
The short answer is "yes, you can".
From Arman's reply I guess you didn't think about a UI-thread and a CWinThread derived object from the start and you don't really need a UI-thread.
I suggest you create an ordinary worker thread, see here[^] how to do it and avoid common pitfalls.
Create a waitable timer with ::CreateWaitableTimer( NULL, FALSE, NULL )[^] inside your worker thread and wait on the timer handle with e.g. ::WaitForMultipleObjects(...) .
Start the timer with ::SetWaitableTimer(...)[^] and make it periodic.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
hello sir..,
how can i load the html page into CMyListView ... this class derived from CListView Class ... but i want to display the html page into My view...
please tell me any suggestion
Regards,
Srinivas
|
|
|
|
|
You can try using Web Browser control.
Please refer this[^]
Regards,
Paresh.
|
|
|
|
|
I guess "load html" means to show the html file as it is done by browsers. So the answer is "no way" unless you have a browser control inside your view.
--
=====
Arman
|
|
|
|
|
For show html files you can use of CDHtmlDialog it create a dialogbox that use of html,
Also you can use of CHtmlView class that it has an example on the MSDN "MFCIE".
|
|
|
|
|
Hi all.
I am converting my old project developed in VC 6.0 to VS 2005. But the new project is failed to create the .lib file in VS2005 which causing error while using that project in others. Please help me if any one knows the solution.
Kishore.
|
|
|
|
|
|
Not showing any error. I want to create a .dll file; and .lib file is also needed. whereas it is able to create the .lib file only when the configuration type is set to .lib file where as i need both .dll and .lib files.
But the same is working fine in another project for which the configuration type is to create .dll; it is making both dll and lib files.
I have tallied all the settings of both projects but it is successful for only that project. All others are not able to create .lib and .dll at a time.
I dont know how only one project is creating both successfully and all others are not able to do that.
Kishore.
|
|
|
|
|
Hi,
I have some PNG files, which are not displaying properly in my application control, while they are opening perfectly fine in the browser.
some of the files , which is creating problem have the foll. info..
Bit depth - 24
Width - 96 pixels
Height - 96 pixels
Horizontal Resolution - 96 dpi
Vertical Resolution - 96 dpi
some files, which are opening properly have the foll. info..
Bit depth - 24
Width - 48 pixels
Height - 48 pixels
Horizontal Resolution - 96 dpi
Vertical Resolution - 96 dpi
i tried to use the libpng, to convert the files, in to the dimension , which is converting properly..but could not found the solution.
Can u pl. suggest something.. how to display them properly or what API should I use for the conversion.
Thanks.
Vineet Kumar Singhal
Sr.Software Engineer
Mumbai
Tough Time Never last, but Tough People do.
|
|
|
|
|
Could you please tell, what do you mean by "Not Diplaying properly",
are they distort, not seen, or partially seen ?
Regards,
Paresh.
|
|
|
|
|
here I mean that the images are distorted.if i open it with "Windows Picture and Fax Viewer" it shows distorted.
if I open it on a web control /ACDsee, it opens perfectly fine.
I am displaying at 2 locations.. at the lacation where web control is opening it, it works fine.., while for the second control, which is a static image control,is displaying it distorted.
Regs
Vineet Kumar Singhal
Sr.Software Engineer
Mumbai
Tough Time Never last, but Tough People do.
|
|
|
|
|
Hope I understood your question
if you want to detaily of image(png) you can use of CImage class
|
|
|
|
|
Try using GDI+ , it can load png files.
If u can Dream... U can do it
|
|
|
|
|
Hi All,
I need to write some ActiveX control that will help me to define some Tree control that have Header.
I already write some class that do it - ( i mean that if i create in MFC application some dialog with CTreeCtrl and i Replace this control with the control that i wrote then i getting what i need ) - but my problem is that i don't know how to implement this in writing an ActiveX.
Some one can help me ?
I need to understand how to write ActiveX control with C++ ( i looked in the example in this site ... i did not find anything like i doing ).
Thanks for any help.
|
|
|
|
|
Seems you have no specific problem but your problem is in making a control class an ActiveX control. Then you need to know how to turn your regular C++ functions into ActiveX methods and/or properties, and this is all. So try to find any tutorial on ActiveX controls and it should help.
--
=====
Arman
|
|
|
|
|
|
hi,
I need to create an UI-thread. The main task of this thread is to perform an infinite loop that do the sending/receiving data. This thread must be able to receive message from Main thread to change behaviour.
I try to put the loop in CMyThread::Run() and put the PeekMessage also in the loop but it doesn't work. I don't know how to do it.
int CMyThread::Run()
{
for (;;)
{
DoMyWork();
if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE )!=0) // my UI thread has no window
{ TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return CWinThread::Run();
}
|
|
|
|
|
GameProfessor wrote: I need to create an UI-thread. The main task of this thread is to perform an infinite loop that do the sending/receiving data.
If the thread spends its time in an "infinite loop that do the sending/receiving data" it sounds like you're after a worker thread and not a UI thread; in which case a message pump may not be needed.
Steve
|
|
|
|
|
GameProfessor wrote: if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE )!=0) // my UI thread has no window
{ TranslateMessage(&msg);
DispatchMessage(&msg);
}
This code should look like this:
while ( PeekMessage(&msg, NULL, 0, 0, PM_REMOVE) )
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Your code continually dispatches the same message forever since you're using the PM_NOREMOVE flag. I also use while instead of if : do some work, process all outstanding messages then repeat.
Steve
|
|
|
|
|
It doesn't work.
I defined my message handler using ON_THREAD_MESSAG macro.
And it seems that I must left the CMyThread::Run intact then these message handler can work. How can I have my thread keep on running my send/recv loop while still be able to handle message from the main thread ?
|
|
|
|
|
I think that you also introduce atleast a Sleep(0) after the DispatchMessage statement.
|
|
|
|
|
What for? It will not help.
Steve
|
|
|
|
|
It still doesn't work.
Actually, can DispatchMessage() work with a message handler defined using macro ON_THREAD_MESSAGE ?
|
|
|
|
|
|
That's because by implementing your own message pump instead of using CWinThread ’s you’re bypassing MFC’s message routing architecture. There are always such dangers when mixing low-level code (Win32 calls) and high-level code (MFC’s CWinThread ) without understanding how they relate to each other.
To do what you’re trying to do within the MFC architecture proceed as follows:
1. Override your CMyThread 's OnIdle member function. It should look like this:
BOOL CMyThread::OnIdle(LONG lCount)
{
DoMyWork();
CWinThread::OnIdle(lCount);
return TRUE;
}
2. Remove your CMyThread::Run override.
Steve
|
|
|
|