I am new in developing application for WinCE 5.0. I want to start from "Hello world" program or console application. But I couldn't find anything like that or any other sample applications to start from.
I am using Visual Studio 2005. I created new project >> visual C++ >> Win32 smart device project >> console application >> finish.
The project compiles fine. I was trying simple
printf("Hello world");
But When I ran in smart phone 2003 emulator, it showed no output.
I couldn't find a good tutorial to start from. Please suggest me some good tutorials or sample applications to start from.
Thanks in advance.
What does the log say? That the application has terminated successfully with return code 0x0?
If you did not put anything to stop the application it might be that it runs good and terminates without you noticing it. Try to add a scanf or Sleep(5000) after the printf statement so things will be visible. You can also compile it in debug mode and put a breakpoint after the printf statement and see the results.
In addition, I am not too familiar with Windows Mobile and its incarnations (smart phone 2003 being one of them), but I am not sure how it handles a printf. You can try create an MFC application and use the MessageBox to display your text.
OK. I just tried the two options and there is no CMD windows in Windows Mobile (Smartphone or PocketPC) so the application runs successfully, but prints nothing.
Use the MFC option or deploy your application to a Windows CE 5.0 device emulator image. I have not tried that download myself, but it says that it should save you the hassle of handling Platform Builder. Note that you might be missing some components in the image down the road, but I suppose that for practicing purposes it should suite you just fine.
WinMo/Pocket pC devices have no console, so your output went nowhere. You can always add a console on like PocketConsole.
there is CMD windows in POCKET PC 2003 emulator you can try it using visual basic code
Related
I've written a console program that "does stuff" - mainly using boost. How do I convert it to a Windows Service?
What should I know about Windows Services beforehand?
There's a good example on how to set up a minimal service on MSDN. See the parts about writing the main function, entry point and also the example code.
Once you've got a windows service built and running, you'll discover the next major gotcha: it's a pain to debug. There's no terminal (and hence no stdout/stderr) and as soon as you try to run the executable it actually launches the service then returns to you.
One trick I've found very useful is to add a -foreground option to your app so that if you run with that flag then it bypasses the service starter code and instead runs like a regular console app, which makes it vastly easier to debug. In VS.Net set up the debugging options to invoke with that flag.
There's a really good example on msdn here
It's a boiler plate C++ service project that has self install/uninstall functionality and logs service start and stop events to the windows event log. It can be stopped and started through the services app (snapin) like other services. You may want to initially give it LocalSystem rights to see it working , as on xp at least it doesn't have enough rights to start with the project provided rights of LocalService. The Visual Studio 2008 project otherwise runs out of the box despite the downloaded instructions implying otherwise.
A bit late but I hope this helps someone else.
You might be able to 'wrap it' using this tool from CodeProject:
http://www.codeproject.com/KB/system/xyntservice.aspx
Worth a look.
The simplest solution might be to create a new Windows Service project in Visual Studio and copy across your code to the new project.
If you refactor your code so that you've split the UI (in this case the console) from the logic you could create a library that does the work and then call that from both the Console project and the Service Project.
You can configure an application to run as a service by using the Srvany tool, which is a part of the Windows Server 2003 Resource Kit Tools.
Srvany allows only one service at same time. So I write my srvany (sFany) to make nginx and php-cgi run as windows service together. Here is the source https://github.com/stxh/sFany
I am writing a cross-platform application in C++ using Visual Studio.
My project type is the most basic one "Win32 console application".
I admit it, I haven't mastered all bits of windows software development, but there seems to be a clear pattern:
When you run an application from a CMD session, by default, Windows connects the app's default stdin/stdout/stderr with this CMD session.
(I.e. when you type 'dir' in a cmd session, it doesn't fire up a new cmd window.)
This is, however, not the case when running an application from VS. That is, when I press F5, it fires up a new console window, runs my console app inside this window and connects stdin/stdout/stderr with this console window.
What I want is instead to connect stdin/stdout/stderr with a sub-window inside the Visual Studio itself. (Akin to an "Immediate" window.)
Then I won't have to switch back and forth between VS and CMD.
Clearly, there should be some mechanisms to achieve that, since from an ordinary command prompt I could do something like:
a.exe 1>stdout.txt 2>stderr.txt <stdin.txt
I'd like Visual Studio to do something like that when running my application, but instead of files, connect the streams to a sub-window in VS.
The principal thing here is that this should be done without any modifications to the application code itself, because it must be completely independent of the development environment and/or platform.
(That's why I didn't use one of the many solutions found on stackoverflow -- they all are based on some adaptation of the application code.)
Disclaimer: I'm quite new to the MSFT tech world and only started Windows Phone development a month or so ago.
I am unable to figure out how to log information to the Visual Studio Output window from within a C# and C++ (Direct3D) Windows Phone 8 App. Is this possible?
I am building in debug mode, targeting Windows Phone 8, running in the XDE emulator and my development machine is a Windows 8 box with VS2012 Ultimate installed. My App runs fine, my Direct3D scene renders normally, but I can't log anything! This makes tracing code execution difficult and forces me to use breakpoints (which can be overkill in many situations).
I've been searching far and wide and have tried many methods (OutputDebugString being one of them). I can't see anything on MSDN about this - why is this not documented anywhere?
Yep, it's possible to write debug strings from WP8 C++ to the output window in VS2012. I actually have an example of that here.
1) Invoke OutputDebugString from C++.
void Direct3DInterop::MyButtonWasClicked()
{
OutputDebugString(L"Button was clicked!");
}
2) Before running the app make sure to change to the native debugger from the managed debugger in the project's properties.
I believe the methods in System.Diagnostics.Debug (specifically the overloads of WriteLine()) work...although I haven't tried them with C++ apps.
I've been searching arround StackOverflow but seems I can't find the exact explanation for my problem:
I am running a GUI Application compiled under Visual Studio 2012. As it is a GUI application, sometimes it's quite hard to Debug it normally, so I need to printout some values while executing. I've done a couple of printf but the problem is that, as it is a GUI application there is no Console available while debugging it. I need to debug and have a Console to display these output values from printf. I know under CodeBlocks it is possible to do so, however the project is quite big to have to migrate everything to gcc CodeBlocks.
Could anyone tell me how to display such console or how to workaround the problem and have a similar result?
Thank you very much
Windows applicaton can't be both GUI and console.
There is a workaround however:
If you applicatop is based on MFC use TRACE macro.
Otherwise make your own wrapper around OutputDebugString function.
Both will output to Visual Studio's 'Output' pane when you launch our program under debugger
An of course you can always output diagnostic messages to good old log file.
I have a cross platform desktop C++ app for Mac OSX and Windows, for which I'd like to collect debug info when a crash happens on a user's computer, so I can find out what the problem is and fix my code. On Windows I'm using visual studio express 2010 and on Mac I'm using Xcode 3 as IDE. I remember an online service where you could sign up and link your code with a library, so the app would upload crash info to the service, which you could then use to fix the app, but I can't find it anymore after googling for 10 minutes. Can anyone help?
Thanks!
B
Please see here for the google-breakpad project. I think this is what you need. I was going to use it for a project so I researched about it but then the project ended so I didn't have a chance to. You link your program with it and when the program crashes, it generates a crash dump that is not compatible with any of the platform-specific crash dump formats but has its own one. You can then analyse them with a program that is part of the breakpad project. As far as I remember, there is also a service that you can install, where the crash dumps can be uploaded. The service then can analyse and group them by reason etc.
Hope that helps.