|
Hi All, I try to convert files automatically when I drag-and-drop then onto a removable drive. I am able to do that using a ContextMenu with the right button drag-and-drop but how can I do that with the left button Drag-and-Drop ?
Thanks for your help.
Erick
|
|
|
|
|
I have a task on PC, that must execute at about 100ms( 50~200ms is OK) interval to acquire data from outside target. Otherwise the data stream from outside target will be lost. I create a thread to do this. while (1) { DoTask(), Sleep(100) }. most of time it works fine, when PC is busy( e.g. open a doucumnet, or move mouse quickly ), the task won't run at 100ms interval. so I try to let the thread to be high priority. A little bit better, but still same. Is there any mechanism can guarantee this task run at about 100ms interval?
Thanks
|
|
|
|
|
Why aren't you using SetTimer(100) ? Unless you are needing granularity less than 55ms, it should suffice. See this article for more.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
xianwuluo wrote:
Is there any mechanism can guarantee this task run at about 100ms interval?
There are no "guarantees", since Windows is not a RTOS. However, multimedia timers[^] can often be good enough. Just don't use "WM_TIMER" timers - they are easy to use, but with VERY low precision.
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Thanks for you replay.
WM_TIMER is same as Sleep(), if you set timer interval as 100ms. you are not guaranteed to run at 100ms even 200ms or 500ms.
For Multi-Media timer... I 'll try.
|
|
|
|
|
You can use the following method...
Create a thread that will do your work every 100 ms..
ULONG __stdcall LogRotater(LPVOID pParam)// declare a thread function
And define it as below
ULONG __stdcall LogRotater(LPVOID pParam)
{
BOOL bStop=FALSE;
WriteMessage(msg,1);
while (bStop == FALSE)
{
HANDLE m_hEvent;
m_hEvent=CreateEvent(NULL,FALSE,FALSE,NULL);
switch (WaitForSingleObject(m_hEvent, DWORD(100)))
{
case WAIT_OBJECT_0:
bStop = TRUE;
break;
case WAIT_TIMEOUT:
//Do your work here ...
break;
}
}
return 0;
}
in case: WAIT_TIMEOUT you can do whatever you want to ...
Dharani Babu S
|
|
|
|
|
Hello,
I working on FindNextFile(); and it works greate, but i is a problem.
I check for *.txt files in the c:\\ and when I find a file I take the file name and show it in my dialog window but the thing want stop, If there is only one file then I can check the file name so I don't use the same file, But if there is more than one file the funktion check and load the same files over and over.
Is there anyway to check so I don't use the same file over and over again?
Hmmm I use this function on a timer so it checks every second.
Please help me.
|
|
|
|
|
If you are only wanting one file:
HANDLE h = FindFirstFile("c:\\*.txt", ...);
if (INVALID_HANDLE_VALUE != h)
...
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
No I just want to read in one copy of that file.
if I have bla.txt and bla1.txt
this files will be ream in over and over.
So I need to read in them ones and if there is
a new file like bla2.txt I need to read in that file to but NOT bla.txt and bla1.txt one again.
|
|
|
|
|
It sounds like you might benefit from ReadDirectoryChangesW() and/or FindFirstChangeNotification() instead.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
NO!,
I need to check for *.txt files every second.
And when I find a *.txt file I need to read in the the information from that file. So I need a check so I don't read in the same file one again. I only need to read the file ones. So how can I do that?
|
|
|
|
|
Larsson wrote:
I need to check for *.txt files every second.
How about using SetTimer(1000) ?
Larsson wrote:
So I need a check so I don't read in the same file one again. I only need to read the file ones. So how can I do that?
Can you rename the file before it has been read?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have been searching for a way to modify the time it takes for a sub menu to be displayed when the mouse hovers over the parent item. I know I can change this setting system wide using SystemParametersInfo(SPI_SETMENUSHOWDELAY, ...) but I would not like to make a system wide change, just application specific.
I believe I will need to subclass CMenu to change this default behavior, but I have been unable to find out where in CMenu the code that is doing this lives. Does anyone have any idea where/when this registry value is queried so that I can replace it with my own settings?
|
|
|
|
|
Please, I'm newbie and i want to do a program without windows and dialogs, only executes in background and has an icon in system tray.
Thanks!
|
|
|
|
|
lillah wrote:
...i want to do a program without windows and dialogs...
Are you referring to a service?
lillah wrote:
...only executes in background...
"Running in background" is not a term used in Windows as it is a multitasking environment.
lillah wrote:
and has an icon in system tray.
Have you researched Shell_NotifyIcon() ?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
You can do it .
Go to VC++-->New -->Projects-->Win32 Application -->Give project name-->Choose Simple Win32 Application . There you go ..
You can see an application with WinMain() ..No windows nothing as long as you dont want it ...
It willbe part of TaskManager but for making it have a icon in tray you have to refer some docs
Dharani Babu S
|
|
|
|
|
Thanks both.
I think i'm achieving it
|
|
|
|
|
I think you are confused. Creating a text-based application, as opposed to a GUI-based application, has nothing to do with running in the background. The term "background application" is a holdover from Unix. Windows, unlike DOS, is a multitasking environment. With DOS, you could create TSRs. With Windows, that is not necessary.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
cdhtmldialog is a powerful class which extends a common mfc dialog. but there are some problems which i don't know how to solve:
- how to disable backspace (VK_BACK), that the user can't go back in history but still enable it if user edits a text in a textarea or textfield ()? is there a way to determine in which context the backspace is used?
- how to disable 'shift'+leftmouseclick on a link which results in opening a new (fully ie featured) window?
- and the last point: how to catch a click event on a button with a specific id, which is part of a page where i don't know the url in advance (i only know the id of the button)? cdhtmldialog starts with a html page that is part of the resources and user can proceed to several online pages on which he can finish/close a process by clicking on a button with a specific id!
|
|
|
|
|
Hello, all!
Tell me please, how I can create a splitter in main window in MFC MDI? (Visual C++ 6.0, without WTL)
|
|
|
|
|
i'm not sure to totally understand your question, but you can create a splitter in the Child Frame window by using a CSplitterWnd in it.
Add a CSplitterWnd attribute to your child frame, then overload the virtual method virtual BOOL CFrameWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext); to create the splitter window object:
For example:
BOOL CSplitterFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!m_wndSplitter.CreateStatic(this, 2, 1))
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(0,0,
pContext->m_pNewViewClass, CSize(50, 50), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(1,0,
pContext->m_pNewViewClass, CSize(50, 50), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}
SetActiveView((CView*)m_wndSplitter.GetPane(0,0));
return TRUE;
}
Have a look to http://freedom2.pcupdate.easyspace.com/nt/ch07/182-186.html[^] for more info.
HTH,
K.
Fold With Us!
"A leader is a man who can adapt principles to circumstances - Georges S. Patton, 1885–1945"
|
|
|
|
|
Hello,
Whenever the application's InitInstance is executed, what is the best way of preventing the OnFileNew method from being called without removing the command line parser? Is this possible to do without recurring to the use of flag variables?
|
|
|
|
|
isn't OnFileNew() a function of the CView or its derived class? I'm not sure, but can't you just override in your derived class and not call the base class's function?
Who are all these people and what are they doing in my house?...Me in 30 years, inside a grocery store
My articles[^]
bdiamond
|
|
|
|
|
you could use CCommandLineInfo::FileNothing as a parameter to ParseCommandLine
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
If I have an "x" number of threads that I need started and will be passing messages to and from. Can I set my thread creating function like....
<br />
<br />
CWinThread myThread[nThreads];<br />
<br />
for (int i = 0; i < nThreads; i++)<br />
{<br />
myThread[i]= AfxBeginThread(MyThreadProc, this);<br />
}<br />
<br />
Thanks for the help.
Tom Wright
tawright915@yahoo.com
|
|
|
|