Open web link in Acrobat OCX - mfc

I have a MFC-application that uses the Acrobat OCX to display a PDF inside a CView.
When the PDF contains a link, the control changes the mouse cursor when hovering over it, but when I click it nothing happens.
When I use the Acrobat Reader application, it asks me if I want to open the link. So I guess there is some kind of notification message emitting from the control. It would be ok if I just get the address of the link, then I could open it myself.

Active X's link only works to the named destinations inside the same PDF file.
Developing Applications Using Interapplication Communication
You can also treat a PDF document as an ActiveX® document and implement convenient PDF browser controls through the AcroPDF object. This object provides you with the ability to load a file, move to various pages within a file, and specify various display and print options. A detailed description of its usage is provided in “Summary of OLE objects and methods” on page 30.
You probably have to use another OLE autoimation method, such as rendering PDF documents.
Developing Applications Using Interapplication Communication - on OLE capabilities in Acrobat section
You can render PDF documents on the screen in two ways:
●Use an interface similar to the Acrobat user interface.
In this approach, use the AVDoc object’s OpenInWindowEx method to open a PDF file in your application’s window. The window has vertical and horizontal scroll bars, and has buttons on the window’s perimeter for setting the zoom factor. Users interacting with this type of window find its operation similar to that of working in Acrobat. For example, links are active and the window can display any text annotation on a page.
The ActiveView sample in the Guide to SDK Samples shows how you can use this approach.
However, before you start this method, I recommend to download Acrobat SDK and excute some sample program whether link event is occured normally. Acrobat SDK have many useful vc++, c# sample program.

Related

Get HTML output in a window in c++ using Win32

I am new to C++. I really need to know how to get the output of HTML file in a window instead of getting that in browser. I searched so many sites. I got to know by using Tidy library, will get that but I don't know how to proceed with that.
Can any one please tell me how I will get the HTML output in a window?
I am using WIN32 API.
If I understand what you want, you would like to display HTML.
Internet Explorer as an ActiveX control should work for you, you can host HTML pages within your application. It is a deep subject, but you can get started by looking up information on the interface:
IWebBrowser2
If you are creating a windows application, open your dialog editor and add a reference to the MS Web Browser control, I can't tell you specifically what it is, but it should be in the list of COM controls available

Paste From QT Window to Another Application Input Widget

I am very new to C++ programming and the bulk of my program will be using the QT libraries. However, there is one part where I believe I will need to use Win32.
The scenario I want to code for is as follows:
I will have a QT application running. I want to be able to take some text which has been typed into a TextBox on the QT Window and paste that text into a TextBox in another application e.g. the address bar of Chrome, the address bar of Windows Explorer.
I want to be able to do that as a response to a button click on the QT Window. So, it would all happen in 3 steps. For example:
User types text into QT Window;
User places cursor in address bar of Chrome (Browser);
User clicks button on Window which pastes text into address bar of Chrome.
A nudge in the right direction would be most appreciated.
Edit - Additional Info
The application I’m building is a self-set assignment. I want to build a clipboard manager, similar to this old Delphi application http://www.joejoesoft.com/vcms/97/ . It will run in the system tray, in a minimised state.
The user, will put their focus into a text input in some application
which is running on their Windows machine e.g. Notepad.
Then, they will hit a hot key combination which will open a form (my QT Window.
The application will have been collecting clips as the user presses Ctrl-C (or by right-clicking) and those will be listed in that QT Form (just like the app in the link above).
The user then clicks on the particular item that they want paste and it will be pasted into the original input that they had put the cursor into.
Further Edit - further info
I'll break step 4 into a couple of sub-steps as it is causing confusion:
The user then clicks on the particular item that they want paste
Focus changes from QT Window back to the window of the other Win32 application which originally had focus
Content is pasted into the input control which now has the focus
I pretty much know how I can gather up items when the user copies things. But I have no idea how I will paste from my application to the target application.
Cheers

Usage of software input panel in DirectX based app

I am trying to add text input functionality into existing DirectX application that was being ported to Windows Store / Phone 8.1. The problem is that I can't even get the sample code provided by microsoft in this article to compile:
http://msdn.microsoft.com/en-us/library/windows/apps/jj247546%28v=vs.105%29.aspx
I am using Universal App project as a base and I have no acces to Windows::Phone::UI::Core (there is no Core namespace at all!)
I was trying to add dummy textbox and hid it somewhere but without luck as to appear the software keyboard you need to focus the textbox - the moment it receives focus it appears on the screen (we draw our own controls so I don't want the system one) despite the fact being set to Transparent, both foreground and background and width to 0.
How can I manipulate SIP to show/hide and retrieve input from the keyboard without having to hack my way through XAML and stuff?
On Windows Phone (but not Windows) apps can request the InputPane hide and show programmatically by calling InputPane.TryShow and TryHide.
If you want the InputPane to show automatically then you need to set focus to a control which identifies itself as a text control to the automation system (see the Touch Keyboard documentation on MSDN. Windows Phone works essentially the same as Windows 8 here).
There are two ways to do this in a DirectX app:
As the other thread describes and as you've tried, you can use a Xaml TextBox on top of your DirectX surface. This has the advantage of being easy as the Xaml controls already implement the accessibility and IME interfaces needed for full text support. It has the disadvantage of being external to the DX scene so it can require some care to place it nicely. You can't really hide the TextBox and divert the input, but need to use the TextBox for input. I prefer to do the full interactive form in Xaml rather than trying to merge a single TextBox into a full scene.
The other option is to implement a text control in DirectX. Windows uses the UI Automation API to identify and interact with text controls. If you implement the TextPattern and focus for your control within DirectX then the keyboad will automatically invoke when the user sets focus to it. There's a sample at Input: Touch keyboard sample which demonstrates the necessary interfaces within a custom Xaml control context. It won't apply directly to DX, but will give the general idea. The UI Automation Provider Programmer's Guide has more in depth information on implementing UI Automation interfaces. Again, while these docs target Windows they will also apply to Windows Phone.
I'm not sure exactly which code didn't compile for you. The linked pages are a bit out of date (SwapChainPanel is now preferred over SwapChainBackgroundPanel), but the classes and techniques involved should be valid for Windows Phone Runtime apps.

How to send keystrokes to an application in C++

I'm trying to make a program to open Acrobat files using Adobe Acrobat Reader and save them in a text file, automatically.
What I want my program to do is:
open the pdf
send Alt + Tab //to move to the acrobat tab
send Alt + F //to open file
send Down Down Down Down (4 times) //to select 'save as text' option
send Enter // to save
I'm using Windows OS.
can someone please help me on how to do this?
Well my finel goal is to save the title and author of about 2500 pdf files in a database automatically, what are the better ways you suggested ? this was what i came up with.
Try AutoIt. From it's website:
"AutoIt is a freeware Windows automation language. It can be used to script most simple Windows-based tasks."
You're going to want to use Spy++ and watch the messages being passed to the window when you perform these actions (note that opening the PDF with Acrobat and grabbing the Window handle are different operations). From there, look into:
http://msdn.microsoft.com/en-us/library/ms644950(VS.85).aspx
Win32 messaging is difficult if you're not used to it and fragile, as mentioned by #Alf. I'd suggest you try another approach, but if you Google "win32 sendmessage" or "win32 sendkeys" that should get you started.
Couple of things,
1) Simulating keystrokes to interact with another application is a very very bad idea. You're better off finding API's that'll do the same thing.
If you still haven't changed your mind, read further...
2) For Saving, Why not use Ctrl+S to save, Ctrl+O to open. I'm Sure you'll find direct shortcuts for the others too.
Here's a Project that might help.
You can use SendMessage API to send mouse and keyboard messages to a window, or you can use sendinput which simulates actual hardware events. I will agree with another person, use AutoIT

control monitor for application via C++

I have an application that opens up IE browser windows at certain intervals throughout the day. I would like to control the monitor that the browser window opens up to (for example browser1 opens on monitor1 and browser2 on monitor2 and browser3 on monitor1 and browser4 on monitor2). Is there a way using C++ (app is written in C++) to control the monitor that I open the browser window on?
There are various third-party utilities that will allow a user to control this, but programatically you would have to use something like GetMonitorInfo / MoveWindow to position IE after launching it.
An alternative would be to embed an IE control in a dialog or window of your choosing which you would then have complete control over.