Get / Set SystemTimeAdjustment on WinCE and Linux - c++

I want to make get and set -Systemtimeadjustment to manipulate the local clock and i want to be platform independend. So how do I get the function(name) for WinCE or Linux? I searched in google but i didnĀ“t find anything!
Thanks!

Linux uses the adjtimex function (RFC 1305, David L. Mills). For details see Linux/kernel/time/timekeeping.c.

The two OSes work very differently in how you set the clock, so there's no way to do it "platform independently". Arno answered how it's done in Linux. in CE, it's done with SetSystemTime. You'll have to wrap the two in logic that determines at run time which to call or with #ifdef` statement to compile the right one for the right platform.

Related

What is the newest way to set language id when run exe on Win11?

Right now, I use SetThreadUILanguages() to set a thread's language to always get the timezone in English by GetTimeZoneInformation().
Unfortunately, sometimes it will still return Time Zone Information in the system default language.
I think SetThreadUILanguages() might be too old for Windows 11, so I try to use SetThreadPreferredUILanguages(), but I'm not sure how to use this function.
Microsoft seems not to give a sample for this.

How to know if process is application - Windows

Using EnumProcesses I am able to get list of currently running processes. But how do I know which of them are applications? I am talking this w.r.t. task manager, see here.
I guess IsWindow() function is what I need.. right? If not, please guide further.
You are looking for the top-level visible windows. Find these with EnumWindows. This enumerates all top-level windows. The ones you are interested are the visible ones. Call IsWindowVisible to obtain that information.

Monitor registry using C++

I want to monitor when a key is changed/added/deleted to the registry whenever application is being installed or removed. I have tested the sample code from the msdn(link) and it works fine.
But the problem is that it does not tell me which key has actually been modified/added/deleted. How can i retrieve this information using c++?
There are only 3 ways, none of which is both easy and adequate:
RegNotifyChangeKeyValue:
Doesn't give you the info you need, but is very easy to use.
EVENT_TRACE_FLAG_REGISTRY which is part of Event Tracing for Windows
which is what ProcMon uses. It works well, but it's quite difficult to use.
I'm not sure exactly how to use it myself, but if I figure it out I'll post it here.
CmRegisterCallback:
Requires kernel-mode driver, which is a pain in 64-bit.
But it's the most perfect solution otherwise.
Unfortunately Event Tracing for Windows (EWT) does not allow to see full key path in the event. You get only a partial key name and a strange handle with is actually a key control block. It's not so simple to get information from this block.
Yes the process monitor uses EWT, but it does not use Windows Kernel Trace as a provider.

how to run one program created exe file from another program in turbo c?

i am developed a program in dev c++ compiler name of file is CorrectPrgm.cpp and want to run CorrectPrgm.exe created by CorrectPrgm.cpp file. from Le.cpp which was developed in turbo c++ 3.0 compiler and my need is at the time of running Le.cpp i want to invoke/run CorrectPrgm.exe. The CorrectPrgm file accepts file name from user and produces output as list of tokens.
i have tried like this:
system("C:\\CorrectPrgm.EXE");
not working..
any other way to call...
Any help would be appreciated..
If you are on Windows Vista and above, probably you can't run it, as I believe this would be a 16-bit DOS applications. If it's 32-bit DOS app (proteced mode through DPMI, but unlikely) then it might run too, but that was too long ago to remmember how.
On Windows 7, you can install Windows XP mode (actually Virtual PC builtin kind of), and run it from there. XP still supports 16-bit apps.
I believe you can use one of the exec or spawn functions.
you can create a separate process for the program you want to invoke. But you will face a lot of problems. Firstly. correctPrgm.exe and le.exe will execute in two separate process. So you have to consider interprocess communication.
The best thing I'd suggest is break the CorrectPrgm.exe source file in functions and call the functions you need. Even you can use library and header file(s) to get the functionality of those functions.
You can also create threads. But then you have to design the threads (in one thread the CorrectPrgm will run) very carefully.

How do I get the current directory of a konsole kpart

Exactly what it says on the tin.
Also is there any way to tell what is running inside the shell?*
I suppose I could do this by looking up finding process with matching parent pids* but is that portable to windows? And how would you look up current directory of a process given pid*.
*(most to least preferable) qt or kde api/other crossplatform api/*nix and windows api?
It looks like TerminalInterfaceV2 might be exactly what I need, any extra info about it would be appreciated.