|
Did it work??
Regards,
Sandip.
|
|
|
|
|
Tsk Tsk
The last thing I told you yesterday was do NOT use MessageBox
to debug your message loop. Use trace messages instead.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am woking on an MFC Application. In my application I am Using a CListCtrl.
The values in the CListCtrl are fetched from server after evry 8 second.The Focus is set after 8 second on the first row.
Now what i want to know is that when the focus is on first row and i move the down key to move the focus to the second record it treats the index of first one. Similarly when i click third row it shows the index 20 be second.
Kindly tell me which window message is used when we move keys up and down for a CListCtrl. If possible please give me an example.
Thanks
Dhiraj
|
|
|
|
|
Im not sure do you need to NM_CLICK? or keyboard messages?
|
|
|
|
|
I have handled mouse click messages. Its just i want to handle keyboard up down key events.
|
|
|
|
|
Did you check WM_KEYDOWN/UP?
|
|
|
|
|
No but the control for which i want the window message is CListCtrl. So i think it should be something with LVS or LVN.
|
|
|
|
|
|
Greetings all,
While coding for a certain logic, I encountered an error (application crash-not often reproducible) which arose due to the fact that an object of a class was still being accessed by one or more threads. Now the proposed solution is to signal the thread and wait for its completion. What I have is only the thread id.
Is it possible to get the handle to the thread using it's id(I can't do this at the time of thread creation as it is already implemented and I can't change the way it is done) so that I can use WaitForMultipleObjects and wait for the threads to finish their processing before objects of the class are destroyed?
Any help / pointers : appreciated.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Do you intend this [^]?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
How can I set two different timmers and , I want to call two different timmer handlers respectively
|
|
|
|
|
the first parameter of SetTimer is an ID, which you define. so, you just give each of your timers a different ID:
SetTimer(1, 200);
SetTimer(2, 2000);
...
and then you check the timer ID in OnTimer, to see which timer has fired.
void CMyWnd::OnTimer(UINT nEventID)
{
switch (nEventID)
{
case 1: .... break;
case 2: .... break;
}
}
|
|
|
|
|
If I got you:
ptr_Electron wrote: How can I set two different timmers
Call two times the SetTimer function.
ptr_Electron wrote: I want to call two different timmer handlers respectively
provide two different callbacks as arguments of the above SetTimer calls.
For instance:
UINT_PTR iTimer1 = SetTimer( hMyWnd, nIDEvent1, uElapse1, lpCallback1);
UINT_PTR iTimer2 = SetTimer( hMyWnd, nIDEvent2, uElapse2, lpCallback2);
);
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Its simple you can calll two different SetTimer.
|
|
|
|
|
Hi,
i coded a sdi project with 3 horizonta splitters, no problem.
But now i want a vertical Splitter in the first pane,
********************
*------*-----------*
*------*-----------*
********************
*------------------*
*------------------*
*------------------*
********************
*------------------*
*------------------*
*------------------*
********************
but this doesn't wotk
I don't get an error, but the chilsSplitter isn't shown !
Here is my code:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
CRect cr;
GetClientRect(&cr);
m_Splitter_Main.CreateStatic(this, 3, 1);
m_Splitter_Main.CreateView(0, 0, RUNTIME_CLASS(CTest_01View), CSize(cr.Width(), cr.Height()/3), pContext);
m_Splitter_Main.CreateView(1, 0, RUNTIME_CLASS(CTest_01View), CSize(cr.Width(), cr.Height()/3), pContext);
m_Splitter_Main.CreateView(2, 0, RUNTIME_CLASS(CTest_01View), CSize(cr.Width(), cr.Height()/3), pContext);
m_Splitter_Child_1.CreateStatic(&m_Splitter_Main, 1, 2, WS_CHILD | WS_VISIBLE, m_Splitter_Main.IdFromRowCol(0, 0));
m_Splitter_Child_1.CreateView(0, 0, RUNTIME_CLASS(CTest_01View), CSize(100, 0), pContext);
m_Splitter_Child_1.CreateView(0, 1, RUNTIME_CLASS(CTest_01View), CSize(0, 0), pContext);
return TRUE;
}
Many, many thanx for your help !
Best regards
Croc
|
|
|
|
|
You might also need:
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
if(::IsWindow(m_Splitter_Main.m_hWnd) && ::IsWindow(m_Splitter_Child_1.m_hWnd))
{
m_Splitter_Main.SetRowInfo(0, cy/3, 10);
m_Splitter_Main.SetRowInfo(1, cy/3, 10);
m_Splitter_Main.SetRowInfo(2, cy/3, 10);
m_Splitter_Child_1.SetColumnInfo(0, cx/2, 10);
m_Splitter_Child_1.SetColumnInfo(1, cx/2, 10);
RecalcLayout();
}
} You could probably call SetRowInfo() and SetColumnInfo() at the end of OnCreateClient() , but I did not try.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Thx very much !
Now it works !
Best regards
Croc !
|
|
|
|
|
hai!
i am reading the contents of a text file
the text file contains
"
vicky
vizzy
madan
ganesh
jyothi
"
actually i am taking a loop of 100
i am reading each line at once?
what i need is i want to run loop exactly the no of lines within a file.
As i read the whole line as one string.
i tried this way i used to find the length of string currently read, add the length to the loop variable, but still it counts spaces, is there any concept of End of File or EOF.
thanks!
|
|
|
|
|
kapardhi wrote: i am reading the contents of a text file
how are you doing this ?
|
|
|
|
|
CStdioFile cFileObj;
cFileObj.Open (mstrFilePath, CFile::modeRead))
int nFileLen = (int) cFileObj.GetLength ();
for(i = 0; i<nfilelen;i>{
cFileObj.ReadString (strCurrString); // reads whole line at once
i += strCurrString.GetLength();
}
|
|
|
|
|
I'm curious how you knew that ReadString() existed yet did not know what it returned.
while (cFileObj.ReadString(strCurrString))
{
}
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
personnally, at that point, I gave up
|
|
|
|
|
Thanks!
i couldn't think this silly logic!
i was just wandering if any funtion exist to show end of file !
anyway thankyou!
|
|
|
|
|
There are several methods to read a file. You can use C functions like fopen, fread, etc.. alternatively you can use file streams of C++ and also you can use Windows APIs
If you're using Windows APIs please check the following sample
ReadFile Sample[^]
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
int _eof(
int fd
);
_eof returns 1 if the current position is end of file, or 0 if it is not. A return value of –1 indicates an error;
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|