|
Hi,
i'm not using mfc in my application ;o) !
So please provide a solution without mfc !
Thx in advance and best regards
Richard
|
|
|
|
|
From MSDN about OnIdle
OnIdle is called in the default message loop when the application’s message queue is empty. Use your override to call your own background idle-handler tasks.
Why not do the "same" in your main loop?
When no messages are being treated treat Call an OnYourIdle Function
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Check out GetLastInputInfo() .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
If you are using MFC based application u can track it by overriding OnIdle method of CWinApp class.
for direct win32 application u can use WinProc method to track any message is posted on the message queue of the application.
One Best method is, Through Hook. write a WH_MESSAGE hook and do your work fine
I hope it will help you
thanks
|
|
|
|
|
Maybe one note on the onidle loop.
It will use a lot of cpu % usage!
You can solve this by setting a start time in your onidle (and then tell it to stop working) and starting a thread which will test this starttime against the currenttime. if a certain time has passed ... (take some action).
Put a Sleep in your thread to keep the cpu % usage down.
Have fun ...
|
|
|
|
|
As already suggested, GetLastUserInputInfo() on W2K+ systems.
Otherwise you could modify the main message loop, and take the time stamps of hincoming mouse/keyboard messages.
Another option would be a Mouse/Keyboard hook inside your process, that simply resets a timer. This seems the most independent solution (and not too complicated), but personally I would avoid a hook unless it's the only way.
or you just check if the space key is permanently down, and there are snoring noises from the MIC IN.
Flirt harder, I'm a Coder
mlog || Agile Programming | doxygen
|
|
|
|
|
|
I want to be able to display properties for file or folder, as we do when right-clicking over file or folder, I have to display this shell dialog (shell dialog I Guess), but my search in msdn and here at CP does not give any results. Does anyone know how to do that or have information link?
Thanks in Advance!
|
|
|
|
|
Try ShellExecute with the verb "Properties"
/Magnus
- I don't necessarily agree with everything I say
|
|
|
|
|
Doesent seem to work
|
|
|
|
|
Following is the code snippet i am working with.
miNumDataFile denotes number of datafiles
msarrDataFile[iloop] denotes the file path and name.
I am opening around 3000 fines in binary mode and
reading all the records in each file using fread. total file size
around 187mb with 1366218 rows.
its a simple c exe.
on the first run it takes 48 secs.
on the seond run it takes 2 secs!!!!!!!!!.
my question is why is happening. each time i reboot my pc
the same phenomenon happens. WHY??????
for(int iloop=0;iloop
|
|
|
|
|
The OS does a caching for you
does it bother you?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Thanks Papa for your reply.
I was not sure what was happening.
Now even if the OS is doing the caching part, I have 2 questions.
Will this happen in every OS. and further more some times it takes 1-2 secs to read files (total size 200 MB). that whats bothers me. 1/2 secs is really low, for reading and processing 200MB file wont you think!!
Anyway i am planing it run this component on a web sever. and a page will call this to show the results of this component.
thats why i am so worried about this thing..
Thanks a lot anyway...
Apratim
|
|
|
|
|
hi,
i created a simple editbox derived from CEdit class. its working , but clicking in the edit box sets out the devil.
The program shuts down after showing the message 'Debug Assertion Failed " Abort-Retry-Ignore.
Another problem is that i can't type characters more than the length of the editbox.
I wrote a message to handle the keypress event, using ON_EN_CHANGE(IDC_ED,OnEditKeyDown). but am not getting the 'enter' key.
the edit box is deleted in the killfocus event..
CAN ANYBODY HELP PLEASE ?
thanks in advance..
---------------- here goes the code-----------
-----edit box creation on pressing F4 key-----
case VK_F4:
{
CMainFrame* pMainWnd = (CMainFrame*) AfxGetMainWnd();
pEdit = new CEdit;
pEdit->Create(ES_AUTOVSCROLL | ES_WANTRETURN | WS_CHILD | WS_VISIBLE |WS_TABSTOP | WS_BORDER, CRect(0,col+(m_nCurSel*2),75,col+(m_nCurSel*2)+17), this,
IDC_ED);
pEdit->SetLimitText(50);
pEdit->SetFocus();
}
------ function that receives keypress---
void CMarketWatchView::OnEditKeyDown(UINT nChar)
{
static const MSG* pMsg = GetCurrentMessage();
if(pMsg->wParam==0x0D) //checkfor enter key
{
AfxMessageBox("Enter key");
- other code here-
}
pEdit->SetFocus();
}
---------lost focus function for the edit box ----
void CMarketWatchView::OnEditKillFocus()
{
char buf[50];
pEdit->GetWindowText(buf,49);
--other code here--
Invalidate(FALSE); //redraw
delete pEdit;
}
|
|
|
|
|
maybe you post the complete code here?
|
|
|
|
|
b coz, i want the edit box to be dstroyed when it loses the focus.
the user can press F4 key again to create it.
it will b good if edit box disappears, when user hits Enter key.
thanks
|
|
|
|
|
-----edit box creation on pressing F4 key-----
case VK_F4:
{
CMainFrame* pMainWnd = (CMainFrame*) AfxGetMainWnd();
pEdit = new CEdit;
pEdit->Create(ES_AUTOVSCROLL | ES_WANTRETURN | WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER,
CRect(0,col+(m_nCurSel*2),75,col+(m_nCurSel*2)+17), this, IDC_ED);
pEdit->SetLimitText(50);
pEdit->SetFocus();
}
------ function that receives keypress---
void CMarketWatchView::OnEditKeyDown(UINT nChar)
{
static const MSG* pMsg = GetCurrentMessage();
if(pMsg->wParam==0x0D) //checkfor enter key
{
AfxMessageBox("Enter key");
- other code here-
}
pEdit->SetFocus();
}
---------lost focus function for the edit box ----
void CMarketWatchView::OnEditKillFocus()
{
char buf[50];
pEdit->GetWindowText(buf,49);
--other code here--
Invalidate(FALSE); //redraw
delete pEdit;
}
|
|
|
|
|
Why are you killing the edit in the OnEditKillFocus?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
I'd guess that they want to implement 'in-place' editing of text in a view, and clicking somewhere else is intended to complete/cancel the edit, collapsing the box.
Of course, that's only based on a glimpse of the code fragment, so I could be completely wrong
Steve S
|
|
|
|
|
I meant why not hiding it?
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
OIC. That's a good question...
Steve S
|
|
|
|
|
Hi all,
How to resize/place the activeX control in a container window, By default the
activeX control is resized to Full window size in which it is hosting how i can avoid that.
Thanks in Advance,
Abhishake
|
|
|
|
|
Why is iostream.h & fstream.h missing from VC++.NET include folders.
If I copy the same files from VC6.0 then I get errors in those files.
What can I do, where can I get those header files and if not what headers can I use instead of fstream.h
We have a mathematician, a different kind of mathematician, and a statistician!
|
|
|
|
|
try to include instead :
#include <iostream>
#include <fstream>
TOXCCT >>> GEII power
|
|
|
|
|
"iostream.h" and "fstream.h" are not part of C++. Look at "iostream" and "fstream" and then the 'std::' scope.
#include <iostream>
#include <iomanip>
#include <fstream>
void SomeFuncToReadFile ( const char * sFile )
{
std::ifstream in ( s ) ;
if ( !in )
{
std::cerr << "Couldn't open input file : " << s << std::endl ;
return ;
}
in.unsetf(std::ios::skipws) ;
}
Paul
|
|
|
|