how to start with windows API in .net - c#

I want to work on windows API. I have an interest in creating network application that can communicate with web as well. I haven't thought any application yet. But before doing all this . I want to know where to start with. What all I need to start reading.
I have created lot of database interactive applications with window forms. But would like to start with this.

If you want to use Windows API methods from .Net, you'll need to use PInvoke to call them. There's a site called pinvoke.net that has samples for how you call many of the APIs so if you know which API you want to call, that's usually the best place to start.

For your use case maybe you dont need API at all. You could use the FileSystemWatcher .net class to react on any changes in a log folder e.g. It reacts on modify/add/delete of files.

Related

Communicate between local applications/Notify Running application

I have a C# Console Application which communicates trough its Input and Output with another application. This isn't a thing that can be changed so thats the given part of the problem.
The other part is that I need a way to communicate with this Console Application. Google says WCF, REST and stuff like that but this to me seams a little bit overkill cause I only need to communicate locally to the Console Application.
I also tought of communicating trough a file with that application but than I would have to check the file in an interval for changes right? Also I'm not sure if this is performance wise the best solution? Also i would have a delay, befor the notification happens depending on the interval.
So what would be a neat way to communicate between to local applications?
To achieve this use need to implement socket communication in your application. Below link will give you an idea on how sockets works in c#
http://csharp.net-informations.com/communications/csharp-socket-programming.htm

How to open an app side by side in winrt 8.1 and pass context?

In Windows 8.1, I've seen video demonstrating that app can now cause a second, separate app to start, running side-by-side split screen. I would like to know what is the API to do this?
I also need to pass in some context at the time the other app is invoked. We have a set of app that will work together and we need this seamless integration. Internet might be unavailable, so web services aren't an option.
Any help would be greatly appreciated.
This is WinRT XAML / C# BTW.
First, you'll need to set LauncherOptions.DesiredRemainingView per the documentation to one of the enumeration values specifying how much of the screen you'd like to keep for your application.
Due to the sandboxed model of Windows Store apps, sharing data isn't as simple. There are several options that may work for you: contracts and extensions and a custom url(walkthrough).

Custom Launchers and Choosers in Windows Phone

Obviously, There are more module of features in my Windows Phone 8 app. Normally i will restrict the developer to communicate between module to module. Hence i prefer to use Launcher and Choosers to solve this big trouble. Obviously my custom Launcher/Chooser will have their own Show() method to call the particular module as like build in Chooser/Launcher Task.Show().
In above case i should know the important concepts to follow when i write my own Show() method. From my knowledge these is the very basic one which comes by default NavigationHandling. Anyone could you please assist me on this?. Any help much appreciated.
Unfortunately, you can't write custom launchers and choosers. You can use only those that come with operating systems.
However, if you want to communicate with other applications, you can do it directly using App to App communication or via file extensions. In the former case you are quite limited since you must know which application you will call and what parameters you will supply, while in the latter case you tell the OS which file you want to open. This will show you a screen with all applications that can open that file type.
Both methods are limited and it is a shame that we don't have better app2app sharing capability.

Is it possible to embed Windows Sidebar Widgeds in own .Net Application

I'm trying to embed Windows-Sidebar-Widgets into my own .Net Application (WPF and C#), but I dont't realy know where to start. I googled a bit but only found SDK and tutorials for widget-development. I found that there is a small service in Windows, running the widgets. My thought was that I could perhaps fake this service and provide his functions whithin my programm, so that I can run and show the widgets.
Does anyone have some tips on how to do this? Or some experience in doing so? Perhaps there is even some kind of libary for that kind of stuff?
If this is not possible it is also an option to switch to an OpenSource widged-manager to use this widgeds, but this is only an emergency solution and the windows-gadgeds would be very appreciated.
Some information about my system:
I've written some kind of small windowmanager for childwindows in my application. And on the top of this I want to show the widgets in some kind of HostWindow.
Any hint will be appreciated.
P.S.: I would be willing to share the results if I (or we) get this working :-)
I've never seen a library for hosting gadgets, but since they are basically just websites you could use the MSHTML component to host any arbitrary gadget in theory.
This isn't to say it will be easy.
You'll need to extract a gadget to some temporary directory, spin up something hosting MSHTML (in WinForms WebBrowser would be convenient), navigate to the appropriate file in that temp directory (discovered by parsing gadget.xml), and shove something resembling the System object into the gadget.
As a starting point, inject some script that sets System = window.external; onload and WebBrowerser.ObjectForScripting = new FakeGadgetSystem().
FakeGadgetSystem will need [ComVisible(true)] and to implement a decent amount of stuff. I'd advise grabbing a widget or two to test with that mildly exercise the Gadget API, and then slowly implement the calls they make. It'll be a long haul for 100% compatibility with the official gadget hosting service.

OS function calls from ActionScript 3 ExternalInterface

Using ExternalInterface in AS3 is it possible to call OS (C#?) functions within XP?
Example: Set the desktop background to a image supplied by a flash app?
If it is possible would it be different calls when applied to different OS. And what about cross over the Mac?
Any information would be great
Thanks
If you're launching the swf from within a C# app, external interface will do just fine. Nothing will change on the flash side, but you'll need to go through a couple hoops to get it to work in C#. It's not as simple as AMF or External Interface to JS.
All the communications to C# get converted to XML describing the data, and you've gotta write XML to send back to flash. Other than that though, its relativly simple.
Here's some info on how to do it. The AS portion is Flash 8/AS2, but the C# portion should say the same.
When working with Flash from a webpage or as a desktop app, you are limited to a small security sandbox and you will not be able to make any relevant OS call. I thought that switching to AIR would give the developper more flexibility but it doesn't seem correct either. From "The Pros and Cons of Adobe Air":
AIR apps have
file access, clipboard access, support
multiple windows, support drag and
drop, and can trigger notifications
(toast in Windows). If you app needs
to interact with the desktop in other
ways, the chances are that AIR is not
suitable. For example, there is no
access to COM automation, and no way
to execute external applications. The
reason is to maintain cross-platform
compatibility. That's a worthy goal,
but it would be good to have a way out
of the sandbox. Unlike Java or .NET,
you cannot extend AIR with custom
native code libraries. Nor can you
call operating system APIs.
As Alex Jillard commented, if your swf is called inside a C# desktop application, you should be able to access more OS funcionalities although I'm not sure how.
You could use as already mentioned AIR. Another idea would be to use HippoHX (I haven't written this, the similarity with my username is just coincidence). It runs on top of the NekoVM and gives you unrestricted (so no limitations like in AIR ) access to the system.

Categories

Resources