Good to hear of you after all this time. Yes, the Macro's is a solution I considered, and I suppose I can write One Handler, to tie to several message ID's, (I know how the Macro's work) with a Macro for each, Just in a standard WndProc() you have only One switch, to filter those out you need to use to kick the timer, before calling the Default in any case. Looks more elegant.
Maybe not feasible in MFC.
Hope you have not given up on MFC. It has a lot to offer compared to those 'Synthetic Languages'.
to filter those out you need to use to kick the timer, before calling the Default
I would do it with a simple flag. Each time you handle one of the messages in question, set the flag to true. Each time the timer code gets called set the flag to false. You can then see whether there has been any activity between timer 'ticks'.
Bram van Kampen wrote:
Good to hear from you again,
Thanks for your kind comments, I've not been away.
Maybe I went away!
I'm still working with MFC 42, and DevStudio98. Works fine for me and my Customers. Have no reason to change Dev Platform.
Have built my own MFC Extensions to keep up with the times. Anyways, my market is not cutting edge, and a User Interface with as few changes as possible is most appreciated by my customers. I am proud to say that our user interface has changed very little over the past 30 years, other than in Screen Cosmetics. (We started our enterprise in Win 3.3), and of course there have been many extensions. Our Software ran very well on XP, refused to run on Vista, but, runs with very minor mods, on Win7.
Win8 is a bit of a challenge, Our Software was really never intended to run on a Mobile Phone! (A Sophisticated Cash Register!!), We hope for the best for Win10.
I found a certain amount of hostility on the site against those, like me, who refused to move with the times, and invest large sums in yet another development suite, which would solve problems I did not have in the first place.
Also, there is a learning curve to get familiar with each new edition of the suite, which has a 'Pay-Back' Time only, if it can do things quicker or better.
We never found that to be the case!
The New, as I call 'Synthetic' languages,(C# etc) I as owner, and by vast majority of Staff, will never go for!
At my age, I am not looking for other projects, or chasing new developments, I have a market in which my product sells.
It was just good to hear a familiar voice again, from one who gave us much helpful advice in the past.
I totally agree with what you say about using particular versions of development software, although you do sometimes get forced to upgrade as newer versions of Windows appear. As long as it keeps working, satisfies your customers, and makes a reasonable profit, then there is no real reason to change.
The advantage of this solution is that all events for the current desktop are detected regardless which window has the focus and which application is the active one. But it depends on your requirements if you want to reset the timer upon all activities or only upon activities for your application. In the latter case you can still use hooks by checking if your application is the active one and that mouse events are on the application window.
Well Thanks for your reply.
In my case I only want to monitor Mouse and Key Events in my own application, and want the screens to die, in particular if the App does not have the focus, and Mouse and Key events occur which are sent to another application.
What currently happens is that an employee is performing a Mundane -Idle Task- like pursuing old invoices. The employee is called away, for other more urgent tasks, but remains signed on to an application. Someone else can than a week later resume the Idle Task, under the still open account. I am trying to put a stop to that.
The invasive nature of installing a system wide hook for mouse and keyboard activity was really a concern, as appeared to be an overkill. so I have been thinking of using the App Message Map. I am really interested only in a 'Kick to Keep Alive' setup for my Cash Register Application. When the User is away, or, the Computer acting as Cash Register has switched context to another Application (Now THAT is an old fashioned term) the dormant Program should Quietly Log the current User Off!
Your idea is another one worthy of consideration, and further perusal.
So it seems that you can use Map to get a pointer to the complex values. That should be sufficient because the real part is stored first and therefore already at the specified index (when *p is a pointer to a complex array, p[n] and p[n].real() have the same address).
You need to install a PDF printer driver to use as your destination device. Alternatively you can write the code yourself using a third-party library, or code it from scratch by studying the Adobe PDF specification.
I am building my first class to output graphic to LCD connected to a micro.
Making small progress, however, since there is no proccess feedback form the LCD itself I have to "wait" until something, anything , shows on the LCD.
To test my code I opted to let the constructor paint the whole screen red.
Now for silly question.
I understand constructor function is to instantiate the class so the class methods can be used.
In general most constructors in micro world just take care of very basic - I/O pins assignments, serial baud rate etc.
Would it make more sense if I do all the painting OUTSIDE of constructor?
Or is is just one of those "personal preferences" ?
Eventually I will have more than one instance of this class running.
When using the class multiple times it will make of course sense to perform the output in it's own function. Otherwise each usage will initially draw the same. Even for testing you can call that function (it is just one function call after creating the class).
While you can do anything you want in a constructor, it is often not utile. Because constructors did not return a value, you will often find an additional setup function that returns success/failure while the constructor only initialises members variables.
To test my code I opted to let the constructor paint the whole screen red.
Painting sounds like a behavior rather than a setup. Thus the constructor isn't where it goes.
in micro world
Far as I know micro coding tends to strongly favor execution efficiency. So that decides it. After that then for object oriented programming it follows the idiom that
1. The constructor does what must be done for the object to exist. If it fails then the object cannot exist.
2. Other than 1 everything else is behavior so a method not in the constructor.
So if you can't paint the screen red is that a error or does it mean that caller is done and cannot and must not proceed?
It definitely makes sense to utilize methods return values, something I do most of the time anyway, and let the constructor just do very basic.
As I mentioned, in the real case of LCD class, I do not have feedback from most of methods,so I need to change my debugging.
Instead of blindly painting the whole screen I'll just paint one pixel ( which I probably won't be able to see) and than read it back.
I guess I should walk before running, or better yet after falling down while running it is time to go back to walking.
If you ever write some C++ code using MFC (Microsoft's Foundation Class, essentially an OO wrapper around the WinAPI), you'll notice that there are always initialization routines aside from constructors (they're called OnInit...blah ).
If you happen to use a dialog object, and attempt to draw from the constructor instead of the initialization routine, you'll notice that the objects exist but are not windows yet so you'll get an assertion (if running in debug mode). This means that the constructors have been called but nothing has been drawn yet. The drawing only occurs after all the constructors have been called, the initialization routines are systematically called after that and you can load all the widgets with whatever the default values to be displayed are.
Moral of the story, drawing typically doesn't take place during construction of objects.
Last Visit: 10-Jul-20 7:24 Last Update: 10-Jul-20 7:24