Why MciSendString Callback Isn't Working
Nov 16, 2011
why my mciSendString callback isn't working?the app is a console app, with a nativeWindow msgHandler class.
here's the code:
Imports System.Windows.Forms
Public Class msgHandler
Inherits NativeWindow
[code].....
View 2 Replies
ADVERTISEMENT
Feb 4, 2011
Public Class recordingtTry Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstyCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As Integer
[Code]...
View 1 Replies
Jan 7, 2012
Below is the code I use to play a video. Video is played on a panel but when Start a video it only shows a part of the video how can I fit the video inside the panel? Also how can I get the default size(height and width) of the video so that I can maintain aspect ratio. [code]
View 1 Replies
Nov 17, 2011
how can i use mciSendString to record all sound card output?i got it to the stage where i can create a wav file but it records just white noise.
i need it to record the wav files i'm playing through my sound card.
View 2 Replies
Jul 19, 2009
I have a created a small application that records and plays audio. However, my application needs to save the wave file to the application data directory on the users computer.The mciSendString takes a C style string as a parameter and has to be in 8.3 format. However, my problem is I can't get it to save. And what is strange is sometime it does and sometimes it doesn't. However, most of the time it failes. However, if I save directly to the C drive it works first time everything. I have used 3 different methods that I have coded below. The error number that I get when it fails is 286."The file was not saved. Make sure your system has sufficient disk space or has an intact network connection".[code]
View 1 Replies
Jun 20, 2011
I have a question about of capture sound function, someone have a code example for visual basic 2010 in windows 7?, I tried using mcisendstring function but the sound quality, is poor.
View 5 Replies
Jun 19, 2012
I'm trying to use a .DLL which Callbacks a Function of my project, but I can't get it to work.
Declaration from .h file of .DLL
void DLL_EXPORT SetEntity_CallBack(bool Active, _
void (*Entity_Callback)(int Site, int Application, int ID, _
[Code].....
View 11 Replies
Aug 17, 2009
I have this code obtaining data from a sensor that is sending a string that contains 4 numbers separated by a tab and terminated by an end of line/ I am trying to use an asynchronous callback to get the data over TCP. That problem is that the callback function is not grabbing the complete string. Sometimes it will, other times it gets half in one retrieve and half in another. I need the callback to hold off until it gets a newline character.
Code:
Public Sub readVaisala()
Dim ip As String = "192.168.1.30"
Dim portNumber As Integer = 23
Dim time As Int32 = Now.Second * 1000 + Now.Millisecond
[code].....
View 2 Replies
Mar 3, 2011
I have a C++ dll that contains a callback. The callback has one parameter that is passed in and one parameter that is passed out. The parameter that is passed from C++ is a variant. So, we are going from a variant in C++ to an object in VB.NET. The function works. However, It seems that there is a memory leak on the VB.Net side. This must be a Marshaling issue. I have tried to use the MarshalAs Functions, but to no avail.
VB.NET
Declare
Function EnableWriteNotification
Lib
[code]....
View 2 Replies
Jan 4, 2011
there is error when i use callback function A callback was made on a garbage collected delegate of type 'skynet1!skynet1.Form1+myCallBack::Invoke'. This may cause application crashes, corruption and data loss. When passing delegates to unmanaged code, they must be kept alive by the managed application until it is guaranteed that they will never be called.
View 6 Replies
Aug 8, 2011
I am working on a Twitter application and with the authentication process, Twitter returns Two Tokens with a Callback URL, For example: [URL]. How do I extract each token and put them into separate strings?
View 5 Replies
May 12, 2011
I am writing classes in VB.Net (both managed). The main class "A" creates an instance of "B". Class "B" must call a method of Class "A". I need to know two things (syntax, etc...):
1. How does class "A" tell class "B" what method to call?
2. How does class "B" call the method?
The method must pass back an array of Shorts (in this particular example), either as a return value, or as a ByRef argument.I don't want to use an event if I don't have to. The execution is timing critical. (I assume event handling involves a lot of overhead by the operating system, but I may be wrong.)
View 1 Replies
Feb 2, 2011
I do not know Why I am recieving a TimeOutException in my code:
Dim Uri2 As New Uri("http://localhost:8733/Design_Time_Addresses/ssWcfService/Service1/")
Dim binding2 As New WSDualHttpBinding()
Dim callback = New MyCallBackClient()
[Code].....
View 1 Replies
Feb 21, 2012
I am a relative newcomer to Windows programming and VB.net. What we are trying to do is call a function in an existing, 3rd party COM dll. This function requires a callback parameter, whose type is an interface also defined in the dll.In our VB.net application, we have added the dll as a COM reference, and created a class that implements the interface in the DLL. We then send an object of that type as the callback parameter. This compiles fine. However, when we run the application, we receive an error stating that the program is unable to cast the object from our existing type to the interface type.
I suspect that there is a simple fix, but so far, my efforts to find a solution have come up short. If anyone could point me in the right direction,
View 1 Replies
Jun 12, 2009
I have a bunch of operations that need to be executed simultaneously. For this I'm using the thread pool to execute the tasks. I'd like to know if it's possible to consume some sort of Async Callback (similar to BackgroundWorker.DoWorkComplete) when each thread is finished. The reasoning behind this is that I have a windows service running that uses IPC to update a GUI and I need to know the time at which each specific thread finishes I've used background workers to do a set of tasks and they work perfectly, however, they take longer than I would like. I've timed the execution on my BGW method for a designated number of said tasks and it took 27 seconds, and the same set of tasks takes 4 seconds using the threadpool method. I've also tried using managed threads, to the same effect as the background workers.
View 5 Replies
Feb 1, 2010
I have a class with a mthod which does a a time consuming task. I know how to start the method in a separate thread using the Threading.Thread class. What I want to do is use callback so as to have the method report its result to another method when completed. I chose to use the asynchronous Begin/End call pattern.
Private Function BeginConnect(ByVal URl As String, ByVal callback As AsyncCallback, ByVal state As Object) As IAsyncResult
'Some Code
End Function
[code]....
View 13 Replies
Mar 23, 2011
Situation: i've created several forms with a datagrid:formwithdatagrid1formwithdatagrid2formwithdatagrid3.... These datagrid can be filled manually or with a selection list. I've written this selection list a a new form (frmSelectionList), witch is called with a SQL instruction, now this selectionlist calls a funtion in formwithdatagrid1 to return the selected value. Question:How can the same selectionform being used for all datagridforms?
[Code]...
View 4 Replies
Oct 20, 2010
I'm trying to convert C++ API to VB.Net, but this function is too hard and i don't know how make it work.
Here is the API doc for this function:
void RemoteDllSetReceiver(void *inst, on_received_buffer_t received_buf_cb);
Sets a callback function to receive notifications from the DLL. The prototype of the callback is:
typedef bool (*on_received_buffer_t)(void* inst, const unsigned char *buffer, unsigned int size);
Where inst is the pointer originally passed to RemoteDllSetReceiver buffer & size contain the notification text as defined in the Remote Protocol. Note: notifications may arrive in different threads (e.g. network, timer, audio).
I can't imagine what i mus do with on_received_buffer_t, must it be a delegate? Like you can read, this functions returns notifications from the DLL like connection status, user id...
View 1 Replies
Dec 14, 2009
I've used the async classes in the .NET framework several times but I've never tried to do something like that myself - I mean I've used background threads and made them invoke other methods on the UI thread loads of times but they have always been hard coded method names, not something where you can specify what method is invoked when the background thread is finished.
I'm writing the data access layer for my current project and I want to have all of the methods be asynchronous, so these methods in the DAL need to be able to 'call back' any method that is specified, rather than a specific method in the same project as I would normally do. This is how I have done it, and it seems to work, but I'm not sure that this is the best way or even close... Here is the signature of public method in my DAL that my programs call:
[Code]...
View 4 Replies
Jan 19, 2009
I have been reading the async design patterns on MSDN and the general idea makes sense to me but in practice it is proving to be more difficult. I am working on a project utilizing VMWARE VIX.
HTML Code: [url]. Each function such as connecting to a host server, retrieving properties, etc. can be executed in two different ways.
Connecting to a host using a blocking Wait:
Code:
Dim m_lib As New VixLib
Dim m_hostJob As VixCOM.IJob
[CODE]...
Code:
Dim m_lib As New VixLib
Dim m_hostJob As VixCOM.IJob
dim m_callback as VixCOM.ICallback
[CODE]...
The problem with the VIX SDK is that sometimes the functions never return, hanging the application. dblock.
HTML Code:[URL] came up with a library that specifies a timeout value. When the timeout runs out the method aborts and returns regardless whether it finished or not.
The callback method is an active wait where the code continues to execute. What I want to implement is a blocking wait with a timeout. The ICallback interface has one sub OnVixEvent(IJob,Integer,IVixHandle). This method is fired at least twice, first when some progress is posted and second when it is complete. The first call to this method can be one second after registering the callback or 30 seconds, so I can not rely on this method to block the main thread. how to create some kind of async result class that would block the main thread from executing until either a timer runs out or the OnVixEvent method returns an Operation Complete signal that also implements ICallback.
View 10 Replies
Mar 1, 2011
I am creating a class ("Class B") which is used by another class ("Class A") which instantiates it in VB.NET 3.5.I would like Class B to read a value assigned to one of its properties by Class A every time an event happens in Class B.However, I would like this property value to be dynamically assigned to the property by Class A when the event is fired in Class B.I was thinking about somehow creating a delegate function in Class A that is linked to the property in Class B so that when the event is fired in Class B it would eventually invoke the delegate in Class A so that it returns a value to Class B.I've been reading around delegates (that's how I arrived at the idea), but I am stuck on how to code this up - could someone please help with some skeleton code?
View 1 Replies
Feb 1, 2010
I have a class with a mthod which does a a time consuming task. I know how to start the method in a separate thread using the Threading.Thread class. What I want to do is use callback so as to have the method report its result to another method when completed. I chose to use the asynchronous Begin/End call pattern.
My thoughts are:
Private Function BeginConnect(ByVal URl As String, ByVal callback As AsyncCallback, ByVal state As Object) As IAsyncResult
'Some Code
[Code].....
View 4 Replies
Nov 2, 2010
I am using a function from a dll in unmanaged code that requires a callback to my managed code in Visual Basic 2010. The callback is asynchronous and is called continuously over the life of the application. What's the best way to protect the callback function from the garbage collector? Right now it is being collected after several dozen calls from the dll.
View 11 Replies
Feb 12, 2011
I have been trying to figure this our for far too long and I cannot get my head around it. Every example I have seen seems to be far more complex that I need. I have a web service in my project (.asmx). I want to call it very simply from a button on a webpage.
Click
Run service asynchronously
return control back to webpage (web
service running in background)
View 1 Replies
Oct 1, 2011
I'm trying to pass a callback function from a C++ dll to a VB.NET application.Here is my current C++ code :
void DLL_EXPORT registerEvent( void (*callBackFunction)(string str),string str)
{
callBackFunction(str);
}
void test(string str)
[Code]...
View 1 Replies
Nov 29, 2009
I create a UserControl (TableWithFilter.xaml) with a dependency property (source). The UserControl is a Table with a source property for the different items. I created the XAML and set the source property via the XAML Binding. So far so good.
But if the value of the dependency property is changed, the defined callback method is not called. Therefore I cannot update the entries in my table. Has anyone an idea why the callback method is not called?
Here is the definition of my property in the class "TableWithFilter":
Public Shared ReadOnly SourceProperty As DependencyProperty = _
DependencyProperty.Register("Source", GetType(List(Of TableViewItem)), GetType(TableWithFilter), _
[Code]....
If the attribute "ContentList" is changed I expet that the "ChangeSource" method in the TableWithFilder class is called. But this is not the case. After I changed the ContentList attribute, I Raise the following Event:
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs("ContentList"))
View 1 Replies
Apr 23, 2010
In a windows form application I have:
Private Sub ReadData(ByVal CodeId as String)'...reads SQL Table End Sub
Private Sub FileSystemWatcher_Created(ByVal Sender as Object, ByVal e as System.IO.FileSystemEventArgs)
'do some stuff 'Need CallBack to ReadData
View 2 Replies
Jun 6, 2012
I am using vb.net 3.5 and application is interacting with VC++ dll.
code is:
Public Delegate Sub delProcess() //Globaly declare
im del As New delProcess(AddressOf Process) //Process is function which not returning
[code].....
View 1 Replies
Nov 15, 2009
I have a method that is asynchronously called when System.Net.Sockets.NetworkStream.BeginRead completes.
skDelegate = New AsyncCallback(AddressOf skDataReceived)
skStream.BeginRead(skBuffer, 0, 100000, skDelegate, New Object)
In that callback method, I need to interact with the UI thread.
Sub skDataReceived(ByVal result As IAsyncResult)
CType(My.Application.OpenForms.Item("frmMain"), frmMain).refreshStats(d1, d2)
End Sub
This causes an exception after the method completes. (when End Sub is executed)
[Code]...
View 4 Replies
Apr 8, 2010
I am exposing some ISO C++ data types to .Net (mono on Linux to be precise).For the purpose of brevity, I shall refer to C# in my question, although my question relates to all of the .Net languages (with C# and VB.Net being my target languages). So far, I have worked out how to expose the ISO C++ data types in C# class(es) for use in mono -The only problem so far is how to deal with the C++ callbacks. In .Net languages (C# and Vb.Net), I believe 'delegates' are the callback equivalent.
Sticking with C# for now, can anyone recommend a way that I can register the C# delegate functions with my ISO C++ code.The ISO C++ code is a notification library, and I want to be able to "push" the notifications to the mono framework (i.e. C# delegates in this case).My underlying assumption is that the mechanism/steps to implement this would be the same for the .Net languages - I'll just have to code the actual delegates in the .Net language of choice - is that assumption correct?Last but not the least, is the question of thread saftey. The underlying ISO C++ code that I am exposing to .Net (mono to be more specific), is both re-ntrant and thread safe - do I have to do anything "extra" to call .Net delegate from my ISO C++ code?
View 1 Replies