|
Leprechaun78 wrote: ...a window similar to a list box...
Does it respond to listbox messages?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Nope, the WindowDump utility extracts information from the ListBox class. It didn't retrieve the information from this Window, but it provided the class (List), handle, process, styles etc.
|
|
|
|
|
Leprechaun78 wrote: ...the ListBox class.
Where is this class defined? How would WindowDump even know that an application was usng such a class, let alone have access to it?
Leprechaun78 wrote: ...the class (List), handle, process, styles etc.
I've not heard of a class having a handle and a style. These sound like window properties.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
My terminology is probably incorrect, I don't have a lot of experience of programming in Windows (or anything else!), apologies for that. I thought a window was an instance of a class?
WindowDump uses GetClassName to extract the class name. This is an example of the output:
Class: List
Title:
ID: 0
hWnd: 0x00010d9a
Styles: WS_CHILD
Control Styles:
Dimension: (208,329) 95 x 125
State: Visible Enabled
If the class was a list box WindowDump would retrieve the contents using
SendMessage(hWnd, LB_GETTEXT, iPos, (LPARAM)szLine)
I'm wondering if there is a similar way to access the contents of a custom class?
|
|
|
|
|
Leprechaun78 wrote: My terminology is probably incorrect...
It sounds as though you are confusing a Windows class (e.g., BUTTON, EDIT, LISTBOX, STATIC, COMBOBOX) with a C++ class.
Leprechaun78 wrote: I'm wondering if there is a similar way to access the contents of a custom class?
Yes, but the target control would need to respond to the message for you to get anything from it.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Ok, I'll investigate ways of checking the properties of a C++ class. My thinking is that the application is passing the information to the operating system for it to display, so I want the operating system to output that information somewhere other than the screen (i.e. a text file). Do you think this is possible?
|
|
|
|
|
Leprechaun78 wrote: Do you think this is possible?
Most things are, but that does not necessarily mean they are easy. While intercepting video output is likely doable, it would certainly not be trivial.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I'll keep investigating. Thanks for your thoughts
|
|
|
|
|
I saw the puzzling class defination in the reference--
http://msdn2.microsoft.com/en-us/library/efk30beh(VS.80).aspx[^]
My question comes from the below line
***********************
CPrimeTest() : m_pCalcNext( new CEvent( FALSE, FALSE ) ) , m_pCalcFinished( new CEvent( FALSE, FALSE ) ) , m_pTerminateThread( new CEvent( FALSE, FALSE ) ) , m_iCurrentPrime( 0 ). If so, why not put them in the body of the class defination.
*******************************
-- How to explain it.
-- Can we treat 'm_pCalcNext', 'm_pCalcFinished' 'm_pTerminateThread' and 'm_iCurrentPrime' as four member variables of public type of the class
<br />
<br />
CPrimeTest { <br />
public: <br />
<br />
{ <br />
CWinThread* pThread; <br />
pThread = ::AfxBeginThread( PrimeCalcProc, this, 0, 0, CREATE_SUSPENDED, NULL); <br />
pThread->m_bAutoDelete = FALSE; <br />
pThread->ResumeThread(); <br />
for( UINT i = 0; i < 10; i++ ) <br />
{ <br />
m_pCalcNext->SetEvent(); <br />
::WaitForSingleObject( m_pCalcFinished->m_hObject, INFINITE ); <br />
TRACE( "The value of m_iCurrentPrime is: %d\n", m_iCurrentPrime ); <br />
} <br />
::WaitForSingleObject( pThread->m_hThread, INFINITE ); <br />
delete pThread; } <br />
<br />
~CPrimeTest() <br />
{ <br />
delete m_pCalcNext; <br />
delete m_pCalcFinished; <br />
delete m_pTerminateThread; <br />
} <br />
private: <br />
BOOL IsPrime( INT ThisPrime ) <br />
{ <br />
if( ThisPrime < 2 ) return FALSE; <br />
for( INT n = 2; n < ThisPrime; n++ ) <br />
{ <br />
if( ThisPrime % n == 0 ) <br />
<br />
return FALSE; <br />
} <br />
return TRUE; <br />
} <br />
INT NextPrime( INT ThisPrime ) <br />
{ while( TRUE ) <br />
{ if( IsPrime( ++ThisPrime ) ) <br />
{ return ThisPrime; } } } <br />
static UINT __cdecl PrimeCalcProc( LPVOID lpParameter ) <br />
{ CPrimeTest* pThis = static_cast<CPrimeTest*>( lpParameter ); <br />
VERIFY( pThis != NULL ); VERIFY( pThis->m_pCalcNext != NULL ); <br />
VERIFY( pThis->m_pCalcFinished != NULL ); <br />
VERIFY( pThis->m_pTerminateThread != NULL ); <br />
CSyncObject* pWaitObjects[] = { pThis->m_pCalcNext, pThis->m_pTerminateThread }; <br />
CMultiLock MultiLock( pWaitObjects, 2L ); <br />
while( MultiLock.Lock( INFINITE, FALSE ) == WAIT_OBJECT_0 ) <br />
{ <br />
pThis->m_iCurrentPrime = NextPrime( pThis->m_iCurrentPrime ); <br />
pThis->m_pCalcFinished->SetEvent(); <br />
} <br />
::AfxEndThread( 0, FALSE ); <br />
return 0L; <br />
} CEvent* m_pCalcNext; <br />
CEvent* m_pCalcFinished; <br />
CEvent* m_pTerminateThread; <br />
};<br />
<br />
<br />
<br />
<br />
|
|
|
|
|
cy163@hotmail.com wrote: Can we treat 'm_pCalcNext', 'm_pCalcFinished' 'm_pTerminateThread' and 'm_iCurrentPrime' as four member variables of public type of the class
Why public ? They are private pointers which are instancied in the constructor (at the line you don't understand). Each of this pointers is a pointer to a CEvent class, and a CEvent class require two parameters for its constructor (I didn't look in detail, but it seems by seing the line you posted).
In fact this part of the line: m_pCalcNext( new CEvent( FALSE, FALSE ) ) is more or less equal to m_pCalcNext = new CEvent(FALSE,FALSE); in the body of the constructor.
So what do you don't understand exactly ?
|
|
|
|
|
Cedric Moonen wrote: is more or less equal to
I'm not sure that I agree with your analysis.
m_pCalcNext( new CEvent(FALSE,FALSE))
is calling a constructor of whatever class m_pCalcNext is. The code posted is using the C++ Initialization List to call constructor of non-pointer member variables, and the same for the others.
led mike
|
|
|
|
|
led mike wrote: is calling a constructor of whatever class m_pCalcNext is
m_pCalcNext is a pointer to a CEvent object.
So this line: m_pCalcNext( new CEvent(FALSE,FALSE)) creates a new instance of the CEvent class, the same way as m_pCalcNext = new CEvent(FALSE,FALSE);
The difference is that here it is in the initialization list and not in the constructor body (that's why I said more or less).
|
|
|
|
|
Cedric Moonen wrote: m_pCalcNext is a pointer to a CEvent object.
Ahhh , didn't look at the link... my bad. Here is one for GWB.... "I was wrong" ... hear that GWB it's not that hard to do you [bleep][bleep][bleep][bleep].
led mike
|
|
|
|
|
Use the <pre></pre> tag to format your code
|
|
|
|
|
Please anyone tell me which Entry point(Link->output->Entrypoint) should i use to create a _MBCS(Preproccessor defintion) Project?
|
|
|
|
|
|
I making a call to SetDIBitsToDevice() specifying a smaller width and height than the actual DIB section. The trouble is the image is always drawn bottom up. ie the bottom edge of the image is locked to the bottom of the specified rectangle. Could somebody please tell me how to draw the image correctly from the top down?
|
|
|
|
|
with most DIB funcitons, you can just give a negative value for DIB height, to flip the output.
it's worth a try..
|
|
|
|
|
I tried, without success , I also tried modifying the other params and creating the DIB with a negative height, but so far nothing has worked.
Here is the function call.
SIZE size = { _x2 - _x1, _y2 - _y1 };
POINT SrcOrigin = {0,0};
::SetDIBitsToDevice(
hdc,
_x1, _y1,
size.cx, size.cy,
SrcOrigin.x, SrcOrigin.y,
SrcOrigin.y, size.cy - SrcOrigin.y,
m_ppvBits, m_DIBinfo,
m_iColorDataType );
If I swap the commented line, it works fine, but it draws the full sized bitmap which is not what I want.
|
|
|
|
|
No matter, I managed to get it working correctly.
SIZE size = GetSize();
POINT SrcOrigin = {0,size.cy - (_y2-_y1) };
::SetDIBitsToDevice(
hdc,
_x1, _y1,
_x2-_x1, _y2-_y1,
SrcOrigin.x, SrcOrigin.y,
0, size.cy,
m_ppvBits, m_DIBinfo,
m_iColorDataType );
seems I had some of the paramaters a little messed up.
|
|
|
|
|
now i am able to execute a exe at scheduled time.
but i have to call a function at scheduled time.
suppose a service starts and at scheduled time, can i call a function of that service which is allready running by using task scheduler.
if any have idea please share with me.
thanks & regards
bankey
|
|
|
|
|
It sounds like you want two exes
A) Your service
B) A helper app that sends a message to (A) and tells it to perform its function
The two can talk using inter process communication[^]
|
|
|
|
|
Banks K wrote: but i have to call a function at scheduled time.
Set up a timer via SetTimer() . As each WM_TIMER message is received, check the current time with the scheduled time. If they match, call the function.
Banks K wrote: ...can i call a function of that service which is allready running by using task scheduler.
No.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Banks K wrote: at scheduled time, can i call a function of that service which is allready running by using task scheduler.
I don't understand. A "service which is allready running" would be a process. One process cannot "call functions" in another process. Please be specific when asking questions so we have any clue how to answer.
led mike
|
|
|
|
|
Banks K wrote: suppose a service starts and at scheduled time, can i call a function of that service which is allready running
For this you need to have interfaces exposed on that service.
Banks K wrote: by using task scheduler.
AFIK, taskscheduled runs only executables at scheduled time. You can access interfaces exposed by service in an executables, call required functions and schedule that exe using task schedular.
|
|
|
|