Click here to Skip to main content
15,916,189 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Page subtotal in MS Access 2003 Report Pin
Dave Kreskowiak12-Jan-05 3:59
mveDave Kreskowiak12-Jan-05 3:59 
GeneralUpdateLayeredWindow - My great pain :) Pin
Axonn Echysttas11-Jan-05 21:46
Axonn Echysttas11-Jan-05 21:46 
GeneralRe: UpdateLayeredWindow - My great pain :) Pin
Dave Kreskowiak12-Jan-05 4:56
mveDave Kreskowiak12-Jan-05 4:56 
GeneralRe: UpdateLayeredWindow - My great pain :) Pin
Axonn Echysttas12-Jan-05 21:39
Axonn Echysttas12-Jan-05 21:39 
GeneralRe: UpdateLayeredWindow - My great pain :) Pin
Dave Kreskowiak13-Jan-05 2:10
mveDave Kreskowiak13-Jan-05 2:10 
GeneralRe: UpdateLayeredWindow - My great pain :) Pin
Axonn Echysttas13-Jan-05 9:33
Axonn Echysttas13-Jan-05 9:33 
Generalbuttons location while Drag and Drop Pin
Greeky11-Jan-05 21:24
Greeky11-Jan-05 21:24 
GeneralVB and C++ dll Pin
Tomaz Rotovnik11-Jan-05 20:23
Tomaz Rotovnik11-Jan-05 20:23 
Hi
I created very simple dll (vc++) which has three functions (start, stop and
initialization). it starts capturing sound from soundblaster and when the
buffer is filled with the data, dll calls VB calback function (passed with
initialization) and passes the buffer size (integer type). First I have
some problems with __stdcall declaration in VC dll, but I think I solved that
problem. Callback function runs in separated thread under main dll thread.

Declaration of initialization of callback function looks like this:

__declspec(dllexport) int __stdcall RecToR_Init_Cap(void (__stdcall *tmp)(int_4 size));


IN VB:
Public Delegate Sub Callback(ByVal size As Int32)

Public Declare Function RecToR_Init_Cap Lib "RecToR_Cap_TR.dll" (ByVal CalBckFunc As Callback) As Int32

"Private Sub Button1_Click" event in VB:

Dim cb As Callback
cb = AddressOf CallBackFunc
Success = RecToR_Init_Cap(cb)


Public Sub CallBackFunc(ByVal size As Int32)
TextBox1.Text = size & vbCrLf
End Sub


When I run the application, the callback function is called 50 times and
then the application crashes:

"An unhandled exception of type 'System.Runtime.InteropServices.SEHException' occurred in Unknown Module. Additional information: External component has thrown an exception.
An exception 'System.NullReferenceException' has occured in..."

I think I override stack pointer. How can I trace down the problem?

From Microsoft articles I get information that I cannot call callbacks from
spawned threads within my DLL.

Is it possible to overcome this problem?

Thanks for any idea


Tomaz Rotovnik
GeneralRe: VB and C++ dll Pin
[DK]KiloDunse11-Jan-05 23:50
[DK]KiloDunse11-Jan-05 23:50 
GeneralRe: VB and C++ dll Pin
Tomaz Rotovnik12-Jan-05 4:30
Tomaz Rotovnik12-Jan-05 4:30 
GeneralRe: VB and C++ dll Pin
[DK]KiloDunse12-Jan-05 4:49
[DK]KiloDunse12-Jan-05 4:49 
GeneralRe: VB and C++ dll Pin
Tomaz Rotovnik12-Jan-05 5:47
Tomaz Rotovnik12-Jan-05 5:47 
GeneralPhone Answer Pin
nitin_ion11-Jan-05 20:13
nitin_ion11-Jan-05 20:13 
GeneralConversion of float to hexadecimal value Pin
phijophlip11-Jan-05 19:56
phijophlip11-Jan-05 19:56 
GeneralRe: Conversion of float to hexadecimal value Pin
Dave Kreskowiak12-Jan-05 3:54
mveDave Kreskowiak12-Jan-05 3:54 
Generaldata connection to ms excel Pin
abdulla hamid11-Jan-05 18:16
abdulla hamid11-Jan-05 18:16 
GeneralRe: data connection to ms excel Pin
Ritesh123411-Jan-05 21:15
Ritesh123411-Jan-05 21:15 
GeneralRe: data connection to ms excel Pin
Britnt712-Jan-05 9:14
Britnt712-Jan-05 9:14 
GeneralRe: ReadFile not working in VB.NET Pin
Dave Kreskowiak11-Jan-05 15:49
mveDave Kreskowiak11-Jan-05 15:49 
GeneralRe: ReadFile not working in VB.NET Pin
Roman Nurik11-Jan-05 18:17
Roman Nurik11-Jan-05 18:17 
GeneralRe: ReadFile not working in VB.NET Pin
Dave Kreskowiak12-Jan-05 1:06
mveDave Kreskowiak12-Jan-05 1:06 
Generalproblem with visual studio .net and the oledb namespace Pin
Anonymous11-Jan-05 14:57
Anonymous11-Jan-05 14:57 
GeneralRe: problem with visual studio .net and the oledb namespace Pin
Dave Kreskowiak12-Jan-05 1:01
mveDave Kreskowiak12-Jan-05 1:01 
GeneralRe: problem with visual studio .net and the oledb namespace Pin
Anonymous12-Jan-05 4:21
Anonymous12-Jan-05 4:21 
GeneralRe: problem with visual studio .net and the oledb namespace Pin
Dave Kreskowiak12-Jan-05 11:58
mveDave Kreskowiak12-Jan-05 11:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.