com

Export all queries of an access database with powershell

好久不见. 提交于 2019-12-11 10:14:26
问题 This question demonstrates how to do it with VBA, but I would like to do it with PowerShell, so it can be scripted and scheduled. I expected the implementation should be identical as they both allegedly use the same COM but it seems QueryDefs is not defined in the COM that PowerShell accesses as it returns nothing. # Open file in Access. $accessCOM = New-Object -ComObject Access.Application $accessCOM.OpenCurrentDataBase($dbPath, $false) # get list of queries $queries = $accessCOM.CurrentDB

What's the appropriate place to call CoInitialize/CoUninitialize across DLL's?

亡梦爱人 提交于 2019-12-11 09:53:31
问题 I'm implementing a DLL containing a shared ADO Connection by using the ConnectionObject property of TADOConnection and passing it across DLL boundaries into other instances of TADOConnection . I need to make sure COM is initialized, so I need to call CoInitialize / CoUninitialize . Currently it's in the context of a VCL main thread, but could be elsewhere in another thread, which of course requires its own instance of COM. I'm not currently implementing multi-threading. Where is the

what does “OLE The application called an interface that was marshalled for a different thread” after calling RevokeDragDrop mean?

柔情痞子 提交于 2019-12-11 09:51:58
问题 I'm still trying to figure out the answer to this question. I would appreciate a nudge in the right direction (since I have very little experience in OLE). Did anyone encounter a similar error after calling RevokDragDrop? thanks, 回答1: You passed marshaled interface into a different apartment. An attempt to call a method revealed this and the call aborted with this error RPC_E_WRONG_THREAD . You should be careful using interface pointers on multiple threads. If you intend to use a pointer that

DllRegisterServer error 0xc0000005, (C++ COM Dll). how do I debug my DllRegisterServer function in Visual Studio 2008?

ε祈祈猫儿з 提交于 2019-12-11 09:46:27
问题 I have written a COM dll, and wish to register it using regsvr32 myComdll.dll I get an error : DllRegisterServer failed, Return code was: 0xc0000005 I want to debug my DllRegsiterServer function, but I do not know how to set up Visual Studio 2008 to run regsvr32 in debug mode... Thanks Roey 回答1: Project + Properties, Debugging, set Command = Regsvr32.exe $(TargetPath). Set a breakpoint on your DllRegisterServer function or use Debug + Exceptions, check Win32 Exceptions. Press F5 to get it

COMException when assigning to Excel.Application.ActivePrinter

与世无争的帅哥 提交于 2019-12-11 09:39:41
问题 I have a function, into which I'm passing an Microsoft.Office.Interop.Excel.Application instance. The function uses Windows' built in Fax printer, or the Microsoft XPS Document Writer, to save the file as a tiff image. However, when I try to assign to the application's ActivePrinter property, a COMException with the following message is thrown: Exception from HRESULT: 0x800A03EC Here's the code: 'Save the current default printer Dim strDefaultPrinter As String = excelApp.ActivePrinter 'Assign

C# WinForms control in .Net COM Server won't redraw

≡放荡痞女 提交于 2019-12-11 09:21:25
问题 I have a COM server app which uses some WinForms controls which, frankly, do not seem to be redrawing when their properties (Text, BackColor, etc) are changed. I have tried invoking txtControlName.Invalidate() as well as .Update() and neither seem to be affecting anything. It is a business requirement that we stick to .Net 2.0 and provide a visually responsive and interesting UI, and while I realize I can probably force redraws with WinAPI SendMessage() I would much rather have .Net handle

Following a javascript postback using COM + IE automation to save text file

喜你入骨 提交于 2019-12-11 09:19:59
问题 I want to automate the archiving of the data on this page http://energywatch.natgrid.co.uk/EDP-PublicUI/Public/InstantaneousFlowsIntoNTS.aspx, and upload into a database. I have been using python and win32com (behind a corporate proxy, so no direct net access, hence I am using IE to do so) on other pages to do this. My question is that is there anyway to extract and save the CSV data that is returned when clicking the "Click here to download data" link at the bottom? This link is a javascript

CRT types across process boundaries

不打扰是莪最后的温柔 提交于 2019-12-11 08:38:07
问题 I'm doing drag/drop out of an activeX control. On drag, I provide a CComQIPtr which has COM methods implemented to pass information to the drop target. On drop, the drop target's process calls my COM methods to get information. Am I not allowed to use CRT types or pointers to CRT types near that interface boundary? I would love for my IDataObject to have a private std::list and some std::strings, and on the foreign side of the interface be able to call my COM methods which can access those

OLEDB - C++ - ATL's OLEDB Provider sample crashes Excel (uncaught exception from msado15.dll)

微笑、不失礼 提交于 2019-12-11 08:37:58
问题 I have compiled the Sample OleDb Provider code which comes from running the VS2007 ATL OLEDB Provider wizard. I have given fuller details on that blog post. The code crashes Excel. Sub TestOleDbProvider() On Error GoTo ErrHand Dim cn As ADODB.Connection Set cn = New ADODB.Connection cn.Open "Provider=FindFiles;Server=foo;Database=bar" '* this works Dim cmd As ADODB.Command Set cmd = New ADODB.Command Set cmd.ActiveConnection = cn '* this works cmd.CommandText = "*.*" '* this works Stop Dim rs

C++ COM object as property

妖精的绣舞 提交于 2019-12-11 08:30:28
问题 I need a object of my library and especially as a property because I need it in my methods. It works if I declare it as a local variable: #import "...\library.tlb" int _tmain(int argc, _TCHAR* argv[]) { CoInitialize(NULL); RobstepRemoteLibraryCSharp::IRobstepPtr interf(__uuidof(RobstepRemoteLibraryCSharp::Robstep)); std::wcout << interf->Test() << std::endl; interf->ConnectToPlattform("192.168.0.1"); } This works and does exactly what it should do. But how do get the "interf" variable as a