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

Make Auto Update Software VB 6

$
0
0
Hello , im have application with VB 6
im need make a auto update , when this program open , this check version , and update this aplication , and if success download , updater automatic close , and open new software with new update version

can someone help me for make this ?

Caveat when short circuiting and setting compiler advanced optimizations.

$
0
0
Recently find out, that short circuiting 'works' differently, among the Windows versions.

Short circuiting for example;
Code:

If Len(text1.Text) And Len(text2.Text) Then
Works ok upto Windows 7, but does not work in Windows 2012 R2, haven't tested W8, W8.1 and W10.

Instead W12R2 needs explicit comparison.
Code:

If Len(text1.Text) > 0 And Len(text2.Text) > 0 Then
Perfectly working application, when compiled with advanced optimizations set, might crash when run in multiprocessor machine - happens at least in W12R2.

Usually...
Automation error -2147417848 (0x80010108), The object invoked has disconnected from its clients.

When 'Assume No Aliasing' is set.

Form caption - Centered in newer windows versions.

$
0
0
So 'MS has decided', that it is better to center form caption, hence asking does someone has an idea how to revert back application form captions, to left aligned?

Looked this, but found nothing from MSDN and elsewhere.

Get/Set Pixel in Bitmap StdPicture

$
0
0
So I have a StdPicture object, loaded with a bitmap image. Thus its Handle should be an HBITMAP.

In any case, I want to render this StdPicture with magnification onto a canvas with AutoRedraw = False. In this case the image is 200 x 160 and the canvas is a Form with a client area twice this size. I'm using the Render method of the StdPicture in the Form's Paint event.

I want to be able to "read" pixel colors and "write" pixel colors within the StdPicture. This means when the Form Paint event is raised the altered image is rendered.

Skeleton program attached. It is missing the "magic" for reading/writing a pixel, which I want to do in some manner outside of rendering to any controls or containers having hDCs. Here I only want to be able to read the pixel at (100, 100), change it to white, and be able to reverse this to put the original color back into the StdPicture.


If possible I want this to work correctly even if the screen is set to a color depth less than 24bpp, which is one reason I'm avoiding hDC operations. However there may be no way to do this without creating a 24bpp memory DC or something... but it seems like it ought to be fairly easy given that we have the HBITMAP to work with.

So clearly I'm missing something obvious.
Attached Files

VB6 OPTO22 MSFlexGrid

$
0
0
Below link was the scratch pad vb code that i found in opto22 website.
https://drive.google.com/file/d/0B8t...ew?usp=sharing

May I know how to change the value which i circled in red by using coding?
i use this code "Grid1.TextMatrix(1, 3) = Text2.Text" but the value was keep on overwrite by the original value.

and at the same time why the value cannot support decimal when i change it by double click and enter the new value?
eg. when i key in 10.6, it show 11

Name:  scratch pad interface.jpg
Views: 19
Size:  39.3 KB
Attached Images
 

vb6 vbrichclient cWebkit brower,how set cookies directory to custom directory

$
0
0
the default cookies directory

C:\Users\administrator\AppData\Roaming\Apple Computer\Cookies\

how set cookies directory to custom directory,like:

c:\mycookie\

i see then webkit.tlb

WebKit1.Navigate2 "http://www.google.com"

Navigate url now is ok.


Dim cookManger As WebCookieManager

cookManger.setCookieStorage "c:\mycookies"

cookManger.cookieStorage


WebCookieManager how to use?

how to set WebCookieManager with webkit1 browser?

BTW:

cWebkit can use proxy?(http,socks5)?

thanks.

Stop webbrowser control from stealing focus when navigating to a URL

get data from wsdl file is difference language.

$
0
0
Hello every body

I have my project about get data return from wsdl function by use difference in vb6.
I can get data from the function but It can not displey is thai language .
the data displey is "???"

help me please.

is there a way to delete a table Every Midnight without having a field Date?

$
0
0
i am trying to delete a table contents every midnight
but i dont have a field Date to make the query work
is there any way to do this?
this is the code i have now

Code:

Public DeleteTempCustsEveryMidnight As Boolean
    Dim TmpDate As Date
    TmpDate = Format(Now, "DD/MM/YYYY")
   


    Dim DateToday As Date
    DateToday = CDate(Date & " 00:01")
   
    If DeleteTempCustsEveryMidnight = True Then
        If TmpDate < Format(DateToday, "MM/DD/YYYY") Then
          StrSql = "Delete From TempCustomers"
          CN.Execute StrSql
        End If
    End If

Tnx for Any Help
salsa :)

Antivirus assume my program a virus

$
0
0
Hi
I am 17, from Iraq\kurdistan and I am developer
I had developed a mathematical program
The program is HUGE and cery good
BUT some antiviruses assume it as virus
VirusTotal assume it as virus 1/43
My avast antivirus not detect it as virus but when avast is enabled the program can't be run...

So please help ne fix the problem
I had created the program with vb6 and i used these ActiveX es:
-Codejock activex
-vbrichclient5.dll
-mathtype.ocx
-my own activexes plot.ocx and plot3d.ocx
-vb6 libraries

You can download my program from this blog(download link is on right side):

http://simplegrapher.blogspot.com

Kill a process (as seen in Task Manager) with SWbemServices - objProcess.Terminate

$
0
0
Hello, I am hoping someone can explain what is happening here with IE vs Notepad:
For test purposes:
I open 4 notepads, the task manager shows 4... OK, run the code - and the MsgBox's decrements make sense.
Then I open 4 IE's, the task manager shows 5 (dunno why)... run the code (change "WHERE Name" to ie of course)- the MsgBox's decrements go straight to 0 ???

I am doing this on/in:
> Excel 2003 (..it's what i have)
> VB 6.5
> Win 7 pro 64 bit

Now, If I take out the MsgBox's and the 'Exit For' & 'Goto' related code lines I get a "Not Found" Error at objProcess.Terminate - ONLY when I run it like this:

TEST
'code to open IE
TEST < error here
same in late binding as well....

So to summarize questions:
what's up with IE vs Notepad ?
is there another way to do this without a 'For' loop ?

Thanks in advance for helping me understand:)

just paste in a module and try...

Code:

Option Explicit

Sub TEST()
'https://msdn.microsoft.com/en-us/library/windows/desktop/aa394599%28v=vs.85%29.aspx
'add a reference to "Microsoft WMI Scripting 1.x Library" for early binding
    Dim objWMIService As WbemScripting.SWbemServices 'early binding
        'Dim objWMIService As SWbemServices 'early binding - works as well
            'Dim objWMIService As Object 'late binding
    Dim colProcessList As WbemScripting.SWbemObjectSet 'early binding
            'Dim colProcessList As Object 'late binding
    Dim objProcess As WbemScripting.SWbemObject 'early binding
            'Dim objProcess As Object 'late binding
    Dim strComputer As String: strComputer = "."
   
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
xxx:
    Set colProcessList = objWMIService.ExecQuery _
    ("SELECT * FROM Win32_Process WHERE Name = 'notepad.exe'") '    Name = '" & strProcName & "'")
                                            '  iexplore.exe    Name = 'myApplication.exe'")
   

    MsgBox "start count " & colProcessList.Count
   
    If colProcessList.Count > 0 Then
        For Each objProcess In colProcessList
        MsgBox "Process name: " & objProcess.Name
        MsgBox "before Terminate " & colProcessList.Count
        objProcess.Terminate
        MsgBox "after " & colProcessList.Count
        Exit For
        Next
        Set colProcessList = Nothing
        GoTo xxx
    Else
        MsgBox "Process Not Found"
    End If

    Set objWMIService = Nothing
    Set colProcessList = Nothing
End Sub

Infragistics PVDate control does not dropdown calendar on Windows server 2008 R2

$
0
0
Hi All
We are moving an old vb6 application to windows server 2008 R2. VB6 IDE is now installed on Windows 7.
We are using infragistics PVDate9.ocx for our date controls.
When compiling and running the application on the window7 computer, the control drops down the calendar. The same EXE when deployed on 2008 R2 does not drop down the calendar but other than that works OK. No error when clicking on the little arrow to the right of the control.

Infragistcs are of no help. They claim that it is not supported any more (makes sense - this control was published in 2001 or close).

Yes, we can replace this component with MS DatePicker (part of MSCOMCTL2.ocx) which works OK on 2008 but the behavior of the MS one is different. It has different properties and it does now allow for null or empty value which our code is relying on. The replacement will require many hours of diving into old code and rigorous testing.

I am looking for some ideas on why the pvdate control works on Windows 7 and not on 2008 server?
Thanks
Myalo

[RESOLVED] Kill a process (as seen in Task Manager) with SWbemServices - objProcess.Terminate

$
0
0
Hello, I am hoping someone can explain what is happening here with IE vs Notepad:
For test purposes:
I open 4 notepads, the task manager shows 4... OK, run the code - and the MsgBox's decrements make sense.
Then I open 4 IE's, the task manager shows 5 (dunno why)... run the code (change "WHERE Name" to ie of course)- the MsgBox's decrements go straight to 0 ???

I am doing this on/in:
> Excel 2003 (..it's what i have)
> VB 6.5
> Win 7 pro 64 bit

Now, If I take out the MsgBox's and the 'Exit For' & 'Goto' related code lines I get a "Not Found" Error at objProcess.Terminate - ONLY when I run it like this:

TEST
'code to open IE
TEST < error here
same in late binding as well....

So to summarize questions:
what's up with IE vs Notepad ?
is there another way to do this without a 'For' loop ?

Thanks in advance for helping me understand:)

just paste in a module and try...

Code:

Option Explicit

Sub TEST()
'https://msdn.microsoft.com/en-us/library/windows/desktop/aa394599%28v=vs.85%29.aspx
'add a reference to "Microsoft WMI Scripting 1.x Library" for early binding
    Dim objWMIService As WbemScripting.SWbemServices 'early binding
        'Dim objWMIService As SWbemServices 'early binding - works as well
            'Dim objWMIService As Object 'late binding
    Dim colProcessList As WbemScripting.SWbemObjectSet 'early binding
            'Dim colProcessList As Object 'late binding
    Dim objProcess As WbemScripting.SWbemObject 'early binding
            'Dim objProcess As Object 'late binding
    Dim strComputer As String: strComputer = "."
   
    Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
xxx:
    Set colProcessList = objWMIService.ExecQuery _
    ("SELECT * FROM Win32_Process WHERE Name = 'notepad.exe'") '    Name = '" & strProcName & "'")
                                            '  iexplore.exe    Name = 'myApplication.exe'")
   

    MsgBox "start count " & colProcessList.Count
   
    If colProcessList.Count > 0 Then
        For Each objProcess In colProcessList
        MsgBox "Process name: " & objProcess.Name
        MsgBox "before Terminate " & colProcessList.Count
        objProcess.Terminate
        MsgBox "after " & colProcessList.Count
        Exit For
        Next
        Set colProcessList = Nothing
        GoTo xxx
    Else
        MsgBox "Process Not Found"
    End If

    Set objWMIService = Nothing
    Set colProcessList = Nothing
End Sub

Sqlite

$
0
0
Hi
Can VB6 database app use SQLITE or another embedded SQL server ?
Elico

ListView question

$
0
0
Does a ListView ListItem have a handle

I see where a TreeView node has a handle so I was just wondering if same for ListView

Write a constante value inside a dll (a path to ADO)

$
0
0
Hi to all

First of all im new at vb6/dll development so please bear with me.
I writing a activex dll for excel with some functions on of which needs a path to run (ADO to a file)

So, how can a write that path inside my dll (trough a form or whatever.. not the point...), so my function can run, and the user can change that path if he wants...

This is probably vb6 101 but i really need some pointers here!

Thanks a lot
Jorge

last entries

$
0
0
I have this DTR record. Employees have daily IN and OUT.

I have this query select dtrdate,empid from DTR group by dtrdate desc,empid order by dtrdate desc limit 1 on mysql db.
the problem with this is I get only for one employee. What I need to achieve is to get the last IN entries for all the employees.


On ms access, I think that is Last().
What is the proper way of the sql statement.

Run-time Error '52' Bad File Name or Number and Run-tim Error '35012'

$
0
0
Hi everyone. I got these errors when I run my program. Can you please give me an direction how to fix it. I tried to import data from database and it show run-time error '52', I clicked on debug but it didn't go to debug screen then I exist the program and it show run-time error '35012'. Here is the code that I have. It used to work without any problem. Thank you.
[Code]
Sub ImportD11()
Dim LocationArray(3, 1)
'On Error GoTo ErrorFound
Open "C:\sbms\obj\reports\sips0003.nff" For Input As #1
'Line 1 (Crap)
Line Input #1, TmpString
'Line 2 (Date)
Line Input #1, TmpString
TmpString = Right(Trim(TmpString), 11)
Range("B1").Value = Left(TmpString, 6) + ", " + Right(TmpString, 4)
Range("B1").NumberFormat = "mm/dd/yyyy"
CurrentDate = Range("B1").Text
'First Record of Location File is Jan 1, 2002. 2nd is Jan 2nd, 2002... etc... etc...
Open ThisWorkbook.Path + "\" + LocationDB For Random As #5 Len = LocationLen
LocationRecord = DateDiff("d", "01/01/2002", CurrentDate) + 1
'Check to see whether current date has been run already
If LocationRecord <= LOF(5) / LocationLen Then
Get #5, LocationRecord, LocationString
If Val(Mid(LocationString, 11, 7)) > 0 Then
MsgBox ("This D11 has already been imported.")
GoTo ErrorFound
End If
End If
'Line 3 (Date Generated)
Line Input #1, TmpString
If DateValue(CurrentDate) >= DateValue(Left(Trim(TmpString), 11)) Then
MsgBox ("D11 run on same date or for a future date. Please run this again later.")
GoTo ErrorFound
End If
'Line 4 (Report Type)
Line Input #1, TmpString
If Left(Trim(TmpString), 12) <> "ALL PRODUCTS" Then
MsgBox ("Please run a Normal D11 for All Beer Products and try again.")
GoTo ErrorFound
End If

'User override
Range("B1").NumberFormat = "mmmm d, yyyy"
If MsgBox("Continue with " + Range("B1").Text, vbYesNo, "Import this D11?") = vbNo Then GoTo ErrorFound

'Identify Date and put in Starting Record #'s
ChDir ThisWorkbook.Path
Open ThisWorkbook.Path + "\" + FGDB For Random As #2 Len = FGRecLen
LocationArray(1, 0) = LOF(2) / FGRecLen + 1
FGRec = LocationArray(1, 0)
Open ThisWorkbook.Path + "\" + SKUDB For Random As #3 Len = SKURecLen
LocationArray(2, 0) = LOF(3) / SKURecLen + 1
SKURec = LocationArray(2, 0)
Open ThisWorkbook.Path + "\" + DollarDB For Random As #4 Len = DollarRecLen
LocationArray(3, 0) = LOF(4) / DollarRecLen + 1
DollarRec = LocationArray(3, 0)

RecordType = "FG"
Do Until EOF(1)
Line Input #1, TmpString
If Val(Left(Trim(TmpString), 3)) > 0 And Mid(Trim(TmpString), 3, 1) <> "-" Then
Select Case RecordType
Case "FG"
If Len(Trim(Left(TmpString, 4))) = 4 Then
CurrentName = TmpString
Else
FGString = CurrentDate + Left(CurrentName + Space(39), 39) + Left(TmpString + Space(111), 111)
Put #2, FGRec, FGString
FGRec = FGRec + 1
End If
Case "SKU"
SKUString = CurrentDate + Left(TmpString + Space(130), 130)
Put #3, SKURec, SKUString
SKURec = SKURec + 1
End Select
ElseIf Left(Trim(TmpString), 27) = "===== Package Summary =====" Then
RecordType = "SKU"
ElseIf Left(Trim(TmpString), 4) = "MEMO" Then
'I probably don't need to change the RecordType
'Most likely best to simply create the Dollar Record here
'RecordType = "DOLLAR"
TmpDollarString = CurrentDate
Range("B2").Value = Right(TmpString, 16)
Range("B2").NumberFormat = "0.00"
TmpDollarString = TmpDollarString + Left(Range("B2").Text + Space(15), 15)
Do
Line Input #1, TmpString
Loop Until Left(Trim(TmpString), 5) = "Value"
Range("B2").Value = Right(TmpString, 16)
Range("B2").NumberFormat = "0.00"
TmpDollarString = TmpDollarString + Left(Range("B2").Text + Space(15), 15)
Do
Line Input #1, TmpString
Loop Until Left(Trim(TmpString), 5) = "Value"
Range("B2").Value = Right(TmpString, 16)
Range("B2").NumberFormat = "0.00"
TmpDollarString = TmpDollarString + Left(Range("B2").Text + Space(15), 15)
DollarString = Left(TmpDollarString, DollarRecLen)
Put #4, DollarRec, DollarString
Exit Do
End If
Loop

'Identify Date and put in End Record #'s
LocationArray(1, 1) = FGRec - 1
LocationArray(2, 1) = SKURec - 1
LocationArray(3, 1) = DollarRec
LocationString = CurrentDate + Left(TS(LocationArray(1, 0)) + Space(7), 7) + Left(TS(LocationArray(1, 1)) + Space(7), 7) _
+ Left(TS(LocationArray(2, 0)) + Space(7), 7) + Left(TS(LocationArray(2, 1)) + Space(7), 7) _
+ Left(TS(LocationArray(3, 0)) + Space(7), 7) + Left(TS(LocationArray(3, 1)) + Space(7), 7)
Put #5, LocationRecord, LocationString
Close
Exit Sub
ErrorFound:
Select Case Err.Number
Case 0
Case Else
MsgBox Err.Description
End Select
Close
End Sub
[Code].

VB6 enduser app under win7 and up

$
0
0
Hi all

I use vb6 under WINXP os.

Will the enduserapp.exe work well under win7/8/10 os ?

Thanks
Elico

Detect if a created class still exists

$
0
0
Hi,

My program creates several instances of a class, and the user may at any time destroy an instance.
I need a method of determining if a class still exists.

In a module I have
Code:

Public Events() as New MyEvents
I have a class module named MyEvents.
Within the class module are several functions including CreateEvent and DeleteEvent.

In a Form, I have a routine that retrieves the data from a selected Event(x) and presents the data in several listboxes.

The problem is if the Event(x) has been deleted (set to = Nothing), and an attempt is made to retrieve data from that deleted Event(x), an error occurs: Run-time error '13': Type mismatch.
This is because the instance of the referenced Event(x) no longer exists.

So, my question is:
How do I test to see if the instance of Event(x) still exists?

I've tried testing for
Code:

<>Nothing
and
Code:

Is Not Nothing
.
I don't know what else to try.

Can someone assist?
Thanks!
Viewing all 21227 articles
Browse latest View live


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