|
The above error i.e. extracting data to ms excel occurs especially on windows 10, it does not make any extraction at all, but when run the program or the exe file as an admin its work fine, would be grateful if any one help me solve this problem.
Thank you.
|
|
|
|
|
Jochen has already given you the solution; please follow his recommended suggestions.
|
|
|
|
|
The statement he had put up there seems more like a .NET rather than old plain VB6, I need help on VB6 not in .NET
|
|
|
|
|
The answer has nothing to do with either .NET or VB6, it is about how Windows allows access to different folders.
|
|
|
|
|
Hi All,
I create a program that runs on backgound using VB.NET minicap.exe with CMD as process. Inside the code is module and SUB_MAIN with system timers. It works fine except i notice that when my program runs on background as process? The other application on desktop is BLINKING intermittently. the system timer is set to 2sec upto 10seconds. heres my code below.
The main purpose of my program is to capture screenshot of desktop and save to network drive using MINICAP.EXE and CMD and SYSTEM TIMERS.
Imports System.Timers
Imports Microsoft.Win32
Imports MySql.Data.MySqlClient
Module Module1
Private myTimer1 As Timer
Private myTimer2 As Timer
Private myTimer3 As Timer
Private WithEvents MyProcess As Process
Private Delegate Sub AppendOutputTextDelegate(ByVal text As String)
Sub main()
DBconnection()
Dim uname As String
Dim mname As String
Dim Yourpath As String
uname = Environment.UserName
mname = Environment.MachineName
Try
Dim squery As String = "Select * from tbl_settings WHERE Computer = '" & mname & "'"
Dim sadapter As New MySqlDataAdapter
Dim scommand As New MySqlCommand
Dim sqltable As New DataTable
Dim i As Integer
Dim PAT
Dim STAT
Dim INTR
Dim COMPR
Dim x As Integer
With scommand
.CommandText = squery
.Connection = myconnection
End With
With sadapter
.SelectCommand = scommand
.Fill(sqltable)
End With
x = sqltable.Rows.Count
STAT = IIf(sqltable.Rows(i)("Status") IsNot DBNull.Value, sqltable.Rows(i)("Status"), vbNullChar)
If STAT = "ON" Then
COMPR = IIf(sqltable.Rows(i)("Compression") IsNot DBNull.Value, sqltable.Rows(i)("Compression"), vbNullChar)
INTR = IIf(sqltable.Rows(i)("Interval") IsNot DBNull.Value, sqltable.Rows(i)("Interval"), vbNullChar)
PAT = IIf(sqltable.Rows(i)("server_path") IsNot DBNull.Value, sqltable.Rows(i)("server_path"), vbNullChar)
'InputTextBox.Text = "minicap.exe -capturedesktop -stderr -noerr -cursor -compress" & " " & CAP & " " & "-exit -save" & " " & PAT
Yourpath = PAT & "\" & Format(Now, "MM-d-yyyy") & "\" & mname & "\" & uname
If (Not System.IO.Directory.Exists(Yourpath)) Then 'CHECK IF BUHAY YUNG SHARED DRIVE OR HINDI.. IF HINDI SA LOCAL MUNA
System.IO.Directory.CreateDirectory(Yourpath)
End If
sharedval.InputParam = "minicap.exe -capturedesktop -stderr -noerr -cursor -compress" & " " & COMPR & " " & "-exit -save" & " " & Chr(34) + Yourpath & "\" & Format(Now, "HH:mm:ss") & ".jpg" & Chr(34)
sharedval.Xcompression = COMPR
sharedval.Xinterval = INTR
sharedval.xServer = Yourpath
myTimer1.Enabled = True
myTimer1.Interval = INTR
ElseIf STAT = "OFF" Then
myTimer1.Enabled = False
End If
COMPR = IIf(sqltable.Rows(i)("Compression") IsNot DBNull.Value, sqltable.Rows(i)("Compression"), vbNullChar)
INTR = IIf(sqltable.Rows(i)("Interval") IsNot DBNull.Value, sqltable.Rows(i)("Interval"), vbNullChar)
PAT = IIf(sqltable.Rows(i)("server_path") IsNot DBNull.Value, sqltable.Rows(i)("server_path"), vbNullChar)
myTimer1.Interval = INTR
'InputTextBox.Text = "minicap.exe -capturedesktop -stderr -noerr -cursor -compress" & " " & CAP & " " & "-exit -save" & " " & PAT
Yourpath = PAT & "\" & Format(Now, "MM-d-yyyy") & "\" & mname & "\" & uname
If (Not System.IO.Directory.Exists(Yourpath)) Then 'CHECK IF BUHAY YUNG SHARED DRIVE OR HINDI.. IF HINDI SA LOCAL MUNA
System.IO.Directory.CreateDirectory(Yourpath)
End If
sharedval.InputParam = "minicap.exe -capturedesktop -stderr -noerr -cursor -compress" & " " & COMPR & " " & "-exit -save" & " " & Chr(34) + Yourpath & "\" & Format(Now, "HH:mm:ss") & ".jpg" & Chr(34)
sharedval.Xcompression = COMPR
sharedval.Xinterval = INTR
sharedval.xServer = Yourpath
Catch ex As Exception
'MsgBox(Err.Description & Err.Number)
End Try
'Me.AcceptButton = ExecuteButton
'MyProcess.BeginErrorReadLine()
'MyProcess.BeginOutputReadLine()
'AppendOutputText("Process Started at: " & MyProcess.StartTime.ToString)
myTimer1 = New System.Timers.Timer()
myTimer1.Interval = 2000 ' 2sec
AddHandler myTimer1.Elapsed, AddressOf OnTimedEvent1
myTimer1.AutoReset = True
myTimer1.Enabled = True
myTimer2 = New System.Timers.Timer()
myTimer2.Interval = 60000 ' 2sec
AddHandler myTimer2.Elapsed, AddressOf OnTimedEvent2
myTimer2.AutoReset = True
myTimer2.Enabled = True
myTimer3 = New System.Timers.Timer()
myTimer3.Interval = 2000 ' 2sec
AddHandler myTimer3.Elapsed, AddressOf OnTimedEvent3
myTimer3.AutoReset = True
myTimer3.Enabled = False
MyProcess = New Process
With MyProcess.StartInfo
.FileName = "CMD.EXE"
.UseShellExecute = False
.CreateNoWindow = True
.RedirectStandardInput = True
.RedirectStandardOutput = False
.RedirectStandardError = False
End With
MyProcess.Start()
Application.Run()
End Sub
Private Sub OnTimedEvent1(source As Object, e As System.Timers.ElapsedEventArgs)
Call absolutepath()
MyProcess.StandardInput.WriteLine(sharedval.InputParam)
MyProcess.StandardInput.Flush()
End Sub
Private Sub OnTimedEvent2(source As Object, e As System.Timers.ElapsedEventArgs)
Call checkstatus()
End Sub
Private Sub OnTimedEvent3(source As Object, e As System.Timers.ElapsedEventArgs)
End Sub
Private Sub MyProcess_ErrorDataReceived(ByVal sender As Object, ByVal e As System.Diagnostics.DataReceivedEventArgs) Handles MyProcess.ErrorDataReceived
AppendOutputText(vbCrLf & "Error: " & e.Data)
End Sub
Private Sub MyProcess_OutputDataReceived(ByVal sender As Object, ByVal e As System.Diagnostics.DataReceivedEventArgs) Handles MyProcess.OutputDataReceived
AppendOutputText(vbCrLf & e.Data)
End Sub
Private Sub AppendOutputText(ByVal text As String)
'If OutputTextBox.InvokeRequired Then
' Dim myDelegate As New AppendOutputTextDelegate(AddressOf AppendOutputText)
' Me.Invoke(myDelegate, text)
'Else
' OutputTextBox.AppendText(text)
'End If
End Sub
Public Sub absolutepath()
sharedval.InputParam = "minicap.exe -capturedesktop -stderr -noerr -cursor -compress" & " " & sharedval.Xcompression & " " & "-exit -save" & " " & Chr(34) + sharedval.xServer & "\" & Format(Now, "HH:mm:ss") & ".jpg" & Chr(34)
End Sub
Public Sub checkstatus()
Try
DBconnection()
Dim uname As String
Dim mname As String
Dim Yourpath As String
uname = Environment.UserName
mname = Environment.MachineName
Try
Dim squery As String = "Select * from tbl_settings WHERE Computer = '" & mname & "'"
Dim sadapter As New MySqlDataAdapter
Dim scommand As New MySqlCommand
Dim sqltable As New DataTable
Dim i As Integer
Dim PAT
Dim STAT
Dim INTR
Dim COMPR
Dim x
With scommand
.CommandText = squery
.Connection = myconnection
End With
With sadapter
.SelectCommand = scommand
.Fill(sqltable)
End With
x = sqltable.Rows.Count
STAT = IIf(sqltable.Rows(i)("Status") IsNot DBNull.Value, sqltable.Rows(i)("Status"), vbNullChar)
If STAT = "ON" Then
myTimer1.Enabled = True
ElseIf STAT = "OFF" Then
myTimer1.Enabled = False
End If
COMPR = IIf(sqltable.Rows(i)("Compression") IsNot DBNull.Value, sqltable.Rows(i)("Compression"), vbNullChar)
INTR = IIf(sqltable.Rows(i)("Interval") IsNot DBNull.Value, sqltable.Rows(i)("Interval"), vbNullChar)
PAT = IIf(sqltable.Rows(i)("server_path") IsNot DBNull.Value, sqltable.Rows(i)("server_path"), vbNullChar)
myTimer1.Interval = INTR
'InputTextBox.Text = "minicap.exe -capturedesktop -stderr -noerr -cursor -compress" & " " & CAP & " " & "-exit -save" & " " & PAT
Yourpath = PAT & "\" & Format(Now, "MM-d-yyyy") & "\" & mname & "\" & uname
If (Not System.IO.Directory.Exists(Yourpath)) Then 'CHECK IF BUHAY YUNG SHARED DRIVE OR HINDI.. IF HINDI SA LOCAL MUNA
System.IO.Directory.CreateDirectory(Yourpath)
End If
sharedval.Xcompression = COMPR
sharedval.Xinterval = INTR
sharedval.xServer = Yourpath
'InputTextBox.Text = "minicap.exe -capturedesktop -stderr -noerr -cursor -compress" & " " & COMPR & " " & "-exit -save" & " " & Chr(34) + Yourpath & "\" & Format(Now, "HH:mm:ss") & ".jpg" & Chr(34)
Catch ex As Exception
End Try
Catch ex As Exception
End Try
End Sub
End Module
modified 14-Apr-18 19:52pm.
|
|
|
|
|
If you are capturing images of the screen at regular intervals then you must expect some disruption to the screen display.
|
|
|
|
|
I understand that loading of mouse cursor is normal every interval but interacting with other windows form or programs is not.
|
|
|
|
|
On a slower PC, the "blink" may become more visible; my PC isn't a very fast one, but running on a high resolution - you'd be saving a large blob every so often.
So no, the spyware isn't going to work.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
I dont save it as blob. You can check the minicap.exe by donation coader. it saves directly to shared drive. loading of a mouse cursor if fine. but the main problem is the Windows form is intermittently loosing focus and focusing on minimized forms.
|
|
|
|
|
Please I need to know the right code to use to access stored user logins in Microsoft access from visual basic 6 login form. Kindly assist as the code i used is not connecting.
Adodc1.RecordSource = "SELECT * FROM LoginTB WHERE username ='" +
txtUserName.Text + "'"
Adodc1.Refresh
If (Adodc1.Recordset.EOF = False) Then
If (txtPassword.Text = Adodc1.Recordset.Fields
("Password")) Then
MsgBox ("Login Successful")
Else
MsgBox ("Login Failure. Incorrect Password")
End If
Else
MsgBox ("Login Failure. Username does not exist.")
End If
|
|
|
|
|
If I didn't know any better, I would think this is part of a scam.
Where you from?
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
You seem to be copying and pasting code together, knowing nothing about the code you're using, hoping the frankenstein assemblage you're building works.
True?
|
|
|
|
|
|
I think SQL injection is the least of his problems
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
|
VB6 is no longer supported, and no new code should be written in the language. The compiler isn't sold anymore, and there's no OS for sale that still supports it.
There's several problems with your code, SQL-injection just being one of them. You're also storing passwords, which is a security issue.
If you want to learn to code then upgrade to VB.NET; if this is part of a course or schoolwork, then I suggest you demand your money back.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Thanks for your response, I am on the verge of upgrading to VB.net. However I need to complete this project. If you still have an idea on how to generate this in VB 6. I will very much appreciate. Thanks
|
|
|
|
|
Your solution is insecure, in an unsupported language. I oppose both the use of VB6 (a waste of your clients time and money) and the way you're implementing it.
Just hardcode a general password in that form and be done with it. If you don't take it seriously, then why should I?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
How can I display automatically the username of a user that login to a Visual basic 6.0 application on the form
|
|
|
|
|
NOTHING happens "automatically". You either write the code to do it or it doesn't happen.
Are you prompting the user for a username and password to login to the app? If so, you already have the username is a string somewhere, so pass that to a method that sets the text of a label somewhere, or whatever control you're going to use to show the username.
|
|
|
|
|
So how do i pass that to a method that sets the text (user name) of a label on a particular form. Kindly assist with the right code to use on the vb6 form
|
|
|
|
|
Ummm... you're asking about how to do the simplest things in VB.
You mean to tell me you seriously don't know how to pass a string to a Sub or Function?
Do you even have a label on your form for showing the username?
Do you even have some Sub for setting the text of that label?
|
|
|
|
|
Please I will like to know if this code written is okay. seems to be having error. The aim is to prevent user from making any changes on form after saving.
CUSTOMER RESERVATION BILLLING (cmdSave, Command2)
If cmdSave.Caption = "Save" Then
Adodc1.Recordset.AddNew
txt.SetFocus
'Disenablebuttons
cmdsave.Enabled = True
cmdAddNew.Caption = "Cancel"
cboClassofRoom.Locked = False
txtCustomer_Name.Locked = False
txtRoomNo.Locked = False
txtCustomer_Address.Locked = False
txtPhone_number.Locked = False
txtAmountPaid.Locked = False
txtCheckin.Locked = False
txtDuration.Locked = False
txtDate.Locked = False
txtReceptionist.Locked = False
Else
Adodc1.Recordset.CancelUpdate
cmdsave.Enabled = False
cmdAdd.Caption = "Add"
'enablebuttons
cboClassofRoom.Locked = True
txtCustomer_Name.Locked = True
txtRoomNo.Locked = True
txtCustomer_Address.Locked = True
txtPhone_number.Locked = True
txtAmountPaid.Locked = True
txtCheckin.Locked = True
txtDuration.Locked = True
txtDate.Locked = True
txtReceptionist.Locked = True
End IF
End Sub
|
|
|
|
|
Seriously? Did you even read your code?
cmdsave.Enabled = True ??????????
|
|
|
|
|