com

What does ComPtr.As() do?

让人想犯罪 __ 提交于 2019-12-12 05:29:26
问题 I am working on learning DirectX 12 from some examples but I am having trouble understanding what does the ComPtr.As() method does. ComPtr<ID3D12Device> device; ComPtr<ID3D12Device> device2; // Do Stuff with Device device.As(&device2); // What does this do? 回答1: Where did you find this example code? It looks fishy. This is kind of a nonsense use of As . It's equally silly if you expand it to the underlying QueryInterface : hr = device->QueryInterface( IID_PPV_ARGS(device2) ); In fact, your

Distinguishing IE windows from other windows when using SHDocVw

余生颓废 提交于 2019-12-12 05:27:18
问题 How can I distinguish IE shell windows from non IE shell windows? I've got the following snippet of code (Lot's or extraneous logic removed) that uses the ShellWindows object to scan the open windows to see what URL the user is browsing, with the intention of doing something if they have browsed to a particular URL: // Shell Windows object obtained in another method private ShellWindows shellWindows = new ShellWindows(); ... // iterate through all windows foreach (SHDocVw.IWebBrowser2

Exposing methods to JS on a CAxWindow from a BHO ( C++ )

江枫思渺然 提交于 2019-12-12 05:04:21
问题 I have this BHO which I successfully exposed method to JS from it using this thread: Calling BHO method from Javascript?. When I open a CAxWindow in order to host HTML docs, I'd like to use this exported method but it seems that it doesn't work for that window as well. I tried to make a custom class like: class Bubble: public CAxWindow, public IDispEventImpl<1, Bubble, &DIID_DWebBrowserEvents2, &LIBID_SHDocVw, 1, 0> { public: BEGIN_SINK_MAP(Bubble) SINK_ENTRY_EX(1, DIID_DWebBrowserEvents2,

How to add text content to a word document using the current tab/cursor location

本秂侑毒 提交于 2019-12-12 04:59:58
问题 Hi I am trying to add content to a ms word file which is opened using the command $word = new COM("word.application") or die("Unable to instanciate Word"); $input ="D:\\testword.docx"; $word->Documents->Open($input); Now I will manually change the cursor position in the opened document and I want to add some content to that position. $word->Selection->Typetext("The content to be added into current cursor position"); Above code will add the content into the start of the Doc file but how to Add

out of process COM server throws error 217

允我心安 提交于 2019-12-12 04:44:49
问题 I've created a COM object using NATIVE c++ - both COM object and it's native client works perfectly. the next step was to implement the COM object as a out of process COM server( hosted by the dllhost process. I followed the standard registry-change procedure(http://support.microsoft.com/kb/198891) and both client and COM server started to work properly under the dllhost.exe process. However, I can see that sometime the host server crashes and the dllhost.exe pop up a message stating error

Why Application.get_Caller(Type.Missing) returns a negative integer?

╄→гoц情女王★ 提交于 2019-12-12 04:43:41
问题 There's something weird about get_Caller(Type.Missing) method. It returns a negative integer, -2146826265 , instead of the Range object as it should. Has anyone come across this issue before? Why is that and how should I solve it? Thanks. Excel.Range range = (Excel.Range) application.get_Caller(System.Type.Missing); The above code would fail if I try to explicitly user type Excel.Range . The error message says, 'Cannot convert type 'int' to 'Microsoft.Office.Interop.Excel.Range'. EDIT: The

VB connect to COM object

你。 提交于 2019-12-12 04:33:17
问题 Either I don't understand COM objects, either it's all that confusing. I frequently 'create' , 'dispatch' COM objects - either in Python, either in VB ( Obj = win32com.client.Dispatch('Visum.Visum') or Obj = CreateObject("Excel.Application") respectively). That's easy, obvious and everything's fine. But how can I: a) connect to COM object which is already running b) get list of running processes which are COM objects in VB what is the reference, and additional info on: CreateObject command.

How might I obtain an IShellFolder from the active IShellView?

六眼飞鱼酱① 提交于 2019-12-12 04:28:35
问题 I'm trying to enhance a CFileDialog, and we're using the older version of it (the non-vista one that doesn't use IFileDialog). The older one does allow me to obtain an IShellBrowser, as well as (from that) the active IShellView. What I cannot seem to come up with is a way to get "What IShellFolder does that IShellView refer to?" Equally useful would be "What is the current folder that IShellBrowser has made active?" 回答1: I think I may have solved it in a round about fashion: I'm using CDM

new Outlook.Application() thorws error if Outlook app is running

╄→尐↘猪︶ㄣ 提交于 2019-12-12 04:25:24
问题 Hi I am having similar issue CreateObject on Outlook.Application fails on Outlook 2010 when Outlook is running under a different account but want customized solution. I want to sent email with attachment for which my code works but if OutLook app is already opened as desktop app, then I am getting this error. Requirement: I want to open outlook window showing everything like when we compose message in window. I am doing this: Microsoft.Office.Interop.Outlook.Application outlookApp = new

Convert MsWord first page to Image

情到浓时终转凉″ 提交于 2019-12-12 04:15:21
问题 I have an msword document that consists of some pages, i need convert only the first page to image and save it. Each page can consist of images, tables, text, etc. But i can't use clipboard buffer or any commercial software. May be anybody know some other ways ? 回答1: You can turn on the "Generate thumbnail for Document" option and word will generate an image for you (that Windows 7 uses to show the large icon view of the document. In word 2010, click File-Info then the Properties Drop down