interop

Could not find property of window when doing JS interop with Blazor

不问归期 提交于 2021-02-20 19:09:34
问题 Hello i am trying to call a method from a js file from Blazor . My file structure is like this: -root -JSInterop.cs -js(folder) -meth.js (file containing the js method) I keep getting the following error : Could not find 'methods' in 'window'. **Cs class that calls the js ** public class JSInterop { public static async Task<string> ChangeText() { try { var data = await JSRuntime.Current.InvokeAsync<string>("./js/meth/methods.print","mymessage"); Console.WriteLine($"ReturnedFromJS:{data}");

C# VSTO Powerpoint add Text as Field

北城以北 提交于 2021-02-19 06:10:23
问题 We are developing a VSTO application and we need this kind of feature group selected text as seen on the screenshot. We are able to do it by modifying the slide1.xml of an existing powerpoint file by changing the datatype of a:fld xml tag but question is how can we do it on runtime? When the presentation is just newly opened? Thanks for the answer. 来源: https://stackoverflow.com/questions/59266899/c-sharp-vsto-powerpoint-add-text-as-field

VB6 App + .Net component working as compiled app but not in VB6 IDE

戏子无情 提交于 2021-02-19 02:36:07
问题 I have a VB6 App that uses a .Net component (via a .tlb reference in the VB6 app) which is working fine when executed as a compiled app, but it produces an error from the VB6 IDE a certain point when it is trying to use the .NET component. I should note that the error occurs when the .NET component is meant to be invoking a third party reporting component. The error is specific to the reporting component. Something about not being able to cast from String to some other type. The .tlb is in

How To Create lParam Of SendMessage WM_KEYDOWN

为君一笑 提交于 2021-02-17 23:59:26
问题 I'm trying to use SendMessage to send a keystroke, and don't really understand the lParam. I understand that the different bits represent each parameter and that they need to be arranged in order. I've read this question & this, so I know which order the bits need to be in, I just don't know how to do it... How would I create the following lParam? repeat cound = 0, scan code = {Don't know what this is?}, extended key = 1, reserved = 0, context code = 0, previous key state = 1, transition

Control WPF progress bar from WinForms app

不打扰是莪最后的温柔 提交于 2021-02-11 15:46:48
问题 I have an WinForms app built with vb .net to which I've added a WPF user control. The WPF user control consists of only a progressbar. I can drag the WPF control from the toolbax and add it to the Main Form in WinForms vb .net. But I don't know how to let my WinForms app dynamically set the value for the WPF progress bar. Anyway I can dynamically set the WPF control progress bar's value from my WinForms app? Note: The reason Im using WPF progress bar instead of using WinForms progress bar is

How to fix System.TypeLoadException when declaring structs with union?

浪尽此生 提交于 2021-02-11 14:17:16
问题 Receiving System.TypeLoadException in runtime. I use code from third-party source to define structs and p-invoke external methods. I found the full code online in this link. In the code there are some structs with union, using FieldOffsetAttribute(0) on multiple fields. when I try to use some of the structs I get an exception: Could not load type 'NET_DVR_SLAVE_CHANNEL_UNION' from assembly 'ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' because it contains an object

Hide and Show taskbar on windows 10

一个人想着一个人 提交于 2021-02-10 14:53:58
问题 I have a wpf application which is in maximized state always without showing taskbar. Here is the code for Hiding and showing taskbar. [DllImport("user32.dll")] private static extern int FindWindow(string className, string windowText); [DllImport("user32.dll")] private static extern int ShowWindow(int hwnd, int command); private const int SW_HIDE = 0; private const int SW_SHOW = 1; static int hwnd = FindWindow("Shell_TrayWnd", ""); public static new void Hide() { ShowWindow(hwnd, SW_HIDE); }

How to map a C array to C#?

谁都会走 提交于 2021-02-10 02:32:18
问题 My question has to do with trying to call a function written in C from C#. I've looked in a header file that came with the C library to understand the functions as they exist in the C dll. Here's what I see: C code (for a function called "LocGetLocations"): typedef enum { eLocNoError, eLocInvalidCriteria, eLocNoMatch, eLocNoMoreLocations, eLocConnectionError, eLocContextError, eLocMemoryError } tLocGetStatus; typedef void *tLocFindCtx; typedef void *tLocation; PREFIX unsigned int POSTFIX

use delegate method written in objective-c in swift

限于喜欢 提交于 2021-02-08 10:19:14
问题 I'd like to use a delegate method written in Objecive-C in Swift. The method is included in the MGSwipeTableCell framework (MGSwipeTableCell.h). Objective-C: -(BOOL) swipeTableCell:(MGSwipeTableCell*) cell tappedButtonAtIndex:(NSInteger) index direction:(MGSwipeDirection)direction fromExpansion:(BOOL) fromExpansion; I try to convert it into swift to and use the method: func swipeTableCell(cell:MGSwipeTableCell, index:Int, direction:MGSwipeDirection, fromExpansion:Bool) -> Bool { return true }

C#: State of a Checkbox in MS Excel

与世无争的帅哥 提交于 2021-02-08 05:16:30
问题 I am trying to acquire state of a checkbox existing in an XLS document via C#. Let me back up here. This is what I have: MS Office 2007 + Dev Tools and VC# 2010 Express Referenced MS Excel 12.0 Object Library An XLS document I successfully retrieve the Excel.Shape object. However, I am stuck when trying to determine whether it is checked or not. So far I have acquired its AutoShapeType, which says msoShapeMixed. Can someone point me to the right direction? Thanks! class Program { static void