Questions tagged [invoke]

Executes the specified delegate on the thread that owns the control's underlying window handle.

The Invoke method searches up the control's parent chain until it finds a control or form that has a window handle if the current control's underlying window handle does not exist yet. If no appropriate handle can be found, the Invoke method will throw an exception.

1794 questions
9
votes
3 answers

VB.NET Delegates and Invoke - can somebody explain these to me?

I'm new to the world of threading, but a few aspects of an app I'm working on require me to use a BackgroundWorker control to prevent the UI freezing up while it's doing some file operations. What I'm trying to do is update a couple of form labels…
synoptica
  • 113
  • 1
  • 1
  • 9
9
votes
3 answers

How to "invoke" a class instance in PHP?

is there any possibility to "invoke" a class instance by a string representation? In this case i would expect code to look like this: class MyClass { public $attribute; } $obj = getInstanceOf( "MyClass"); //$obj is now an instance of…
NovumCoder
  • 4,349
  • 9
  • 43
  • 58
8
votes
4 answers

WIX invoking Batch file in InstallExecution Sequence

I am new to WIX and I am trying to invoke a batch file from my WIX installer. MyBatch.bat contains a simple Copy of a Text file from c:\ to D:\ I am unable to invoke the batch file. Below is my code. Please help me out.
Girish
  • 389
  • 2
  • 4
  • 12
8
votes
3 answers

Must I Invoke() to show dialog or MessageBox from a thread?

I'm executing a code in a worker thread. Sometimes, I need to show a dialog or a Message. I have been playing with the code and only seems to be strictly necesary to Invoke when I pass a IWin32Window to the dialog. Otherwise works fine. My…
Daniel Peñalba
  • 30,507
  • 32
  • 137
  • 219
8
votes
1 answer

Blazor InvokeAsync vs await InvokeAsync

Edit: for clarification, this is in a Blazor Server application I'm confused about the correct usage of InvokeAsync and updating the UI. The documentation has several usages without really explaining the reason for awaiting or not awaiting. I have…
8
votes
3 answers

Cross-thread exception when setting WinForms.Form owner - how to do it right?

I have a main UI thread which runs the application and creates the main window form (let's call it W). I have also a secondary thread that I spin up and which creates a dialog box (let's call it B). I want to set the owner of the dialog B to be the…
Pierre Arnaud
  • 10,212
  • 11
  • 77
  • 108
8
votes
9 answers

C# compile error: "Invoke or BeginInvoke cannot be called on a control until the window handle has been created."

I just posted a question about how to get a delegate to update a textbox on another form. Just when I thought I had the answer using Invoke...this happens. Here is my code: Main Form Code: using System; using System.Drawing; using…
OneShot
  • 609
  • 8
  • 20
  • 32
8
votes
2 answers

How to invoke the Android calculator from an app

I want to invoke the android calculator from within my app. I don't want to pass anything to it, just provide a quick launch button to it. Can anyone show me how or point me to an example of how to do this?
miannelle
  • 2,241
  • 5
  • 20
  • 15
8
votes
1 answer

Invoking System.Delegate class object in C#

I am trying to build an object that uses System.ComponentModel.ISynchronizeInvoke, which has the method: (amongst others) public object Invoke(Delegate method, object[] args) What is the best way to call the method with the given arguments? I…
Rob
  • 1,687
  • 3
  • 22
  • 34
7
votes
3 answers

Invoke method by MethodInfo

I want to invoke methods with a certain attribute. So I'm cycling through all the assemblies and all methods to find the methods with my attribute. Works fine, but how do I invoke a certain method when I only got it's MethodInfo. AppDomain app =…
apparat
  • 1,930
  • 2
  • 21
  • 34
7
votes
2 answers

How to invoke a method (reflection) with a not generic parameter?

I have a little problem. I am developing an Android applikation. There you can dynamicly load classes from other applications (packages). First of all, i do not want to "hack" an third-party app, i want to try to build up plugins for my own app. So…
prdatur
  • 1,010
  • 1
  • 14
  • 20
7
votes
5 answers

how to use Invoke method in a file of extensions/methods?

Well, I'm writing a file of extensions/method useful to strings,label,linklabels,class etc. but, I have a problem. I have an showMessage() method that change the Text of label, works fine. But I decide to do that works with thread execution, then I…
The Mask
  • 17,007
  • 37
  • 111
  • 185
7
votes
2 answers

Curious about the implementation of Control.Invoke()

What exactly does Control.Invoke(Delegate) do to get the delegate to run on the GUI thread? Furthermore, Its my understanding that invoke will block until the invoked function its done. How does it achieve this? I would like some good gritty…
Kratz
  • 4,280
  • 3
  • 32
  • 55
7
votes
1 answer

difference between invoke and init kotlin

I'm studying about operator overloading in kotlin and I ran into invoke method. When I did my research about it I found out it works much similar to init constructor of every class. I cannot get my head around the difference and they seem to be…
Paya Kamyar
  • 105
  • 7
7
votes
1 answer

javascript setTimeout call error

I want to invoke the window.setTimeot function with my custom scope so I use the call method, but there is something wrong. function foo() { this.bar = function() { console.log("keep going"); …
Gergely Fehérvári
  • 7,811
  • 6
  • 47
  • 74