473,804 Members | 3,549 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can i capture form level events in app. level in VB 6.0 in desktop application?

9 New Member
I'm new to VB 6.0 as I'm a C# developer originally. I'm working on an application with hundreds of forms spread across multiple projects. Can any VB expert please guide me if there is a way of capturing form-level events at the application level at a common place so that my efforts are reduced? Otherwise, I'll have to make changes at the form level which will be quite cumbersome due to large no. of forms. I need to catch events to keep track of the time for which each form was in active state.
Sep 25 '07 #1
4 1649
Killer42
8,435 Recognized Expert Expert
There may be much better ways, but one fairly simple approach would be to copy some standard code into each form which invokes your "applicatio n-level" procedure, perhaps passing the form itself (or just its name) as a parameter.
Sep 26 '07 #2
divy24
9 New Member
There may be much better ways, but one fairly simple approach would be to copy some standard code into each form which invokes your "applicatio n-level" procedure, perhaps passing the form itself (or just its name) as a parameter.
So, you mean to say i can pass form name and access the form events at the application level using that passed form name.Are you sure i can capture those events there ?. I'm new to VB.So,a simple code sample regd. how to capture form events from the passed form name would be highly appreciated .I'm working on VB 6.0.Or else,Plz let me know the Property name to use to get the Form object and then events out of it.
Sep 26 '07 #3
Killer42
8,435 Recognized Expert Expert
So, you mean to say i can pass form name and access the form events at the application level using that passed form name.Are you sure i can capture those events there ?
What I meant was you capture the events the same way as usual, by coding an event procedure in each form. But in each one, you just call a standard routine to do whatever it is you want to do at that point.

For example, in every form you could code
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Click()
  2.   Do_Your_Application_Wide_Click_Event Me
  3. End Sub
This would trigger when that form is clicked, but all it would do is invoke the one standard routine, the same as all the other forms. If you pass the form as a parameter (as I've done here) then the standard routine can do whatever it wants with the form.

Don't forget, if you create Public variables within a form, you can treat it like a property of the form. That could be very useful for things such as tracking how long the form is loaded for. As an example of something like this, try creating Public TimeLoaded As Double in a form. In the Form_Load event (perhaps through a standard routine as described above) you could set the TimeLoaded variable to the current system time. In the Form_Unload event (again, could be in a standard routine that each form invokes) you can determine how long that form was loaded by subtracting <FormName>.TimeLoaded from the current time.

I hope this gets across the idea. As I said, there may be better ways to go about it. This is just what came to mind.
Sep 26 '07 #4
divy24
9 New Member
What I meant was you capture the events the same way as usual, by coding an event procedure in each form. But in each one, you just call a standard routine to do whatever it is you want to do at that point.

For example, in every form you could code
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Click()
  2.   Do_Your_Application_Wide_Click_Event Me
  3. End Sub
This would trigger when that form is clicked, but all it would do is invoke the one standard routine, the same as all the other forms. If you pass the form as a parameter (as I've done here) then the standard routine can do whatever it wants with the form.

Don't forget, if you create Public variables within a form, you can treat it like a property of the form. That could be very useful for things such as tracking how long the form is loaded for. As an example of something like this, try creating Public TimeLoaded As Double in a form. In the Form_Load event (perhaps through a standard routine as described above) you could set the TimeLoaded variable to the current system time. In the Form_Unload event (again, could be in a standard routine that each form invokes) you can determine how long that form was loaded by subtracting <FormName>.TimeLoaded from the current time.

I hope this gets across the idea. As I said, there may be better ways to go about it. This is just what came to mind.
Gotcha!. I 'm moving ahead in a similar fashion except that i don't need to track for time by myself.We have an API doing that already.I was interested in a way of catching events at a global level in the application identified with the Form.Seems like it is not possible with VB 6.0.Let me know if you get something on this in future.Its interesting.Tha nks for all your effort.
Sep 26 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

9
3408
by: esafran | last post by:
Hi, I've have encountered a very strange behaviour under C#. My application is registering for: Microsoft.Win32.SystemEvents.DisplaySettingsChanged & Microsoft.Win32.SystemEvents.UserPreferenceChanged When I run my application as a Console Application (not as a service), my application receives the events when I change the screen resolution or change from Dual View to Horizontal Span or to Single View.
1
13259
by: Uchiha Jax | last post by:
Standard Framework documentation goes into great detail " A top-level form is a window that has no parent form, or whose parent form is the desktop window. Top-level windows are typically used as the main form in an application." So why is it that standard windows events fail to work in textboxes with ..TopLevel = false forms? ////(inside the load event of a form)
5
2384
by: TerryWilson | last post by:
I am developing a web based service tool using asp.net that we will distribute with our product. This service tool will be used for remotely configuring the product, problem determination, etc. One thing that I would like to be able to do is display a screen capture of our product running. I have the code to get the screen capture of the desktop and I also know how to send the image back to the client to be displayed. The problem is that...
7
62049
by: Bob Achgill | last post by:
When I use the code for KeyPress to capture pressing a certain key for processing on a form with no Text Box it works. But when I try the same code on my application that has text boxes it does does not work. How can I capture the cursor left and right keys for processing?
3
3659
by: Marcob | last post by:
Is there any component out there to capture screen text from a specific region on any active external application form. Thanks Marco
3
3051
by: Dave | last post by:
Hi, I have a control on my vb app form that dont cath a mouse event`s how can i catch a mouse event on that control and pass it to a function in my main form??? In VB-6 i used the setcapture api function! Thanks
3
1893
by: JeffDotNet | last post by:
I wrote a small data processing application that writes a summary of several hundred files. I use drag and drop on a panel (Panel1) to grab the absolute path to each of these files. Then I begin analyzing all of the files. I noticed (on the same machine) that some user profiles appear to abbreviate the absolute paths to these files thus breaking my data loading mechanism. Does anyone know how I can programmatically change this filepath...
1
4511
by: JP2006 | last post by:
I'm trying to write a control that will take a screen capture of a particular website when a user submits a form in a web application; one of the form fields is for a URL - the control needs to get an image of that web site so that it can be displayed later as a thumbnail image. I have code for taking a normal screen capture using GDI+ which works fine. What I am now trying to do is to modify it so the screen capture is of a remote...
8
36141
by: hoofbeats95 | last post by:
I don't think this should be this complicated, but I can't figure it out. I've worked with C# for several years now, but in a web environment, not with windows form. I have a form with a query button on it. If the query returns multiple results, a new window is opened with a grid containing the results. When the user double clicks on the desired row in the grid, I want the first form to populate with the correct data. I don't know how...
0
9706
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
9582
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
10580
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10335
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...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6854
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
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
5652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3821
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.