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

click and re-click to sort items in listview

$
0
0
i need to sort listitem in list view by column, with a click and reclick on alabel1

first click in descendet and if i re-click in ascendent

how to?

note:
- the column is the number 9 in list view
- the value in column 9 are similar: 00001,00045, ...47898 (i just format the the value before to put in cells of listview with format(value,"#00000")

Installing VB6 on Win 10

$
0
0
I'm trying to install VB6 Professional on a fresh Windows 10 machine and the installation wouldn't complete. It got to the end, at updating system files, and hung ("Not Responding"). Is there anything special I need to do to get this done?

Thanks.

windows service with winsock

$
0
0
Hi!

I have a application.

This is code.
*******************

Private Sub Form_Load()
Winsock1.Protocol = sckUDPProtocol
Winsock1.LocalPort = 514
Winsock1.Bind
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
On Error Resume Next
Dim data As String
Winsock1.GetData data
text1.Text = text1.Text & data & vbCrLf
End Sub

Exe name is serv.exe

Shell "sc create DLT_LOG binpath= c:\SERV.EXE start= auto ", vbHide
Shell "sc stop DLT_LOG", vbHide

I added to windows services with theese codes. but it is not start. it is giving me error 1053

i tried manual . same error

can you help me

sorry for my english

WNetAddConnection2 run-as and shows Red x

$
0
0
I have a program that opens a notepad and I used WNetAddConnection2 API to map a drive and network. It's working fine, but when I do a runas on my program as another user that's NOT logged into the system, my program opens notepad correctly. However, when I do "save as" and click Computer, it shows Red x next to drive. Is there a way to resolve this? Or is there a way to change that drive icon from red to green?

[RESOLVED] reduce flicker?

$
0
0
when drawing on the form, i get a lot of flicker. i've done some google searching, but cant seem to correct the problem.

any ideas?

Bit Manipulation - Need help find a better method than this function i am using.

$
0
0
Ok, I have been away from programming for a good while. I decided to mess around with it the other day and create something, and I wrote a function that seems sloppy. I cant seem to figure out how to optimize it to get rid of the loop. I do not want to post the massive code I am working on to get help with this, so I made a small sample.

This sample searches a number to find if it has certain bits flagged. My issue is not with finding the bits, because that is working. My issue here is that I do believe there is a faster way to do this without the looping if possible, or having one line of code in the loop. After a few hours of getting nowhere I decided to post here and see if we can come up with something simple to use rather than this over-coded function.

Also just to Note... The sample below is using a 16 bit value, I do plan to use a 32bit value, I also may not be using a 4 bit search. An 8 bit or 16 bit would work better for me. This is why part of the reason I want to make the function simple.

Another Note... there will only be a single match for that searched value, don't worry about having to look for multiples.

Code:

'Notes for this example:
'
'pValue is the number I want to search
'pSearch is a 4 bit value I want to use to search in pValue
'
'Edit:  There will actually be 19 bits here instead of 16 bits in this code.
'200 in base 2 is 0000000011001000  (as 16 bits)
'12 in base 2 is 1100
'
'The function will return 5, which is the offset of the rightmost bit we are looking for.
'

Private Sub Form_Load()

    MsgBox IsNumberWithinNumber(200, 12)

End Sub

Private Function IsNumberWithinNumber(ByVal pValue As Long, ByVal pSearch As Long) As Long
   
    Dim i As Long
    Dim lbits As Long
   
    For i = 0 To 15
        If (pValue And (2 ^ i)) Then lbits = lbits + 1
        If (pValue And (2 ^ (i + 1))) Then lbits = lbits + 2
        If (pValue And (2 ^ (i + 2))) Then lbits = lbits + 4
        If (pValue And (2 ^ (i + 3))) Then lbits = lbits + 8
       
        If lbits = pSearch Then
            IsNumberWithinNumber = i + 1
            Exit For
        End If
        lbits = 0
    Next i

End Function

sending notepad to command prompt window that's hidden

$
0
0
Hi all is it possible to accomplish this?

I have a program that does runas on other program, for example cmd.exe
I want to call that cmd.exe using my runas program. Once it's launched, I want it to be hidden and behind the scene I send "Notepad" to it so that it launches notepad for me. Is this possible with vb6?

VB6 Overflow error

$
0
0
Dear All,

we are facing an issue with one of our old VB Application. recently our company operating system changed to window 10 and after that we have re-installed the application ..after 2 days when we tried to login the system it's giving an error message "OVERFLOW".. when we tried to restore the BACK UP (SQL server) it worked for one day and after that again same error message "OVERFLOW" any idea what is this issue.

Shell problem

$
0
0
Hi,
Could you tell me why these 2 lines run very well
Code:

lngPid = ShellExecute(0, "Open", "C:\Temp\Package\setup.exe", vbNullString, vbNullString, 2)
lngPid = Shell("notepad.exe", vbNormalFocus)

but this one
Code:

lngPid = Shell("C:\Temp\Package\setup.exe", vbNormalFocus)
give an error 5 "Invalid procedure call or argument" ?

Replacing .INI KEY (not it's value) with an Updated Key?

$
0
0
Hi, are there any fast ways to replace an existing .INI KEY (not it's value to the right of the equal sign)?
For example, the key might be MedicalRecord[170].Name="Joe Smith"
And I need to update the KEY to be something like MedicalRecord[179].Name="Joe Smith"

Any ways to do this using the API calls (e.g., WritePrivateProfileString) or would I have to loop through the entire file and use some sort of replacement strategy on the original key first, etc.?

Would love to be able to simply call the section and replace one key with another key...any ideas?

Thanks in advance for your help!

can i add the win api functions to Instelligence List?

$
0
0
is there any add-in or dll for i add on a project for i see the win api functions\enum\const's on Intelligence List?

[RESOLVED] Lf, Cr, CrLf makes MS Word line spacing double when sent from VB6

$
0
0
Trying to save short lines (names, addresses, etc) using the Word Object in VB6.
Tried vbLf, vbCr, vbCrLf (and vbNewLine), but each always ends up sending a Carriage Return (guess that is what you might call it)....anyway, it looks like this:

Name:  symbol1.JPG
Views: 35
Size:  7.9 KB

What I want (need) is THIS symbol (in Word):

Name:  symbol2.JPG
Views: 33
Size:  7.8 KB

The REASON I (think I) need this, is when I view the resulting Word document and view special characters, I get that first image. If I change it manually in Word to the second image, all is fine. When I set line spacing to SINGLE in VB6 for Word, and I don't send actual CRs, LFs, etc, I GET single line spacing (like in a long paragraph), but when I send any of these formatted characters to Word, I get 1.5 (or double, hard to tell) line spacing. I then have to manually set the Spacing After (in Word) to 0, as it always defaults to an 8 when those characters are sent from VB6.

I know it is confusing, but I am at a loss on how to prevent 'double' spacing in my Word Doc even though I have sent Single Spacing commands...it occurs when I send any of those characters.
Attached Images
  

How do i get HKEY_USERS string to listbox

$
0
0


as you can se the long number under
HKEY_USERS 1000 and 1000_classes
how do i get these 2 values to listbox

How can I store the process date into a SQLite database?

$
0
0
Hi.
How can I store the process date into a SQLite database?
By process date, I mean the exact date and time that the process starts (for example, it can be derived from the VB6 function Now()).
One way of doing it (using SetText) is like this:
Code:

  sql = "Insert Into Process_DTL ( USER_NAME, PROCESS_DATE ) Values (?, ?)"
  Set Cmd = Cnn.CreateCommand(sql)
 
  Cnn.Synchronous = False
  Cnn.BeginTrans
      Cmd.SetText 1, sUserName
      Cmd.SetText 2, Format(Now(), "mmm-dd-yyyy@hh:mm")
     
      Cmd.Execute
  Cnn.CommitTrans
  Cnn.Synchronous = True

In the above example, obviously I have declared the column PROCESS_DATE to be of type TEXT in the table definition.
But, I don't think it is good to use a text column for a date.
How can I use SetDate? What value instead of Format(Now(), "mmm-dd-yyyy@hh:mm") would I have to pass to it?
And in that case, in what data type should I declare the column PROCESS_DATE in the table definition?
Thanks.

where can i find vb6 addins?

$
0
0
where can i find freee vb6 addins?
i need 1 that separe my project components using tabs. some tools aren't free.

Renaming a file in a file list box by right-clicking it

$
0
0
The title says it all really. I'm trying to rename files in a file listbox by right-clicking on each file separately as the occasion arises. I've already written code that brings up a floating menu with 'Rename' and 'Cancel' in it when I right-click on any file in the listbox so that part of the operation is working fine. The problem is that the MouseDown (or MouseUp) event for file list boxes doesn't acknowledge the ListIndex property so when I right-click on any file in the box, and bring up the file's ListIndex value in a message box, it is always -1 - or at least that's what I'm finding. Interestingly, it recognises the listbox's ListCount property but that is of little help. The renaming of the files will be the usual Name OldFilename As NewFilename, with filepaths.

Any suggestions always welcome and thanks in advance.

How Pause and restart OneDrive synchronization?

$
0
0
If anybody has done this from VB6, I would really appreciate the code!

Glass Form in windows 10

$
0
0
Hi guys

Dose any body knows how to use DwmExtendFrameIntoClientArea in windows 10
I found some examples on the internet but they don't work in windows 10

Difference between two dates

$
0
0
Hello VBForums
Hello everyone
Please if you can help me to resolve this problem
How to calculate the difference between two dates
First date in Text1
Second date in Text2
The result in Text3 by years ans month and days for example ( 25 years 10 months 14 days )
Thank you in advance for help me
Cordially
MADA

Keys Management for Grid's Rows

$
0
0
I have applied a KeyManager for a Grid Control. But if the Grid loads millions of records, the Key management is obviously lagging or killing the whole system when I set .KeyIsUnique = True. The concept of Key management is:
SetRowKey function --> Calculate .Hash of Key --> increase Keys() array (Type member: .Hash and .Index) by 1 --> BinarySearch the right Position (actually Sort in ASC)--> insert to the Pos

0 -843663419 4
1 -843597883 3
2 -843532347 2
3 -843466811 1
4 -843401275 0
5 -788455970 5

I noticed the binarySearch is the major reason caused lagging.
Imaging the millions size of Keys(), the BinarySearch for single Key could loop thousands of times. If we add one million Key at one time, the CPU is too busy to lost response.

Code:

For n = 1 To 1000000 
    Grid1.Row(n).Key = "Row" & CStr(n)  'call SetRowKey function
Next

I check some commercial Grid control, they also had such problem. It seems no solution. But what is the better way to apply Key management?
Viewing all 21303 articles
Browse latest View live


Latest Images