|
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_
|
|
|
|
|
CStdioFile cFileObj;
CString strFilePath;
strFilePath = "C:\\Documents and Settings\\Desktop\\Test.txt";
// Open the selected file in Read mode
cFileObj.Open (mstrFilePath, CFile::modeRead))
now tell me how to use _eof
|
|
|
|
|
|
Don't use _eof if you are using CStdioFile.
Check this out:
CFile::Read returns the actual number of bytes read. If this number is less than the bytes requested, then the end of file has been reached.
CStdioFile::ReadString returns a NULL pointer when the end of file has been reached.
so when ReadString returns NULL you know the end of file is reached else continue with your usual functionality.
Hope it makes sense for you now...
kapardhi wrote: now tell me how to use _eof
(PS) Had you filed the details properly mentioning that you are using CStdioFile I would have offered the right solution in the first go...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi all,
I need to delete registry key values in VC++.
I want to delete the values of :: HKLM->SYSTEM->MountedDevices
Please suggest me by providing the code hints.
Thanks.
|
|
|
|
|
Try CReg class within ATL. It offers you so many handy functions.
|
|
|
|
|
hello
this may help you! Try it!
To delete the value and the key it self
::RegDeleteKey((HKEY)hKey,(LPCWSTR)szKey);
here HKEY is HKLM
szKey is resst of the path i.e SYSTEM->MountedDevices
to delete value of key
open the path
OpenKey (LPCTSTR hKey, LPCTSTR szKey)
here HKEY is HKLM
szKey is resst of the path i.e SYSTEM->MountedDevices
then
RegDeleteValue(mhKey,(LPCWSTR)lpValueName)
i hope this will work
|
|
|
|
|
Thanks for replying,
I need to delete all values of MountedDevices key. So To delete them one by one I need to put it in to a loop, so how can I know the no of values that are there.
RegDeleteValue(mhKey,(LPCWSTR)lpValueName)
in this function lpValueName I need to pass the value name one by one. But I want to delete all values so that it will take the next value itself.
Thanks.
|
|
|
|
|
Better delete the whole key and then create it with new sub keys but having same old names
|
|
|
|
|
Madan Chauhan wrote: I need to delete all values of MountedDevices key.
Have you considered RegDeleteKey() ?
Madan Chauhan wrote: So To delete them one by one I need to put it in to a loop, so how can I know the no of values that are there.
Did you search MSDN? Look for RegEnumValue() .
"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
|
|
|
|
|