How to implement trial experience in native C++ application (without XAML) - c++

Can I implement trial mode in my native c++ application (cocos2d-x-win8)
All examples shows C#/XAML and I cannot find anything working in c++

I'm not sure if you're asking about Windows 8 or Windows Phone 8 but luckily the answer is pretty similar. On WP8/Win8 from C++/C# you should use CurrentApp.LicenseInformation.IsTrial. However, due to a bug in WP8 invoking CurrentApp::LicenseInformation->IsTrial on the app's main thread will throw an exception. So you should on a different thread:
ThreadPool::RunAsync( ref new WorkItemHandler( [](IAsyncAction^ operation)
{
auto value = CurrentApp::LicenseInformation->IsTrial;
}));
However, do note that the Win8 store offers a built-in time limited trial and WP8 store doesn't offer that by default. In WP8 you should implement your own trial logic.

Related

C++ windows phone 8 components

I'm new to windows phone development, and I need to create a control with C++ (basically it's a WebBrowser control) I would create with C# but the library I need to use for core is written in C++.
Conclusion: So the question is, Can I develop a control in C++ using external libraries and then compile it to use with any language of the CLR and use it in my windows phone 8 applications? If does, let me know about some resource any video, book, or whatever.
The general answer is "yes", although it comes with some caveats.
It's certainly possible to build a component in C++ using the Windows Phone Runtime APIs and then utilize it from another programming language, such as C#. The more "pure" the C++ code is in that it doesn't access native operating system features (that may not be present), the better off you'll be.
There's some general guidance on MSDN:
Native code for Windows Phone 8
Windows Phone Runtime API
Using Native C++ code in your Apps
That being said, if you're attempting to create an entirely new web browser for some reason, I'd strongly suggest you consider using the built in WebBrowser component. In Windows Phone 8, it's based on IE10, and in Windows Phone 8.1, it's IE 11. Those are both very capable browsers and designed to work well within the memory constraints of the platform.

Creating many native GUI frontends for a cross-platform application

I've been away from GUI programming for quite some time so please pardon my ignorance.
I would like to attempt the following:
Write a Mac OSX app but still be able to port to Win/Linux (i.e. C++ core with Obj-C GUI)
Avoid Qt/other toolkits on OSX (i.e. talk to Cocoa directly - I feel that many Qt apps I use stick out like sore thumbs compared to the rest of my system)
Not as important, but it would be nice to avoid Visual Studio if it means I can have the freedom to use newer C++ features even on Windows if they help create better code.
I believe this configuration might get me what I'm looking for:
Core C++ Static Library
OSX GUI (Cocoa)
Windows GUI (Qt+MinGW?) OR (no new C++ features, Visual Studio + ManagedC++/C#/????)
Linux GUI (Qt)
Once again, sorry for my ignorance but is this possible? Is this sane? Are there any real-world open source examples accomplish something like this?
There is quite a few OS X applications that have completely custom-designed looks that don't use very many stock controls. iStat Menus comes to mind, but there are many other examples. They still look good, but it's done by manually designing them to look good and to "mesh" with the overall look of OS X applications. Even their preferences pane doesn't use stock buttons.
Thus, you can go quite far using Qt, you just have to pay close attention to what you're doing - similarly to the way other developers are paying close attention even when using Cocoa. You'll find that Qt's controls offer functionality often above and beyond what's offered in Cocoa.
That said, on OS X sometimes you may need to run some native code that expects a CFRunLoop to be present. It's good to know that Qt's event loop already spins a runloop for you, so as long as you have an event loop spinning in a given thread, you can use runloop-based code - the default runloop is provided by Qt's implementation of QEventDispatcher (somewhere in its guts). For non-gui threads, the unmodified QThread does it for you. This is useful for using asynchronous IOKit functionality, for example. Another answer of mine presents some Cocoa mouse event grabbing code. A previous version that used Carbon can be found in the edit history of that answer.
Same goes for Windows: Qt runs a message sink for all top-level windows it owns, and you can integrate native controls/windows using qtwinmigrate. You can also integrate ActiveX controls using the Active Qt framework.
Well I think you should try Qt even on OSX. Qt allows native/custom look of applications (those cases you mentioned are probably bad examples - you probably haven't noticed that lots of other applications also use Qt).
Tools I usually use for multi-platform development:
C++ (now C++11 since all major compilers more or less support it)
Boost
Qt
CMake as build system generator
If you use this tool-set you can choose whichever platform you like for development and still be multi-platform without extensive work on the other platforms.

QT based Win7 app can't cope with the death of an I/O device

I'm writing a QT based native c++ app that uses QtSerialPort library under Win7. It communicates with it periodically(say every 5seconds).
Problem is: the device that my app connects to via serial port, has power loss issues(can't change this). When this happens my app becomes hung and immortal: can't be killed by windows task manager or by process hacker(a nice replacement for windows task manager)' termination facilities. Soft restart is the best solution at the hand.
Now how can my app cope with such device situation?
I would submit this question to Qt's interest mailing list (interest#qt-project.org). Since the QtSerialPort library is fairly new, bugs can appear when a wide user base starts using it. There is a good chance that the developers who wrote the library can give you a better solution or they find that this is a bug in their code and fix it.

Native C++ and Windows Tablets

I have a service application (no frontend) that was converted from C# to CPP native code not implementing .net framework. This was done to speed the processing and to reduce the footprint.
I am investigating the move to support this service to Window tablet devices. How would I go about this and what obstacles might I meet along the way?
TIA
You shouldn't expect troubles, even Windows Phone 8 will introduce full support for the C++, there is no relevant news that can make you worried about Windows 8 and C++, the only relevant thing is the addition of the WinRT to the usual set of C++ libraries for Windows but is more like an extensions rather than a set of libraries that will suppress something that is already existing in the Microsoft environment.
The only real changes are in the GUI subsystem, as you can expect just looking at the Windows 8 products and in this case under Windows 8, if you want a GUI, you probably do not have other options than switch to the new WinRT.
There is also this link that can be useful.

Timer in VC++ for Non-GUI Applications

I want to test a code which is designed for running on a Microcontroller and it is platform independent.
Problem is I currently don't have any Embedded simulator (due to some damn reason!) and I want to test it... I am using Visual Studio 2008 (What a Pity!!).... Code is entirely in C but as VS 2008 doesn't support C, I have stored files as .cpp.... But No C++ concept is used!!
What all I require is a Timer which would generate Interrupt after every 1 millisecond!
And One more thing.... Can I configure something so that an Interrupt will be generated if I press certain key on Keyboard....
I don't want to make GUI. I searched for Timers and all were for MFC application.... If there isn't any option, I will make a rough MFC...
Regards!!
For high precision timers the your best bet is probably CreateTimerQueueTimer (not used personally).
Personally I used to use timeSetEvent but that was way back years and years ago.
You can try the Boost Asio Timers too. If you don't have it setup, please refer here: Getting Started on MS Windows.