how to implement openwith in winrt xaml - xaml

i am working on pdf viewer kind app in winrt.
it is almost done .but i want to add a feature that
when user RIGHT click on any pdf File in win32 there should be an option to open with my reader. can any one please tell me how to achive this

You need to enable your application to handle the pdf file type. You can do this by double-clicking on the application manifest file in Visual Studio. In the Declarations tab, add a new File Type Association. Then fill in the fields for the file association.
For example, the following adds an association for the ".myfile" extension:
The other thing that needs to be done is that you must in code handle the OnFileActivated event handler. This will be called whenever the end user opens a file with the associated extension from Explorer.
Note that for the file association to work, your application must be run at least once.
See the following link for more info on associating a file type: How to handle file activation

Related

How do I open a file with a specific application rather than its default application?

I am trying to open files using a specified executable; just like as if you were to right mouse click on a file then scroll to "Open with"
I tried what kaymaf said and reviewed the docs, but I cannot seem to get this to work.
Dim FI As New FileInfo(GetFileNameFromListViewItem(ListViewCollection.SelectedItems(0)))
Dim GetExif As Process = System.Diagnostics.Process.Start("C:\Users\*username*\Downloads\exiftool.exe", FI.FullName)
This just ends up open the executable and rather than opening the file with the executable.
You would like to open a file with your program using the Windows context menu; and do you want to get an entry in that menu? If that is not correct, the answer can be deleted.
I found this in a German forum, and they refer to this site:
This is the translated text:
One possibility would be that you register your file extension and your program in the system to open this file extension. As soon as the system knows everything, you only need to right-click on the file(s) and in the context menu, in addition to the standard entries, another menu item for opening these files is displayed. If you select this menu item, your program will start automatically if it has not yet started, and you can read out / determine the path to this file or several files in your program and process it accordingly. How it all works is described here: ookii.org/Blog/opening_files_via_idroptarget_in_net
On this page there is also a sample for download (start text files with your own program via an additional entry in the context menu / display paths to the files). It is not a VB, but it should be translatable without any problems. Corresponding information on the page and the comments should be observed.

Can only compile a VB6 DLL after opening a specific form in design mode

ActiveX DLL project - running it or Menu > File > Generate Dllname.dll... both produce the error message: Error loading DLL
However, if I open a specific form in design mode then I can compile or run the project without problem.
The form has a MSCAL.OCX v11 Calendar inside.
Note that if I open any other object (classes, forms, etc) continue with the error when try to Run/Compile. Is mandatory to open the frmDate.frm object if I want to Run/Compile the project.
I don't understand why it has this strange behavior and if there is a way to solve it.
Do you have proper appointed the startaup point of the project?
You can do this using this path above:
Go to “Project”->” Properties “, and in the “General” tab select the appropriate form from the “Startup Object” list box.

Open Text in App

I am looking for a way to right click selected text and open it in my app. Eg. via OS X's third party share menu. But I can not find any references at Apple's.
Have a look at the apple docs SysServices for creating a service for you app.
The Docs take you through an example of how to set one up.
Once done you will need to go into System Preferences and Enable the service. Your users will also need to do that.
Here is a quick project that shows an adaption of the apple code.
Update:
Although I think the services work good enough. Creating a Share or Action Extension is possible.
This example uses the same Project as above. But I have added an App Action extension (Target) to it.
The template for the Action is not too hard to understand and it took me 5 minutes to do this quick example.
(So I am not saying everything is as it should be but it works)
For the Action Extension:
Follow the instructions here
Which basically is:
After you choose the extension point that makes sense for your app
extension, add a new target to your containing app. The easiest way to
add an app extension target is to use an Xcode template that provides
a target preconfigured for your extension point.
To add a new target to your Xcode app project, choose File > New >
Target. In the sidebar on the left side of the new target dialog,
choose Application Extension for iOS or OS X. In the pane on the right
side of the dialog, Xcode displays the templates you can choose
Do read the above docs to understand better of what you need to do.
Once you have added the Extension. You can actually run it straight away.
Xcode provides you an option to choose a test app to test it in i.e TextEdit.app and takes you through the whole process of temporarily enabling the Extension.
In this example, remember I chose an Action Extension which suited the App.
The App's function in life is to do a basic encryption of selected text and then display the result.
The App's Action Extension will do the same but instead of displaying it, it will replace the selected text with the encryption text.
All that was needed for me to do, was copy the encryption method from the main app, over to the Extension.
I did have to adjust a couple of things though. Namely the original code deals with a NSString, where as the Extension deals with a NSAttributedString.
The conversion I did works but styling attributes are lost. For this example that does not really matter.
An Action Extension does not use the Share contextual menu. It uses an Action menu.
To see the menu, select some text and the hover the cursor over the selected text. You then should see a discloser button on the left of the text.
Like this:
Click it and choose the Extension.
If you do not see it, go to the 'more' option. This will take you to the system preferences where you can grant access to the extension.
The documentation is mainly concerned about distributing the extension and App via the App store.
But you can code sign your App and extension and do a normal archive export.
From there, all should work ok with gatekeeper.
But again refer to the Docs for a fuller understanding.
Here is a link for the code signed app and also the new Project.
Encrypto2

What is ApplicationEvents.vb file from

Just noticed a file named ApplicationEvents.vb in my vb.net project in the solution explorer, its empty...
Where would this have come from? is it safe to delete?
It is a file that can house common Application events like Startup and Shutdown. This is a partial class, so it would get compiled in when building the solution.
If it is empty, then it is safe to delete, but if you ever want to handle these events, then this is where you can easily hook into these events.
Read How to: Handle Application Events (Visual Basic) for more information.
Im using visual studio 10
The applicationevents.vb is not safe to delete if its empty. The project will fail to build properly because the file is missing. The project has some kind of internal reference to the file if you have created it. By default this file is not included unless you have clicked the "Application Events" button on the application tab in the project properties....
what I really want to know is why is mine blank....

Application crashes when calling embedded resources

I'm writing a console application in Visual Basic 2008 Express.
I added several text files to my project as resources. Specifically...
I went to my project's "Properties" page and selected the "Resources" tab.
I clicked the "Add Resource" dropdown and chose "Add New Text File".
I entered some simple text and saved the file as "Welcome.txt".
I built the entire solution.
In my code, I use console.writeline(My.Resources.Welcome) to display the text.
If I run my code through the IDE, it works fine.
If I run the EXE that's in the /bin/release folder, the app crashes.
My system logs show the error as "System.IO.FileLoadException".
I have tried setting the properties on the embedded text file to "Embedded Resource", but the result is the same.
Has anyone encountered this issue? Thank you in advance.
Copy Welcome.txt to your bin\release folder.
OR
To make Welcome.txt an embedded resource, right-click either the text file or the bitmap, and then select Properties.
In the Properties dialog box, locate the Build Action property. By default, this property is set to Content. Click the property and change the Build Action property to Embedded Resource.