|
How can I implement timer in in Windows (2000/XP )with resolution of 1 milisecond
or better. Multimedia timer seems to be not accurate enough, but may be I am not using it right?
Thanks
DavidR
|
|
|
|
|
|
Bear in mind that although you can use QueryPerformanceCounter() to get an accurate elapsed time, you *cannot* get things to happen regularly at for example 1ms intervals.
Windows has an internal "clock" of (from memory) 12.5ms, and doing anything more often than that (reliably) just doesn't work.
using System.Beer;
|
|
|
|
|
Jon Hulatt wrote:
Windows has an internal "clock" of (from memory) 12.5ms...
Close. For Windows 9x/Me, the system clock ticks at 55 ms. For Windows NT, it ticks at 10 ms. This is the best that can be obtained with a non-RTOS system.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I am trying to read from a CFile object using CArchive and an overridden Serialize Function for a CObject derived object.
My problem is that how do i traverse through all the objects in the file with the Serialize function, and come to know that the end of file has been reached.
|
|
|
|
|
Can any one tell me how to add 'OK' AND 'CANCEL' button to modeless propertysheet just like the model one?
Lisoft
|
|
|
|
|
Keeping it as simple as possible, I need to add the support for crystal reports 8.5 and 10.0 in my application depending on which version is installed on the clients PC.
..RR..
|
|
|
|
|
hi
you already posted this msg, right? i have given the reply there.
|
|
|
|
|
Hi,
I'm trying to custom draw a list control. I'm also using it as a virtual list supplying data handling the LVN_GETDISPINFO message. I've handled the NM_CUSTOMDRAW to custom draw only specific Items the problem is the iSubItem variable in the LPNMLVCUSTOMDRAW structure is always zero when I'm expecting it to change. I'm depending on it to idententify which item / subitem it is currently drawing. this I'm doing when dwDrawStage == CDDS_ITEMPREPAINT. am i doing something wrong here. I've seen a sample application XListCtrl in this site which seems to work. am i doing something wrong here. please give me directions as to how to resolve this problem. thanks in advance.
|
|
|
|
|
I'm working on a filter funtion which filters the items in the list control. The items that I inserted into the list control have three attributes which is "creation time", "readed or not" and "item color"(because these attribute are specific to me, so I generalized them a little). what I'm trying to accomplish is to filter what appears in the list control according these three attribute of each item.
I'v got three comboboxs as the user interface which is according to the three attributes. They have the following content.
"creation time" combobox "readed or not" combobox "item color"
->today ->all ->red
->recent 3 days ->readed ->green
->recent week ->not readed ->black
->recent month
->all time
I am not famaliar with algorithm, but I am sure with algorithm I can come up with a very concise and clear flitering logic.But now I just trying to solve the problem too;)!
Can anybody provide a pseudo code or simple algorithm?
thanks!
|
|
|
|
|
Here is a generalization:
PopulateListControl()
{
date = value from "creation time" combobox
read = value from "read or not" combobox
color = value from "color" combobox
for (int x = 0; x < number_of_items; x++)
{
if (item.date == date && item.read == read && item.color == color)
insert item into list control
}
} Does this make sense?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have ploted a figure in a static or edit or any region. But I do not know how to save it in .jpeg,.bmp...file. Please help me in this trouble! thank you very much!
|
|
|
|
|
Hi there,
It's been years since I done serious C++ programming and I am rusty on STL and templates and I need a quick solution for the following issue:
I need to define some kind of policies based on user input, for instance:
- some processes should handle requests that start with letter 'A' - say
this is policy_1 (and is derived from unary_function<string, bool=""> ?!)
- the reminder of the processes should handle all the other requests -say
this is policy_2, which is the negation of policy_1-
The processes are stored in a vector, each process object has a reference
to its policy
References/pointers to policies are stored in a vector (so policy_1 and policy_2 have to be siblings from a common base class: unary_function<string, bool=""> ?!)
When a request is fired I need to:
- find appropriate policy in the policies vector
- in the processes vector find the least loaded process among those
which have a reference to the policy found in the previous step
So the question is how do I create a stand alone policy object that is the negation of policy_1 ?
Thanks,
Rick.
|
|
|
|
|
I hope anyone can help me..
Do I have to learn how to write a windows driver(W2K) to make programs works in the kernel mode...
plz if u have any resources about the kernel mode programming ..infrom me and thx
bye
|
|
|
|
|
you can go through the book of undocumented windows 2000 secrets by sven b.schreiber. there are plenty of books available in the market. U better search in the net and buy the books that u like. you can search for the amazon.com for the book titles.
naren
|
|
|
|
|
Pretty much. There are tricks that might let admin into kernel mode, but other than device drivers you shouldn't need kernel mode. (if anyone other than admin can get into kernel mode it is a bug)
What are you trying to do? If you just want to learn kernel mode programing as windows does it, then your best bet is to get the kernel for reactos and hack on that. (or if you want a kernel that is more useable, linux/BSD)
|
|
|
|
|
Hello,
In my CWinApp() derived class, I tried to handle the ID_FILE_OPEN message (using VC++.net's properties pane, but putting a breakpoint in the code shows that it never goes there. What gives?
My intent is to use a different doc/view template than the first one on the list.
thanks,
JennyP
|
|
|
|
|
Hi,
I have a program developed on Windows 2000 with the following properties:
1. It is an MFC Appwizard generated MDI application
2. Links to a COM server that I wrote
3. Links to 2 ActiveX Controls that I use for displaying graphics
4. Links to 2 dll's that basically have functions that communicate with the serial port
5. Is multi-threaded, I create my threads using the Win32 API ::CreateThread().
I have tested this program on Windows XP and Windows 2000 and it runs on these platforms without a hitch. However, when I use this program on Windows 98, my program crashes in many places. I deploy my program using Windows Installer so that my COM Server and ActiveX Controls are automatically registered for me, and on Win98 it seems that the program can successfully talk to the COM Server and use the ActiveX Controls.
I am wondering if anyone has experience developing applications that work with all of XP,2k and 98 and can tell me what would cause my program to crash on Win98? Will a re-compile with optimizations on a Windows 98 machine fix it? Or will it have no effect at all? I would also like to point out that the Windows 98 machine is slower and has less ram. Sometimes I get the out of hdd space warning too. Could this cause my program to crash?
Thanks in advance!
|
|
|
|
|
Things that come to mind from your description:
* Don't use CreateThread() to create threads, use AfxBeginThread() if the thread contains MFC code, or _beginthreadex() otherwise.
* Make sure your graphics drawing code cleans up GDI objects properly everywhere. Win 9x has 16-bit limitations in GDI, it's very easy to exhaust an internal 64K heap if you leak GDI objects (pens, brushes, etc).
* Does your serial port code work on 9x in the first place? Hardware access is radically different between 9x and NT.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
|
|
|
|
|
Thanks Michael, these are all very helpful hints that I have read about at many places but never followed because my code seemed to work in 2k I guess I should really look into the docs more closely and then go over all my code that doesn't behave.
Most of my graphics drawing code is in my ActiveX controls. They do actually store graphic objects to speed up draw times I guess that may be why its causing crashes.
I am using CreateFile and ReadFile functions to get at the serial port. I can't seem to find information about how hardware access is radically different between 9x and the newer 2k, but this will bump me in the right direction for further investigation.
Thanks again!
|
|
|
|
|
How can I enable the cut/copy/paste function in a "Form View"?
If I put a text box (edit control) in a dialog box with a MFC Dialog based application, the cut/paste functions work automatically with the Ctrl-X and Ctrl-V keys without any additional codes.
But if I were to do the same with a form view, i.e., using CFormView as the base class in a MFC SDI application, the cut/paste function is deactivated by default. How can I enable the functions?
Interestingly, I can get the functions to work simply by deleting all the associate accelerator keys. However, this is not the right approach as the menu functions remain grayed out.
|
|
|
|
|
Under link below to 'my articles' see the 'lockable edit and combobox controls' article. The article is meant to demonstrate something else, but I also implement Ctrl+C,Ctrl+V functionality in the classes.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
My understading of your approach is to derive a new class, CLockEdit, from CEdit and then use PreTranslateMessage to catch messages before the functions are executed. But is it necessary to create a new class just for this?
All I wanted to do is to turn on the cut/copy/paste function that is already there. As I had mentioned, the function can be enabled simply by deleting the Ctrl+X/C/V accelerators. My guess is that since I did not build any event handler for the accelerators, default handlers are used, which turns the function on.
If my guess is correct, shouldn't I be able to enable the functions via accelerators or menu functions, without the need of a new edit class?
|
|
|
|
|
h.lee wrote:
shouldn't I be able to enable the functions via accelerators or menu functions, without the need of a new edit class?
Probably so, but I don't know how, myself. This class I made was mainly to let edit controls be disabled without being grayed out. I was just trying to provide any help I could.
My articles
www.stillwaterexpress.com
BlackDice
|
|
|
|
|
Thanks for the help. As a newbie I really appreciate any help I can get. One day hopefully I can be like you and a bunch of others in this forum to offer helps to others.
For now, someone please help!
|
|
|
|