473,702 Members | 2,819 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ActiveX.exe and RaiseEvent

A VB6 ActiveX.exe raises an event which is seen by the VB6 App.

Same setup in VB2005. The event to be raised is in form frmSweep. As in VB6,
frmSweep is hidden when the events take place.

I know by actions on the screen and sounds in the speakers that VB2005 is
using the ActiveX.exe correctly.

However the events are never raised !!!

There are no Errors or Warnings shown after rebuilding the VB2005 App

Anyone have a clue as to why no events are raised?

Galen
Jun 29 '06 #1
23 3471
Galen Somerville wrote:
I know by actions on the screen and sounds in the speakers that VB2005 is
using the ActiveX.exe correctly.

However the events are never raised !!!


Can you show the code where you add handlers to the events?

Jun 29 '06 #2

"Chris Dunaway" <du******@gmail .com> wrote in message
news:11******** **************@ y41g2000cwy.goo glegroups.com.. .
Galen Somerville wrote:
I know by actions on the screen and sounds in the speakers that VB2005 is
using the ActiveX.exe correctly.

However the events are never raised !!!


Can you show the code where you add handlers to the events?


Aha, what does a typical event handler look like?

Galen
Jun 29 '06 #3

Galen Somerville wrote:
"Chris Dunaway" <du******@gmail .com> wrote in message
news:11******** **************@ y41g2000cwy.goo glegroups.com.. .
Galen Somerville wrote:
I know by actions on the screen and sounds in the speakers that VB2005 is
using the ActiveX.exe correctly.

However the events are never raised !!!


Can you show the code where you add handlers to the events?


Aha, what does a typical event handler look like?

Galen


It would be a method that has a Handles clause at the end such as:

Public Sub EventHandler(<a ppropriate signature here>) Handles
ActiveXControl. EventName
End Sub

Jun 29 '06 #4

"Chris Dunaway" <du******@gmail .com> wrote in message
news:11******** **************@ i40g2000cwc.goo glegroups.com.. .

Galen Somerville wrote:
"Chris Dunaway" <du******@gmail .com> wrote in message
news:11******** **************@ y41g2000cwy.goo glegroups.com.. .
> Galen Somerville wrote:
>> I know by actions on the screen and sounds in the speakers that VB2005
>> is
>> using the ActiveX.exe correctly.
>>
>> However the events are never raised !!!
>
> Can you show the code where you add handlers to the events?
>


Aha, what does a typical event handler look like?

Galen


It would be a method that has a Handles clause at the end such as:

Public Sub EventHandler(<a ppropriate signature here>) Handles
ActiveXControl. EventName
End Sub


I now receive the events, thank you, but apparently they are coming in
faster than they can be handled. So I have some debugging to do.

It's funny to me as the original conversion, VB6 to VB2005, was so slow it
couldn't keep up with the USB device. So thanks to Olaf Schmidt I made a VB6
AvtiveX.exe where a separate thread handles getting the USB data. Now the
data comes in at the correct rate.

Hopefully it's in some little bit of code and not in the Graphics display
routines.

Galen
Jun 29 '06 #5
Hi Galen,

Thank you for your post.

I see that your problem of the "receiving event from VB6 ActiveX exe" is
now resolved. Please feel free to post here if you have other questions.
Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Jun 30 '06 #6
My App recieves real time HeartBeat data and draws the traces on the screen
much like an oscilloscope. Typically this is at 75 Heart beats per minute
which equates to 24 byte data packets coming in every 14.12 milliseconds.

VB6 can operate at a minimum of 200 Heart beats per minute which is a packet
every 5.29 ms.

Vb2005 fails if I use over 10 Heart beats per minute which is a packet every
88.24 ms !!!

Below is some of the pertinent details. Suggestions welcomed !!!!!!!!!
A VB6 ActiveX.exe contains the Cmain and Cthread classes

In Cmain which is same thread as Main App

Public Event BurstData(DatAr y() As Byte)

Part of shared array used in Cmain and Cthread
ReDim DatAry(23)

A new thread is started as Cthread and 170 packets of 24 bytes are
collected.
Each collected packet sends a message to Cmain to raise the BurstData event.

In VB6 this is the event which is raised:
Private Sub GD_BurstData(Da tAry() As Byte)
If modMain.USBflag Then
ModPgm.ErrFlg = True
Else
ModUSB.bytAry = DatAry
End If
ModUSB.dtStatus = 0
modMain.USBflag = True
End Sub

In VB2005 this is the event which is raised:
Private Sub GD_BurstData(By Ref DatAry As System.Array) Handles
GD.BurstData
If modMain.USBflag Then
ModPgm.ErrFlg = True
Else
ModUSB.bytAry = DatAry
End If
ModUSB.dtStatus = 0
modMain.USBflag = True
End Sub

Both Apps are in a loop with DoEvents looking for USBflag = True.
They then draw 6 horiz pixels worth of two channel traces.

Galen

"Walter Wang [MSFT]" <wa****@online. microsoft.com> wrote in message
news:Vo******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hi Galen,

Thank you for your post.

I see that your problem of the "receiving event from VB6 ActiveX exe" is
now resolved. Please feel free to post here if you have other questions.
Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Jul 1 '06 #7
Hi Galen,

Thank you for your update.

After I read your post on May 5 regarding "VB2005 timing/speed problem", I
think we're having the same problem here. Although you can now receive the
events promptly in ActiveX EXE from ActiveX DLL, you still have to raise
the events to VB2005, which will also hit the barrier of marshaling
performance.

Let's take a step back to the beginning of this problem. After reviewing
your previous post, I'm not clear on some points, would you please help me
on following points?
1) Do you have the source code of the ActiveX DLL which is used to read
from the USB device?
2) Does that ActiveX DLL use event to notify the client or client has to
periodically call it?

I'm looking forward to your update on this. Thanks.
Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 3 '06 #8

"Walter Wang [MSFT]" <wa****@online. microsoft.comwr ote in message
news:sy******** ********@TK2MSF TNGXA01.phx.gbl ...
Hi Galen,

Thank you for your update.

After I read your post on May 5 regarding "VB2005 timing/speed problem", I
think we're having the same problem here. Although you can now receive the
events promptly in ActiveX EXE from ActiveX DLL, you still have to raise
the events to VB2005, which will also hit the barrier of marshaling
performance.

Let's take a step back to the beginning of this problem. After reviewing
your previous post, I'm not clear on some points, would you please help me
on following points?
1) Do you have the source code of the ActiveX DLL which is used to read
from the USB device?
2) Does that ActiveX DLL use event to notify the client or client has to
periodically call it?

I'm looking forward to your update on this. Thanks.
Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.
Go to my web site and get USBdrvr.zip
http://home.surewest.net/galen/download.html

Note the CallBackTrigger form
CThread.cls has a PostMessage
Cmain.cls has the CallBackForm_Ch eckRingBufferQu eue

So events are raised automatically and the main App just recieves them.

Isn't there something like DirectCast that short circuits the marshaling?

Galen
Jul 3 '06 #9
Hi Galen,

Thank you for the source code.

I've gone through the code and also done some research on the COM Interop
performance.

Based on my research, the bottleneck should be the BurstData event raised
from VB6. I've created some test projects to benchmark the difference
between VB6 and VB2005 handling the event. Handling the event in VB2005 is
much slower than in VB6. This is difficult to overcome due to the nature of
marshaling between COM and .NET.

After I reviewed the source code of the ActiveX DLL project, I think it's
possible to implement it in VB2005 using P/Invoke to call the USB device
APIs. Also, thread is supported in VB2005 natively.

Although P/Invoke still has some overhead, it's much faster than COM
Interop. Please see following documentation for more information on
Managed/Unmanaged Code Interoperabilit y:

#An Overview of Managed/Unmanaged Code Interoperabilit y
http://msdn.microsoft.com/library/de...us/dndotnet/ht
ml/manunmancode.as p
This article provides basic facts about interoperabilit y between managed
and unmanaged code, and guidelines and common practices for accessing and
wrapping unmanaged API from managed code and for exposing managed APIs to
unmanaged callers. Security and reliability considerations, performance
data, and general practices for development processes are also highlighted.

With every transition from managed code to unmanaged code (and vice versa),
there is some performance overhead. The amount of overhead depends on the
types of parameters used. The CLR interop layer uses three levels of
interop call optimization based on transition type and parameter types:
just-in-time (JIT) inlining, compiled assembly stubs, and interpreted
marshaling stubs (in order of fastest to slowest type of call).

Approximate overhead for a platform invoke call: 10 machine instructions
(on an x86 processor).

Approximate overhead for a COM interop call: 50 machine instructions (on an
x86 processor).
Here are some more resources on P/Invoke:

#Platform Invoke Tutorial
http://msdn.microsoft.com/library/de...us/csref/html/
vcwlkplatformin voketutorial.as p

#.NET: P/Invoke Revisited -- MSDN Magazine, October 2004
http://msdn.microsoft.com/msdnmag/issues/04/10/NET/
Talks about: Marshaling Structures, Object Lifetime and Pinning, Marshaling
Value Types vs. Reference Types, StructLayoutAtt ribute, Non-Blittable
Marshaling.

#GotDotNet User Sample: Platform Invoke Samples
http://www.gotdotnet.com/community/u...mpleguid=f6f4c
339-22fd-44bb-a4fc-cfd874527ffb
The platform invoke samples demonstrate how to call functions exported from
an unmanaged library: how to declare different types, how to use available
attributes to modify default behavior, how to use methods of the Marshal
class when needed, and which aspects of garbage collection and threading
could affect results.

#GotDotNet User Sample: Interop Declarations for Windows.h
http://www.gotdotnet.com/community/u...mpleguid=f1dd7
0e4-c212-4a6f-bff7-c82e34c8836f
When a Win32 API is not exposed by the .NET framework you must manually
write an interop wrapper to access that API. Writing these wrappers is
difficult and error prone. This post includes C# definitions of many common
Win32APIs and their related data structures

#pinvoke.net: the interop wiki!
http://www.pinvoke.net
PINVOKE.NET attempts to address the difficulty of calling Win32 or other
unmanaged APIs in managed code (languages such as C# and VB.NET). This site
is a repository where you can find, edit, and add PInvoke signatures,
user-defined types. Think of this as the 21st century version of VB6's "API
Text Viewer".

Hope this helps. Please feel free to post here if anything is unclear.
Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 4 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5030
by: jva02 | last post by:
Hi, I'm confused why I can capture an event fired by an ActiveX object when it's loaded via an <object> tag, but not when loaded using "new ActiveXObject". Here's a basic example: vb ActiveX object: Private Declare Sub Sleep Lib "kernel32" (ByVal dwmilliseconds As Long)
1
1635
by: Guille | last post by:
Hi all! I'm having some weird behaviour in a .NET application i'm developing. I'll try to explain: I've created a Class that wraps an asynchronous socket. When connect callback is called, i raise a class event : ' Create socket sock = New Socket(AddressFamily.InterNetwork, _
8
10102
by: Nicolas | last post by:
How do I do a RaiseEvent in csharp I'm ok in VB but csharp confused me a lot. ******* code ******** private FileSystemWatcher watcher = new FileSystemWatcher(); public delegate void Changed(WatcherChangeTypes exch); public delegate void Created(string fileName); public delegate void ReCreated(string OldName, string newName); public delegate void OverRun(string Message);
2
5353
by: Bill | last post by:
I have a VB6 ActiveX EXE app that generates events that I would like to handle in a C# application. The events in the VB app are defined like: Public Event SometingHappened(what As String) and raised like so: Public Sub EventNotification(ByVal what As String) RaiseEvent SometingHappened(what)
2
1434
by: Lim | last post by:
I've developed a program that raise an event. This program works fine on a Windows 2000 Professional PC. However when I try to run the program on a Windos XP Professional PC, the program will not execute the raiseevent function. How can I resolve the problem?
2
2003
by: dmoonme | last post by:
I'm trying to rename some files in a directory. Pretty basic stuff - renaming the files works fine but the problem I have is updated the text in textbox. All I want to do is appendtext to a textbox. The problem is that duplicate text occurs. Hopefully my code will explain better what I'm trying to do and what i'm doing wrong :) Thanks for your help! Public Class Form1 Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e...
7
6535
by: Onokiyo | last post by:
Hello, I have the code below and somehow the message from RaiseEvent doesn't pop up at all. Can someone help me please? '------CODE '------/form1.vb/VB2005/Framework20--------- Imports System
1
2047
by: Terry Olsen | last post by:
I have a program with a couple of long running processes that i'm calling on a separate thread. When the process is completed, I want to raise an event to tell the main thread that it's done. I set it up this way... Public Class frmLongRunningProcess Public Enum Proc ParseZipFiles = 0
0
1860
by: drtwkim | last post by:
Hi.. I can't speak english very well. I have writting code a program with VB & Python - COM Server : Visual basic (ActiveX EXE) - COM Client : Python I expect to attempt that is retrieved a return value. but, don't returned a event value ( in python)
0
8739
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8652
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9089
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8983
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6575
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4412
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2402
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.