Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all 21112 articles
Browse latest View live

append info in txt file from 1.200 users

$
0
0
I need to permit to approx 1.200 users, to print info in txt, stored in a server dir (the txt file and dir on server have complete permission and i grant to Everyone, write, modifiy, ecc..)

my idea....

open txt from dir with:

Code:

...
 Close #F
    Open "\\ro58\work$\FSR\Gest\DATABASE\USERS.txt" For Append As #F
    Do While Not WS.Range("A" & RIGA).Value = ""
        Print #F, "ATTO" & vbTab & VBA.Environ("USERNAME") & vbTab & VBA.Environ("COMPUTERNAME") & vbTab & Format(Now(), "DD/MM/YYYY") & vbTab & WS.Range("A" & RIGA).Value & vbTab & Trim(WS.Range("B" & RIGA).Value) & vbTab & WS.Range("C" & RIGA).Value & vbTab & WS.Range("D" & RIGA).Value & vbTab & Trim(WS.Range("E" & RIGA).Value) & vbTab & WS.Range("F" & RIGA).Value & vbTab & WS.Range("G" & RIGA).Value & vbTab & ORA & vbTab & "SI"
        RIGA = RIGA + 1
    Loop
    Close #F
....

is a good idea or exists another way?

Why? because i know Access and ADO permit 20/25 connection simultanius, in this case the users fill the txt withiout prob....

living human face image detection in visual basic 6.00

$
0
0
Hello ThEiMp here again, I am looking to utilize the ability to detect faces using the hardware camera, that is fixed to the laptop or even desktop computer, even. so that I will be able to protect my logins of my website for the real living people that use it, even. it will have an image that is fixed in the profile pic of the account holder's profile. then when the try to login, it will always let them to login, when they use facial recognition of the hardware camera, on the laptop or even the desktop computers, even at that. then giving the user, doesn't have to remember anything more to login with, even. the whole big deal and the idea here, is to then give way to print material of the login to the new digital way of logging into the account holder's profile. could someone please help me with the location of the ActiveX Control that is able to do this, or that will I have to write the whole thing out in source coding kind of way, I am looking to locate an ActiveX Control to do this, and then I just want to fiddle with the properties, using the VB6 IDE.

!! Thanks in advance !!

Need help using SendNotifyMessage...

$
0
0
Hello everyone,

I am hoping you can help me. I have been trying to use the SendNotifyMessage() function to activate a button in another application. From what I have read online, in order to do that you need the Parent window Handle in order to get the buttons handle. After getting the button's handle you can use the SendNotifyMessage() to activate it.

Here is the thing though, I have been using the Spy++ drag and drop icon to find the window captions, but I don't know which window is considered the parent window. Is it the window the button resides in?

Also, the windows do not have any captions according to Spy++. Is there another method I can use to find the window I need?

Here is my code thus far:

Code:

Declare Sub Sleep Lib "kernel32.dll" (ByVal dwMilliseconds As Long)
Public Declare Function SetActiveWindow Lib "user32.dll" (ByVal hWnd As Long) As Long
Public Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Declare Function FindWindowX Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, _
  ByVal hWnd2 As Long, ByVal lpsz1 As Long, ByVal lpsz2 As Long) As Long
Declare Function SendNotifyMessage Lib "user32.dll" Alias "SendNotifyMessageA" (ByVal hWnd As Long, ByVal Msg As Long, _
wParam As Any, lParam As Any) As Long
Sub ClickButton()

    Dim WindowHandle As Long
    Dim ButtonHandle As Long
    Public Const BM_CLICK = &HF5
    Dim retval As Long
   
    'Find window by window caption
    WindowHandle = FindWindow(vbNullString, "Window Title")
   
    'Find button within Window by using button's caption
    'the Button's Caption is "Open" and it is a "Button".
    'SPYXX.exe that comes with Microsoft Visual Studio will reveal this information to you
    ButtonHandle = FindWindowX(WindowHandle, 0, "Button", "Button's Caption")
   
    'Set Parent Window to focus
    ' may be necassary so button call works
    SetActiveWindow (WindowHandle)
   
    'Send message to button that you are "clicking it".
    retval = SendNotifyMessage(ButtonHandle, BM_CLICK, 0, 0)
   
End Sub

I just noticed in Spy++ that the parent window is probably the window at the top of the tree corresponding to the programs name right? It reveals a windows caption. Is that the window I need to get with the FindWindow() function?

VbIde editor - howTo choose ANY bgColor (instead 19 color)

$
0
0
Hi,
is it possible to have ANY BackColor in the VBIde? I'm not sure whether
the BGColor value is stored in the registry.

Actually I can choose between 19 predefined background colors.

Name:  vbeditorformat.jpg
Views: 55
Size:  48.5 KB
Attached Images
 

Can I assign a X and Y to a hwnd as long?

$
0
0
Hi! I'm using SetWindowText API (ByVal hwnd As Long, ByVal lpString As String) As Long is it possible to use dim x and y to the value of hwnd? I set Dim MyWindow as Long to hwnd value?! I want X and Y to replace MyWindow... If your asking me why?, I'm trying to connect SetCaretPos and assign a value to x and y...

[RESOLVED] Windows 10 and ShellExecuteW not always working.

$
0
0
This is too weird. All of this worked fine in Windows 7, and it's "sort of" working on Windows 10, but not completely.

I've got a generic ShellEx function. I've cut it down below (to illustrate the problem), but the core of it can be seen.

Code:


Option Explicit
Private Declare Function ShellExecuteW Lib "shell32.dll" (ByVal hWnd As Long, ByVal lpOperation As Long, ByVal lpFile As Long, ByVal lpParameters As Long, ByVal lpDirectory As Long, ByVal nShowCmd As Long) As Long

Private Sub Command1_Click()
    ShellEx "C:\users\elroy\desktop\test.xls"
End Sub

Private Function ShellEx(sFileName As String) As Long
    Const Shell_SHOWNORMAL = 1
    ShellEx = ShellExecuteW(0&, StrPtr("Open"), StrPtr(sFileName), 0&, 0&, Shell_SHOWNORMAL)
End Function


Okay, that all seems like pretty simple stuff. And, if I use it to open a word document, a PDF, or even other file types, it works absolutely fine. However, on Win10, it's not working to open Excel files.

I've tried it on .XLS, .XLSX, and .XLSM files. And it fails on all of them. What it does is open Excel, but it doesn't open the specified data file. It just opens Excel in a "blank" mode with no file open.

Also, I've tried it both with and without quotes surrounding the sFileName, with no change.

Also, as further FYI, if I double-click any Excel file from Windows Explorer, all works as expected. And, if I right-click an Excel file, and then click "Open" from the context menu, again, all works fine. I don't get it.

Any experience/ideas/advice would be much appreciated.

One last FYI, I've got MS-Office 2010 installed on this Windows 10 machine. I can't see how that would make much difference though.

Best Regards,
Elroy

Draw a semi transparent rectangle over image box

Again problem with table creation

$
0
0
Hi everyone
I apologize for bothering you.
One of the experts here helped me to create a table with ths code:

Code:

Dim strSQL As String
For i = 1 To 60
strSQL = strSQL & i & " yesNo, "

Next
strSQL = Mid(strSQL, 1, Len(strSQL) - 2)

Debug.Print "CREATE TABLE psycho(" & _
"id integer ," & _
strSQL & ")"

The code is creating the table successfully.
Now I need to add another array of text fields.
This is what I'm doing but I get syntax error in the name of the field.

Code:

Dim n As Integer
Dim i As Integer

Dim Sql As String
Dim StrSql As String
Dim X As String
Dim T As String

For i = 1 To 60
X = "chk"
StrSql = StrSql & X & i & " yesNo, "
Next
StrSql = Mid(StrSql, 1, Len(StrSql) - 2)

T = "txt"
For n = 1 To 16
Sql = Sql & n & T & "  VARCHAR(10), "
Next

Sql = Mid(Sql, 1, Len(Sql) - 2)

DB.Execute "CREATE TABLE psycho(" & _
"id integer ," & _
"sql ," & _
StrSql & ")"

Thank you

chart with listview items

$
0
0
How to make a chart with the value in items of listview?
Attached image.

note:
first year start from column 8 in listview
TRIM in column is trimester....For test you can use also; QUAD(Quadrimester), SEM(Semester), ecc...

In effect i need to show the trend based a Year Periods
Attached Images
 

Windows classic from VB6

$
0
0
I have executed an example program in VB6 from a third party, and this program has changed a setting in VB6 so that everytime when I open VB6, it sets the Windows 7 scheme to Classic.
Does anybody know where I can change a setting in VB6 not to do it.
Thanks
PK

[RESOLVED] Textbox accepts only numbers and point

$
0
0
Hi programmers.
I want a textbox to accept only numbers and a point (.) in textbox change event not in key press event.
thank you in advance

Finding data in Access sells using Visual Basic

$
0
0
Hello! I am from Russia, so i am sorry in advance for my language and for russian data on my screenshot.

I made a database in Access and connected it with Visual Studio using Recordset. My question is - how do i find data in cells of this database, using code?

For my example, i write Number of the card in Textbox1, the programm must find if this number is from my database (4th column on screenshot) and it needs to put data from 5th column in Label1.

Name:  n9U2SH9V5rs[1].jpg
Views: 41
Size:  13.6 KB
Attached Images
 

Confirmation of CVS Data Input

$
0
0
I'm receiving data from a server which provides the data field order as the first record. For whatever reason the field order varies from time to time. I wanted to confirm the field order prior to processing and came up with the following.

Anyone have any better suggestions?

Code:

  'Get Order of Returned Fields by comparing their name
  Dim i As Integer
  Dim iCount As Integer
 
  lngPos = fGetPosFirstNumber(strIn)
  If lngPos > 0 Then
      strData = Left$(strIn, lngPos - 1)
  End If
 
  Call fVB5plit(strData, strColumns(), kComma, , vbTextCompare)
 
  iCount = 0
  For i = LBound(strColumns) To UBound(strColumns)
      Select Case i
        Case 0
            If strColumns(i) = "Date" Then iCount = iCount + 1
        Case 1
            'increase count for next field if the same
        Case 2
            'increase count for next field if the same
        Case 3
            'increase count for next field if the same
        Case 4
            'increase count for next field if the same
        End Select
  Next
 
  If Not iCount = 5 Then
      Msgbox "fields in wrong order"
      Exit Sub
  End If

[RESOLVED] Finding data in Access sells using Visual Basic

$
0
0
Hello! I am from Russia, so i am sorry in advance for my language and for russian data on my screenshot.

I made a database in Access and connected it with Visual Studio using Recordset. My question is - how do i find data in cells of this database, using code?

For my example, i write Number of the card in Textbox1, the programm must find if this number is from my database (4th column on screenshot) and it needs to put data from 5th column in Label1.

Name:  n9U2SH9V5rs[1].jpg
Views: 97
Size:  13.6 KB
Attached Images
 

Convert Double to Hex and back to Long in Chinese Unicode for VB6

$
0
0
I am fairly new to VB6 and I would like to convert a parameter from Double to Hex and back to Long for Chinese Unicode.

The issue here is for input values from 1-127, the output is the same. For values beyond 127, the output is 63. The parameter is 4 bytes long. Here's a snippet of the 2 conversion functions I have used so far:

DoubleToHex:

Code:

Public Function ConvDoubleToHexString(dVal As Double, ByVal nByteCount As Integer) As String

Dim sHex As String
Dim sTmp As String
Dim n As Integer
Dim m As Long
Dim sRet As String
Dim nByteCountMerk As Integer

m=1
sHex = Hex(dVal)

nByteCountMerk = nByteCount
If nByteCount < Len(sHex) / 2 Then nByteCount = Len(sHex) / 2
If nByteCount < 1 Then nByteCount = 1

sHex = String(nByteCount * 2 - Len(sHex), "0") & sHex
For n = 0 To nByteCount - 1

sTmp = ChrW(Val("&H" & Mid(sHex, m, 2)))
m = m + 2
sRet = sRet & sTmp
next n

If Not bLH Then
ConvDoubleToHexString = Right(sRet, nByteCountMerk)
Else
For n = Len(sRet) To 1 Step -1
  sLH = sLH & Mid(sRet, n, 1)
Next n
ConvDoubleToHexString = Left(sLH, nByteCountMerk)
End If

End Function



HexToLong:


Code:

Public Function ConvHexStringToLong(sHex As String) As Long

Dim sHex As String
Dim sTmp As String
Dim n As Integer
Dim m As Long
Dim sRet As String
Dim nByteCountMerk As Integer

If sHex = "" Then
ConvHexStringToLongAbs = knolong
Exit Function
End If

For i = 1 To Len(sHex)
If l >= 8388608 Then
  ConvHexStringToLongAbs = knolong
  Exit Function
End If

l = l * 256 * 2
l = l + Asc(Mid(sHex, i, 1))
Next

ConvHexStringToLong = l

End Function


Play Midi Files on Ports

$
0
0
Hi there,
The problem has existed even before the MidiMapper was pulled for W8, whereby the use midiOutOpen for a given range of ports - e.g. coolsoft's, renders the mcisendstring functionality as useless. Mcisendstring makes its own calls on midioutopen, and if open, invariably returns a MCIERR_SEQ_PORT_INUSE.
After looking through this tutorial, the epiphany has come that a month of Sundays and then some will pass before we can ever produce code to play midi files "natively" in VB6- if it has ever been done at all.
It would be great news to know if there are any libraries or wrappers available for this purpose.
Any ideas & suggestions welcome.
Thanks for reading!

How to find out greater number from 10 values entered by the user using for next loop

$
0
0
I need to make a program for finding out the greater number among 10 numbers, that are entered by the user using only for.. next loop. Please help, I have an exam tomorrow and am very confused:confused:

[vbRichClient] Questions about cfLayoutView, cPanelLayout, cPanelDef

$
0
0
I'm want to explore the capabilities of these classes so I studied RC5FormsTutorial, and also a demo posted here named ModernAppWireFrame.
I specially like the automatic dimensions adjustment of the different panels (cPanelDef objects) inside the layout (cPanelLayout) and have some use for it, but I have a few doubts.
Is it possible to use it without Cairo.CreateLayoutView, I mean, using directly cPanelLayout and PanelLayout.DefinePanel? I tried everything but couldn't put it to work.

To test the automatic adjustment I used the tutorial #6 (Forms With Multiple PanelLayouts), and changed Form_BubblingEvent to increase a panel height in place of switching layouts:
Code:

View.PanelByKey("pnlToolBar").dy = View.PanelByKey("pnlToolBar").dy + 10
'View.PanelByKey("pnlToolBar").Refresh      ' this doesn't work
'View.CurLayout.Refresh                          ' this doesn't work either
View.SwitchToLayout View.CurLayout.Key  ' This works, and the layout is updated.

Just out of curiosity, Is there a reason for Cairo.CreateLayoutView to use a VB Collection instead of a cCollection?

The zip file downloaded from github is garbled, how to solve this problem?

Is there a new version of vhGrid?

$
0
0
Many years ago, Steppenwolfe developed an excellent control vhGrid. Unfortunately, this control was discontinued 10 years ago. I wonder if anyone else continues to develop new versions based on this excellent contro (vhGrid)?

The following is the link to the vhGrid source code:
http://www.planet-source-code.com/vb...67906&lngWId=1
Viewing all 21112 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>