com

How to call use .NET RijndaelManaged from native COM?

旧街凉风 提交于 2019-12-18 07:04:46
问题 Can anyone give example usage for using System.Security.Cryptography.RijndaelManaged from native Win32 using COM? Here is a functional example of how to use .NET's System.Security.Cryptography.SHA256Managed Note : This is an example of how to call SHA256Managed, and not RijndaelManaged**. i show this code to introduce some of the tricky concepts of calling COM objects with early and late-binding, and to show that calling .NET objects with COM Callable Wrappers is possible. Some people might

How to refresh Windows Explorer

天涯浪子 提交于 2019-12-18 06:54:13
问题 A network volume's name can be changed. I changed the name to Spinal Disk To change a network name, I do Write new name in Registry. Attach my network volume using functions like DefineDosDeviceW. In this timing, Windows explorer read registry in my guessing. SHChangeNotify(SHCNE_DRIVEADD, SHCNF_PATH, root, NULL); // To be sure. SendMessageTimeout(HWND_BROADCAST, WM_DEVICECHANGE, message, (LPARAM)(&dbv), - SMTO_ABORTIFHUNG, 200, &dwResult); // To be sure again! It works, but sometimes doesn't

How to refresh Windows Explorer

女生的网名这么多〃 提交于 2019-12-18 06:52:51
问题 A network volume's name can be changed. I changed the name to Spinal Disk To change a network name, I do Write new name in Registry. Attach my network volume using functions like DefineDosDeviceW. In this timing, Windows explorer read registry in my guessing. SHChangeNotify(SHCNE_DRIVEADD, SHCNF_PATH, root, NULL); // To be sure. SendMessageTimeout(HWND_BROADCAST, WM_DEVICECHANGE, message, (LPARAM)(&dbv), - SMTO_ABORTIFHUNG, 200, &dwResult); // To be sure again! It works, but sometimes doesn't

Any sense in marking an IUnknown-derived interface as dual in IDL?

雨燕双飞 提交于 2019-12-18 06:27:09
问题 Reviewing our code I've found a curious definition in one of .idl files: [ object, uuid(uuidhere), dual, nonextensible, oleautomation, hidden ] interface IOurInterface : IUnknown { //methods here }; How can an interface derived directly from IUnknown possibly be a dual interface? Will anything break if I remove the dual attribute? 回答1: In this answer to another question concerning marshaling user voyce points to this article that basically states the following: When any interface (IDispatch

Any sense in marking an IUnknown-derived interface as dual in IDL?

倾然丶 夕夏残阳落幕 提交于 2019-12-18 06:25:46
问题 Reviewing our code I've found a curious definition in one of .idl files: [ object, uuid(uuidhere), dual, nonextensible, oleautomation, hidden ] interface IOurInterface : IUnknown { //methods here }; How can an interface derived directly from IUnknown possibly be a dual interface? Will anything break if I remove the dual attribute? 回答1: In this answer to another question concerning marshaling user voyce points to this article that basically states the following: When any interface (IDispatch

Why does systemprofile need Desktop folder to open excel file

 ̄綄美尐妖づ 提交于 2019-12-18 06:07:31
问题 We were unable to open an Excel Workbook with ASP.net before creating a folder named "Desktop" in the systemprofile Folder. The solution was to create a folder named "Desktop" in C:\Windows\SysWOW64\config\systemprofile\ Error Message: System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Office Excel cannot access the file 'c:\temp\test.xls'. There are several possible reasons: The file name or path does not exist. The file is being used by another program. The workbook you are

Why does systemprofile need Desktop folder to open excel file

寵の児 提交于 2019-12-18 06:07:08
问题 We were unable to open an Excel Workbook with ASP.net before creating a folder named "Desktop" in the systemprofile Folder. The solution was to create a folder named "Desktop" in C:\Windows\SysWOW64\config\systemprofile\ Error Message: System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Office Excel cannot access the file 'c:\temp\test.xls'. There are several possible reasons: The file name or path does not exist. The file is being used by another program. The workbook you are

How to display system context menu for multiple files in different folders?

二次信任 提交于 2019-12-18 05:26:06
问题 This question is related to my previous question. I need to obtain IContextMenu* interface pointer for files in different directories (or even drives). See my code, which is not working properly (e.g. the file properties dialog shows wrong information), because I provide wrong relative PIDLs (as mentioned in this answer). int main() { CoInitialize(NULL); LPOLESTR pszFile = OLESTR("c:\\Windows\\notepad.exe"); LPOLESTR pszFile2 = OLESTR("c:\\Windows\\System32\\notepad.exe"); //LPOLESTR pszDir =

Using Reflection with COM Interop

a 夏天 提交于 2019-12-18 05:15:06
问题 After an interop call, I get back a COM object. I know this object will be one of three possible COM classes (Class1, Class2, Class3), but do not know which one in runtime. The reflection upon that object (interopObject.GetType()) returns the base RCW wrapper of System.__ComObject. What I need is to set some properties on the object - Text1, Text2, ... Text30 (actual names, btw :)), which exist in all three classes. So, the question is, can I somehow get the runtime type of the object (this

Can I use / access the app.config from .net code, when called via COM

你说的曾经没有我的故事 提交于 2019-12-18 04:52:37
问题 I have an existing set of .net libraries that I wish to call from Excel VBA (that part is working fine). These libraries rely on settings in the app.config. I know I can enter these settings in a excel.exe.config file (placed in the same directory as the excel.exe), but this doesn't really seem like a very manageable solution to me, as I can see causing conflicts if more than one application wants to do this. My question is simple: is there any way of COM exposed dlls referring to their