|
Here is my code
<br />
Shell("C:\Windows\Notepad.exe")<br />
AppActivate("Sans titre - Bloc-notes")<br />
'French computer ^^<br />
SendKeys("test")<br />
Doesn't work. I get an error on the AppActivate line
Please help
Thanks
~Michael
|
|
|
|
|
OK. First, it helps if you supplied what the error was. Without that, we just speculating as to what is wrong. What your doing is problematic at best. If the system launches another app or dialog, or the user clicks anywhere between the time the AppActivate and SendKeys statements are run, (and, YES it DOES happen!), your keystroke will end up going to another application. Now...
At first glance, the title of the application your activating doesn't match the title of any window. What you can do in place of the title is use the TaskID that is returned by the Shell function and use that in the AppActivate statement. On top of that, when you launched Notepad, it was launched, by default, minimized. To correct that:
Dim taskID as Long
taskID = Shell("C:\Windows\Notepad.exe", vbNormalFocus)
AppActivate taskID
SendKeys "test", True
RageInTheMachine9532
|
|
|
|
|
|
Hello all, I am developing a small activeX DLL that will simply be a wrapper for a function that takes a string as a parameter. This string represents a name to be resolved in the Outlook Global Address Book. I have created a group rproject in VB6 containing two project: one being my ActiveX dll and the other as a test program my ActiveX exe. When I built the ActiveX dll code it created a dll and registered it correct? Then I went ahead and built the exe test code this generated an executable. When I run the exe file on my development machine with Visual Studio 6 on it the exe runs fine. I transported this exe and my dll via floppy to a test machine without the Visual Studio 6 IDE and everytime I attempt to run the exe i get "error 429 ActiveX Control cann create object". I have already registered my dll on the test machine (its location is c:\winnt\system32 if that matters), and this method within the ActiveX dll uses MAPI to verify the names passed to it(i also made an attemp to register MSMAPI32.dll but it tells me it cannot find the entry point? is it protected? I also registered msmapi32.ocx which worked fine) I cannot seem to pin point why this exe will not run. I am not sure if One or more dll's are missing or they are not registered right and I have been using process tracking applications to try to pin point the missing libraries with little luck. If anyone has had this problem before or has some advice on how to locate the absent files I need on the test system I would greatly appreciate the help. Thanks for helping out a newbie.
Frank
|
|
|
|
|
Hi Frank,
Did you make sure that you had all of the required dependencies for your component installed including the Visual Basic runtime DLL required by your component? Also, if your component references others, they may have references to not only other components, but perhaps versions (or different versions) of DLLs which they require. If those aren't installed, they will most likely fail to load. Sometimes it takes a bit of investigation to determine all dependencies and even the dependencies of those required for them to be used.
Regards,
Joe
|
|
|
|
|
I have looked at this for a while now and I really cant seem to find what Dll's or Ocx's my exe is missing. I have tried refreshing the files on the client maachine eliminating the possibility that they are corrupt, and I have also registered them all numerous times. I beleive the exe hangs when I try to do the following in the code within the exe project.
Dim Instance As MyActiveXDllName.ClassName
Set Instance = New MyActiveXDllName.ClassName 'This line causes it to hang
So i think the problem is with the DLL that I created with VB. I have this dll in the C:\winnt\system32 directory on the client machine and i made sure to register it within the directory. I am not sure what I need to do, as I really do not want to install VB 6 on the client machine, which would defeat the whole purpose of this application. I curerntly have SP5 on VB 6.0 so I think I have the mose current runtimes in the development machine and I made sure that MSVBVM60.DLL was on the client machine and registered and it is. I am really running out of ideas. If anybody has suggestions or an idea that I have missed please help I would greatly appreciate it. Thanks for helping out a newbie.
Frank
|
|
|
|
|
From your problem description, it sounds like you definitely have a dependancy issue. You can use the Dependancy Walker tool (C:\Program Files\Microsoft Visual Studio\Common\Tools\DEPENDS.EXE) on your DLL to make sure you have all the files you need.
If your depending on the Package and Deployment wizard to find the dependant files for you, it does a lousy job. I highly recommend using the DW to get a definitive list. Also, since we can't see your code, we can't tell you what your missing.
One thing that hits me as strange - you said that your test project is an ActiveX EXE? Why? Is this some kind of server?
RageInTheMachine9532
|
|
|
|
|
No that was my mistake my test code is simply a standard exe. As for as the depends.exe goes how do I use the information it gives me? Thanks for your quick replies guys, another reason why I love this site and the people who use it.
Frank
|
|
|
|
|
I have come across a design issue (programming in vb.net) . It would be helpful if any one share their opinion about this .
I am trying to design a class and I wanted to make sure I am in the right path...
A 'Rate' is an interest rate at a specific maturity (Term on X-axis and Rate on Y-axis) example...5.2% for 15 year loan.
A rate can be a simple rate as simple as 5.6% for 3 years term or it could be a complex rate where it is combination of two or more simple rates. For complex rate or simple rate the attributes, methods or exactly same. No difference absolutely except that for a complex rate we need to add 1 or more simple rates.
I think I am thinking along the lines of creating a generic class (non-abstract) called as 'RATE' class and create an "RateComposer" class (which will know by accessing database wheather it is a simple rate or a complex rate) which will create multiple instances of 'Rate' class and gets the rate for each simple rate and sums it to get the final complex rate.
Pls comment..
thank you
|
|
|
|
|
You might want to think about implementing an ICollection interface with your "RateComposer" class. It will make subsequent operations on the class much easier.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
Support Bone
|
|
|
|
|
thank you. I will think about that.
|
|
|
|
|
I certainly appreciate your response to my problem, Mike. However, I'm still left with the same delima. I've been unable to determine which line on the grid I'm attached to. The following code was intended to accomplish that determination but causes an error.
Private Sub dgAttorney_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dgAttorney.SelectedIndexChanged
Dim source As Object
Dim y As System.Web.UI.WebControls.DataGridCommandEventArgs
'Dim X As String
'X = y.CommandName
Session("County") = y.Item.Cells(0).Text
Session("AttNo") = y.Item.Cells(1).Text
Response.Redirect("frmAttyDetail.aspx")
End Sub
I should be able to use the variable 'e' to make this determination, but that gives me an undefined variable error. The above code (when I click on the button) causes:
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 116: 'Dim X As String
Line 117: 'X = y.CommandName
Line 118: Session("County") = y.Item.Cells(0).Text
I've tried everything I could think of. Any other ideas?
Thanks in advance, Jim
|
|
|
|
|
Hi Jim. Okay - without a doubt the "Object reference not set to an instance of an object" error is happening because your variable y is never instantiated. You define the variable with the line:
Dim y As System.Web.UI.WebControls.DataGridCommandEventArgs
but y is never set to an actual object.
I'm wondering if you want to use the ItemCommand event (which uses DataGridCommandEventArgs) instead of SelectedIndexChanged... I'm not sure why you would want the SelectedIndexChanged event to do what you described in your original message, but that just may be because I never thought to do it that way. Can you post the full .aspx page?
|
|
|
|
|
Well, I can sure give that a try, Mike. I'm using the defaults created when I double clicked on the button I had created on the form, it created the SelectedIndexChanged event. It's entirely possible I could use the ItemCommand event. That might very well resolve my problem, however....when does that execute?
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<system.diagnostics.debuggerstepthrough()> Private Sub InitializeComponent()
Me.SqlSelectCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection
Me.SqlInsertCommand1 = New System.Data.SqlClient.SqlCommand
Me.SqlDataAdapter1 = New System.Data.SqlClient.SqlDataAdapter
Me.Attorneys1 = New AttorneyMaintenance.Attorneys
CType(Me.Attorneys1, System.ComponentModel.ISupportInitialize).BeginInit()
'
'SqlSelectCommand1
'
Me.SqlSelectCommand1.CommandText = "SELECT ATCTY, ATTTP, ATMOD, ATCODE, ATNAME, ATALPH, ATADD1, ATADD2, ATCITY, ATSTA" & _
"T, ATZIP1, ATZIP2, ATARCD, ATEXCH, ATPHN, ATFAX1, ATFAX2, ATFAX3, ATFIL FROM ATT" & _
"YMF"
Me.SqlSelectCommand1.Connection = Me.SqlConnection1
'
'SqlConnection1
'
Me.SqlConnection1.ConnectionString = "workstation id=JIMNEW;packet size=4096;user id=sa;password=wolverine;data source=" & _
"SQLServer;persist security info=False;initial catalog=SWCG_Circuit_Import1"
'
'SqlInsertCommand1
'
Me.SqlInsertCommand1.CommandText = "INSERT INTO ATTYMF(ATCTY, ATTTP, ATMOD, ATCODE, ATNAME, ATALPH, ATADD1, ATADD2, A" & _
"TCITY, ATSTAT, ATZIP1, ATZIP2, ATARCD, ATEXCH, ATPHN, ATFAX1, ATFAX2, ATFAX3, AT" & _
"FIL) VALUES (@ATCTY, @ATTTP, @ATMOD, @ATCODE, @ATNAME, @ATALPH, @ATADD1, @ATADD2" & _
", @ATCITY, @ATSTAT, @ATZIP1, @ATZIP2, @ATARCD, @ATEXCH, @ATPHN, @ATFAX1, @ATFAX2" & _
", @ATFAX3, @ATFIL); SELECT ATCTY, ATTTP, ATMOD, ATCODE, ATNAME, ATALPH, ATADD1, " & _
"ATADD2, ATCITY, ATSTAT, ATZIP1, ATZIP2, ATARCD, ATEXCH, ATPHN, ATFAX1, ATFAX2, A" & _
"TFAX3, ATFIL FROM ATTYMF"
Me.SqlInsertCommand1.Connection = Me.SqlConnection1
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATCTY", System.Data.SqlDbType.VarChar, 2, "ATCTY"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATTTP", System.Data.SqlDbType.VarChar, 1, "ATTTP"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATMOD", System.Data.SqlDbType.VarChar, 1, "ATMOD"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATCODE", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, False, CType(6, Byte), CType(0, Byte), "ATCODE", System.Data.DataRowVersion.Current, Nothing))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATNAME", System.Data.SqlDbType.VarChar, 40, "ATNAME"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATALPH", System.Data.SqlDbType.VarChar, 20, "ATALPH"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATADD1", System.Data.SqlDbType.VarChar, 30, "ATADD1"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATADD2", System.Data.SqlDbType.VarChar, 30, "ATADD2"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATCITY", System.Data.SqlDbType.VarChar, 15, "ATCITY"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATSTAT", System.Data.SqlDbType.VarChar, 2, "ATSTAT"))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATZIP1", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, False, CType(5, Byte), CType(0, Byte), "ATZIP1", System.Data.DataRowVersion.Current, Nothing))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATZIP2", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, False, CType(4, Byte), CType(0, Byte), "ATZIP2", System.Data.DataRowVersion.Current, Nothing))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATARCD", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, False, CType(3, Byte), CType(0, Byte), "ATARCD", System.Data.DataRowVersion.Current, Nothing))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATEXCH", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, False, CType(3, Byte), CType(0, Byte), "ATEXCH", System.Data.DataRowVersion.Current, Nothing))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATPHN", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, False, CType(4, Byte), CType(0, Byte), "ATPHN", System.Data.DataRowVersion.Current, Nothing))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATFAX1", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, False, CType(3, Byte), CType(0, Byte), "ATFAX1", System.Data.DataRowVersion.Current, Nothing))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATFAX2", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, False, CType(3, Byte), CType(0, Byte), "ATFAX2", System.Data.DataRowVersion.Current, Nothing))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATFAX3", System.Data.SqlDbType.Decimal, 5, System.Data.ParameterDirection.Input, False, CType(4, Byte), CType(0, Byte), "ATFAX3", System.Data.DataRowVersion.Current, Nothing))
Me.SqlInsertCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ATFIL", System.Data.SqlDbType.VarChar, 83, "ATFIL"))
'
'SqlDataAdapter1
'
Me.SqlDataAdapter1.InsertCommand = Me.SqlInsertCommand1
Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1
Me.SqlDataAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "ATTYMF", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("ATCTY", "ATCTY"), New System.Data.Common.DataColumnMapping("ATTTP", "ATTTP"), New System.Data.Common.DataColumnMapping("ATMOD", "ATMOD"), New System.Data.Common.DataColumnMapping("ATCODE", "ATCODE"), New System.Data.Common.DataColumnMapping("ATNAME", "ATNAME"), New System.Data.Common.DataColumnMapping("ATALPH", "ATALPH"), New System.Data.Common.DataColumnMapping("ATADD1", "ATADD1"), New System.Data.Common.DataColumnMapping("ATADD2", "ATADD2"), New System.Data.Common.DataColumnMapping("ATCITY", "ATCITY"), New System.Data.Common.DataColumnMapping("ATSTAT", "ATSTAT"), New System.Data.Common.DataColumnMapping("ATZIP1", "ATZIP1"), New System.Data.Common.DataColumnMapping("ATZIP2", "ATZIP2"), New System.Data.Common.DataColumnMapping("ATARCD", "ATARCD"), New System.Data.Common.DataColumnMapping("ATEXCH", "ATEXCH"), New System.Data.Common.DataColumnMapping("ATPHN", "ATPHN"), New System.Data.Common.DataColumnMapping("ATFAX1", "ATFAX1"), New System.Data.Common.DataColumnMapping("ATFAX2", "ATFAX2"), New System.Data.Common.DataColumnMapping("ATFAX3", "ATFAX3"), New System.Data.Common.DataColumnMapping("ATFIL", "ATFIL")})})
'
'Attorneys1
'
Me.Attorneys1.DataSetName = "attorneys1"
Me.Attorneys1.Locale = New System.Globalization.CultureInfo("en-US")
CType(Me.Attorneys1, System.ComponentModel.ISupportInitialize).EndInit()
End Sub
Protected WithEvents txtAttorney As System.Web.UI.WebControls.TextBox
Protected WithEvents lblAttorneyName As System.Web.UI.WebControls.Label
Protected WithEvents btnAdd As System.Web.UI.WebControls.Button
Protected WithEvents dgAttorney As System.Web.UI.WebControls.DataGrid
Protected WithEvents SqlSelectCommand1 As System.Data.SqlClient.SqlCommand
Protected WithEvents SqlInsertCommand1 As System.Data.SqlClient.SqlCommand
Protected WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
Protected WithEvents SqlDataAdapter1 As System.Data.SqlClient.SqlDataAdapter
Protected WithEvents Attorneys1 As AttorneyMaintenance.Attorneys
Protected WithEvents btnSubmit As System.Web.UI.WebControls.Button
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Public Sub FillDataSet(ByVal dataset As AttorneyMaintenance.Attorneys)
dataset.EnforceConstraints = False
Me.SqlConnection1.Open()
Me.SqlDataAdapter1.Fill(dataset)
dataset.EnforceConstraints = True
Me.SqlConnection1.Close()
End Sub
Private Sub Showdetailgrid()
If (Me.dgAttorney.SelectedIndex <> -1) Then
Dim attyrows As System.Data.DataView
Dim currentattyrow As System.Data.DataRowView
attyrows = New DataView
attyrows.Table = Me.Attorneys1.Tables("Attorney")
currentattyrow = attyrows(Me.dgAttorney.SelectedIndex)
End If
End Sub
Private Sub dgAttorney_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dgAttorney.SelectedIndexChanged
Dim source As Object
Dim y As New System.Web.UI.WebControls.DataGridCommandEventArgs
'Dim X As String
'X = y.CommandName
Session("County") = y.Item.Cells(0).Text
Session("AttNo") = y.Item.Cells(1).Text
Response.Redirect("frmAttyDetail.aspx")
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Response.Redirect("frmAttyDetail.aspx")
End Sub
'Create a new DataSet to hold the records returned from the call to FillDataSet().
'A temporary dataset is used, because filling the existing DataSet would
'require the databindings to be rebound
Public Sub LoadDataSet()
Dim objdatasettemp As AttorneyMaintenance.Attorneys
objdatasettemp = New AttorneyMaintenance.Attorneys
Me.FillDataSet(objdatasettemp)
Attorneys1.Clear()
Attorneys1.Merge(objdatasettemp)
End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim strSql
strSql = "SELECT ATCTY, ATTTP, ATMOD, ATCODE, ATNAME, ATALPH, ATADD1, ATADD2, ATCITY, ATSTAT, ATZIP1, ATZIP2, ATARCD, ATEXCH, ATPHN, ATFAX1, ATFAX2, ATFAX3, ATFIL FROM ATTYMF where (((ATALPH) Like '%" & txtAttorney.Text & "%'))"
SqlDataAdapter1.SelectCommand.CommandText = strSql
Me.LoadDataSet()
Me.dgAttorney.SelectedIndex = -1
Me.dgAttorney.DataBind()
Application("Attorneys") = Me.Attorneys1
End Sub
Private Sub txtAttorney_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAttorney.TextChanged
End Sub
End Class
|
|
|
|
|
Hi,
I'm using MS Access 2000, and I need to a form that consists of dynamic objects (i.e., the objects (text boxes) in the form are dependent upon data, and may need to change)
Example- The form is illustrating the client's current currency positions. I may need more text boxes in the form if its recordsource increases that types of currency the client possesses. Thus, it the client decides to increase the types of currency's he/she trades, I need the form to dynamically create a new field illustrating that currency.
Using VBA, is there a way to programmatically create a form, so it can store dynamic objects/content?
Please let me know if I have not explained this in great enough detail
I'd appreciate any help at all,
Thanks
Nick
|
|
|
|
|
|
How about
Dim txt as textbox
MyForm.Controls.Add(txt)
The warlord
|
|
|
|
|
How do you load a file from a List box to a text box.
I'm using Microsoft Direct Text-to-Speech and it wont speak from the list box but it will from the text box.
The file is loaded to the list box from the C drive.
So how is this possible???
|
|
|
|
|
You Have To Use The Rich Text Box Instead Of A Textbox So That You Can Easily Load A Text Fine Into It.
Richtexbox1.filename = "PATH"
I You Thinh You Can - "You Can"
|
|
|
|
|
Hello,
I'm building a little VB.NET application who will connect to an Access DB to fill its fields.
I would like to know two things to build my architecture in the right path.
1- Is it a good idea to store the databse location in a registry key (Microsoft.Win32.Registry.CurrentUser)? If not, where should I store it?
2- To access tables in the database, I plan to create, lets say, an SQLAgent class (a layer) between my application and the DB to do any transactions (SELECT, UPDATE, DELETE, ...). This SQLAgent could run any SQL qwery passed in parameter.
The constructor of this SQLAgent class would receive the DB location string to open the DB. Then this SQLAgent object, once created, would receive the SQL qwery to run and return the current recordset.
When this transaction is done, this SQLAgent object can be deleted (finalized). And the VB form can fill its fields with the content of the recordset.
So every forms would have control over its own SQL string and call SQLAgent whenever it need it.
My point is, am I right with #1 and #2?
Thank you very much, I am used with OO but it is the first time I plan to access to DB and I want to do it the right way. Because this is a personal project but I want my code to be reusable, so best practice is the best.
Xelk
|
|
|
|
|
Hi Xelk:
VB.NET facilitates .EXE.COnfig. Is'nt it? You can have the connectionstrings with ScringScrambling or some small-scale reversible encryption and store it there.
What do you say?
Deepak Kumar Vasudevan
Personal Web: http://deepak.portland.co.uk/
I Blog At: http://deepak.blogdrive.com/
|
|
|
|
|
Very good idea Deepak,
Is this file editable when the package is compiled then deployed?
What do you think of my point #2?
Thank you
Xelk
|
|
|
|
|
Hi Xelk:
The .EXE.Config file is a kind of plain XML file. You can read it via ConfigurationSettings.AppSettings["keyname"] in your application.
Whatever is there in the Config File for the particular keyname after modifying it, post package and deployment also, would be taken.
Did this attend to your query?
Deepak Kumar Vasudevan
Personal Web: http://www24.brinkster.com/lavanyadeepak/default.asp
I Blog At: http://deepak.blogdrive.com/
|
|
|
|
|
Hello Deepak,
Thank you for your help. I will use this .EXE.Config file. It will be very useful.
Heave a nice day.
Xelk
|
|
|
|
|
hello
i have written this application to capture video and to save the picture
into database.its working fine ... but when i try to close my application
its NOT CLOSING PERFECTLY . some times it hangs.
here is my code ....
(note : here i might have missed some code and variable ... but the application is running ...)
' in the main form module
Private Sub Form_Load()
Dim lpszName As String * 100
Dim lpszVer As String * 100
Dim Caps As CAPDRIVERCAPS ' CAPDRIVERCAPS declared in a
module
' Capture Window creation
' driver info
capGetDriverDescriptionA 0, lpszName, 100, lpszVer, 100
mywdc = capCreateCaptureWindowA(lpszName, WS_CAPTION Or WS_THICKFRAME
Or WS_VISIBLE Or WS_CHILD, 0, 0, 160, 120, Me.hwnd, 0)
' Setting the title of window
SetWindowText mywdc, lpszName
' Setting the video callback function
capSetCallbackOnStatus mywdc, AddressOf MyStatusCallback
capSetCallbackOnError mywdc, AddressOf MyErrorCallback
' Connect to the driver
If capDriverConnect(mywdc, 0) Then
' getting the capture driver capabilities
capDriverGetCaps mywdc, VarPtr(Caps), Len(Caps)
' Start previewing the image
capPreview mywdc, True
' resizing the widow to the whole image
ResizeCaptureWindow mywdc
End If
End Sub
private sub EndAppln
' code to end the application - called in form's queryunlocad and when close menu is selected in main form
'the below given are functions declared a module and called from the main form
capSetCallbackOnError = SendMessage(lwnd,CAP_SET_CALLBACK_ERROR,0,lpProc)
capSetCallbackOnStatus = SendMessage( lwnd,CAP_SET_CALLBACK_STATUS,0,lpProc)
capSetCallbackOnYield = SendMessage(lwnd,CAP_SET_CALLBACK_YIELD,
0,lpProc)
capSetCallbackOnFrame = SendMessage(lwnd,CAP_SET_CALLBACK_FRAME,0,lpProc)
capSetCallbackOnVideoStream = SendMessage(lwnd,CAP_SET_CALLBACK_VIDEOSTREAM, 0,lpProc)
capSetCallbackOnWaveStream = SendMessage(lwnd,CAP_SET_CALLBACK_WAVESTREAM, 0,lpProc)
capSetCallbackOnCapControl = SendMessage(lwnd,CAP_SET_CALLBACK_CAPCONTROL, 0,lpProc)
capCaptureStop (mywdc)
capDriverDisconnect (mywdc)
DestroyWindow (mywdc) ' here the API declared in the module,
called
UnLoad Me
End
End Sub
any one please suggest any changes to be made to my application
TO SAFELY CLOSE MY APPLICATION AND PLESE SUGGEST HOW TO OPTIMIZE MY APPLICATION (AS IT TAKES MUCH MEMORY AND PROCESOR TIME) TO MAKE SURE THE APPLICATION RUN SMOOTHLY ... doh:
Thanks in advance:
Mohan G
|
|
|
|
|