|
|
that doesn't seem like much information.
that's all the assertion says?
It doesn't sound like you ran this in the debugger -- it should stop a specific line of code.
THAT'S YOUR CLUE.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
What line of what file is asserting?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Are you sure ImageList is created? did you check return value of Create what was it?
|
|
|
|
|
Dev environment: vc6.0 + SP5
System : WinXP + SP2
Some threads(include main UI thread and other NonUI worker threads) will call PostThreadMessage to post user-defined message to a NonUI worker thread. In this case, the user-defined message is WM_USER+0x2000.
The nonUI worker thread created by AfxBeginThread, and i override the Run function.The code is like below:
WorkThread::Run()
{
while ( 1 )
{
::PeekMessage ( &Msg, 0, 0, PM_NOREMOVE ) ;
if ( Msg.message == WM_USER+0x2000 )
TRACE ( "MESSAGE\n" );
........
........
if ( ... )
break;
}
}
Note: WM_USER+0x2000 post by main UI thread and PostThreadMessage return TRUE.But i cann't trace the message.Other user-defined message post by
PostThreadMessage will be received in WorkThread::Run(), i don't why?
which logical error or system bug will cause the problem?
|
|
|
|
|
CNJXRZ wrote: PostThreadMessage will be received in WorkThread::Run(), i don't why?
I just tried ur code and I am getting the message also. the only difference i made was instead of a CWinThread derived class, i wrote only a thread proc. Also why its only 4 parameters in ur PeekMessage() function? It actually takes 5 paramters. isnt it?
UINT __cdecl MyControllingFunction( LPVOID pParam )<br />
{<br />
<br />
MSG Msg;<br />
while ( 1 )<br />
{<br />
::PeekMessage( &Msg, 0, 0,0, PM_NOREMOVE ) ;<br />
if ( Msg.message == WM_USER+0x2000 )<br />
TRACE ( "MESSAGE\n" );<br />
}<br />
return 0;<br />
}<br />
void CDialogBasedDlg::OnButton1() <br />
{<br />
CWinThread *pthread = AfxBeginThread( MyControllingFunction, 0 );<br />
PostThreadMessage( pthread->m_nThreadID, WM_USER + 0x2000, 0 ,0 );<br />
}
|
|
|
|
|
CNJXRZ wrote: user-defined message is WM_USER+0x2000
<pet peeve alert>
You should be using WM_APP instead of WM_USER. From the documentation (emphasis mine)
Message numbers in the second range (WM_USER through 0x7FFF) can be defined and used by an application to send messages within a private window class. These values cannot be used to define messages that are meaningful throughout an application, because some predefined window classes already define values in this range. For example, predefined control classes such as BUTTON, EDIT, LISTBOX, and COMBOBOX may use these values.Messages in this range should not be sent to other applications unless the applications have been designed to exchange messages and to attach the same meaning to the message numbers.
Message numbers in the third range (WM_APP through 0xBFFF) are available for application to use as private messages. Message in this range do not conflict with system messages.
</pet peeve alert>
Judy
|
|
|
|
|
CNJXRZ wrote: The nonUI worker thread created by AfxBeginThread,
Using which version of AfxBeginThread()?
Technically, if your Run() override gets called, then
it's a UI thread, not a worker thread.
Is your Run() override getting called? If not, you're using
the wrong AfxBeginThread().
Note that you don't have a message queue on that thread until the
first PeekMessage() call. Are you posting the message before that
call?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
How to find the threadIdentifier of an HWND ?
Thanks & Regards
|
|
|
|
|
The following is from MSDN :
DWORD GetWindowThreadProcessId
(
HWND hWnd,
LPDWORD lpdwProcessId
);
The GetWindowThreadProcessId function retrieves the identifier of the thread that created the specified window and, optionally, the identifier of the process that created the window.
Best Regards,
Bio.
|
|
|
|
|
There is an autoreset event object ,and it's initial state is signaled.
Suppose there are two threads in a process, called A and B, are wating for this event object infinitely. Either thread will change the event's state to nonsignaled if it's waiting function call succeeds, and the other thread will still wait on that object. Am I right? If thread A's waiting funcion call succeeds, then before it call ResetEvent, A terminated. How about B, Will B still wait for this event object? The event object's is signaled, or nonsignaled?
Thank you all
|
|
|
|
|
ResetEvent is only used for manual events. You are talking about auto-reset events. Auto reset means that the event automatically returns to the non-signalled state after a thread which was waiting for the event to be signalled is released. If thread A, which was released, terminates before it calls SetEvent to signal the event, thread B will be stuck waiting since there is nothing to change the state of the event to signalled.
Judy
|
|
|
|
|
Thank you JudyL_FL!
I have try it, and found that thread B will be waiting for ever, hence it will have no chance to execute.
So I think it would be dangerous to use autoreset event to synchronous threads.
|
|
|
|
|
zengkun100 wrote: So I think it would be dangerous to use autoreset event to synchronous threads
It all depends on how the threads are synchronized. Each has its place. Refer to the MSDN for an example that uses both. Using Event Objects[^]. Manual reset events can also cause deadlocks if a thread terminates before it signals the event. Synchronization and the avoidance of deadlocks are one of the big issues when doing multi-threading.
Judy
|
|
|
|
|
Thank you Judy
Each coin has two sides, I will think more about thread synchronization.
|
|
|
|
|
can anbody say how to convert a bitmap to a gif file on disk. urgently required
|
|
|
|
|
can any say how to convert a bitmap file on disk to gif. urgently required
|
|
|
|
|
Will this[^] helpful ?
Regards,
Paresh.
|
|
|
|
|
You can use of CImage class.
|
|
|
|
|
May be this is not the right forum to ask as this question relates to Borland C++ v 3.1. I could not find that topic in this. Suggest me the right forum. I am not able to debug my borland C++ project. When i press F8 it says 'no debug info at program start.Run Anyway' I checked the compiler options. Debug info is enabled. Is there anything i am missing?
Thanks for your help
|
|
|
|
|
Did you set debug options for it?
|
|
|
|
|
yes..I enabled degug option in the compiler settings. But still is of no use
|
|
|
|
|
I'm building a filtergraph and I'm sort of new at this. I want to build a filter graph that takes input from a Windows Media Player to capture the audio, whether I'm playing music or a video. I read about a filter with the class id of CLSID_WMPCD and I tried to access it from Direct Show on my PC, but wasn't able to. I Googled it and it wasn't anywhere to be found. Does anyone know anything about it, and is there possibly a CLSID_WMPDVD?
Thanks for any help anyone can provide.
GrizMan
|
|
|
|
|
The class is used for recording informations which may be massive.In the initialization:
<code><pre>m_qwFileSize = 0x4000000;
m_qwFileOffset = 0;
m_T = 600 * m_siInfo.dwAllocationGranularity;
m_hMappingFile = ::CreateFileMapping(m_hFile,NULL,PAGE_READWRITE,0,m_qwFileSize + sizeof(TCHAR),NULL);
m_lpStartLoc = ::MapViewOfFil(m_hMappingFile,FILE_MAP_ALL_ACCESS,static_cast<dword>(m_qwFileOffset >> 32),static_cast<dword>(m_qwFileOffset & 0xFFFFFFFF),m_dwBytesInBlock);</dword></dword></pre></code>
When the view's size is larger than 60%,I re-mapping the file:
<pre><code>if (m_qwFileOffset >= m_T){
m_T = m_qwFileOffset + 600 * m_siInfo.dwAllocationGranularity;
::UnmapViewOfFile(m_lpStartLoc);
__int64 qwOldFileOffset = m_qwFileOffset;
RndToSysAllocGranularity(m_qwFileOffset);
__int64 qwOffVar = qwOldFileOffset - m_qwFileOffset;
m_lpStartLoc = ::MapViewOfFile
(m_hMappingFile,FILE_MAP_ALL_ACCESS,static_cast<dword>(m_qwFileOffset >>
32),static_cast<dword>(m_qwFileOffset & 0xFFFFFFFF),m_dwBytesInBlock);
PBYTE pByte = reinterpret_cast<pbyte>(m_lpStartLoc);
pByte += qwOffVar;
m_lpStartLoc = pByte;}</pbyte></dword></dword></code></pre>
in the RndToSysAllocGranularity(), I allocate the File offset:
<code><pre__int64 dwremains="dwValue" %="" m_siinfo.dwallocationgranularity;<br="" mode="hold" /> if (dwRemains){
__int64 dwDevided = dwValue / m_siInfo.dwAllocationGranularity;
dwValue = (dwDevided + 1) * m_siInfo.dwAllocationGranularity;}</code>
When it works, I get the errors and its error code is 0x5,it means access denied.Why?
Later buggers harm more.
modified on Tuesday, December 18, 2007 7:57:40 PM
<div class="ForumMod">modified on Tuesday, December 18, 2007 8:08:17 PM</div>
|
|
|
|
|
Please use the <pre></pre> tags to surround code.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|