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

Open URL in new IE Window without Address Bar (and enter Login Details)

$
0
0
I'm trying to write a VB Script to open the following URL:

https://test-www.tax.service.gov.uk/...oauth-frontend

I've got two problems. Firstly my script just opens a new Tab in an existing IE, with Address Bar etc. I'd like it to open a New Window without the AddressBar, StatusBar, ToolBar, MenuBar etc.

Secondly I'd like the two input boxes to be filled in (and better still would be to fill them in and click submit).

I've written the below code but the only bit that works is to open the URL (which will be a variable).

Code:

set vURL = "https://test-www.tax.service.gov.uk/api-test-login/sign-in?continue=%2Foauth%2Fgrantscope%3Fauth_id%3D5ac74dbb260000260070a36b&origin=oauth-frontend"
  Set ieApp = CreateObject("Internetexplorer.Application")
    ieApp.Visible = True
    ieApp.Navigate vURL.GetContent.String
    ieApp.AddressBar = 0
    ieApp.StatusBar = 0
    ieApp.Toolbar = 0
    ieApp.MenuBar = 0
    ieApp.Height = 500
    ieApp.Width = 400
         
    With ieApp.Document
    .getElementByID("userId").value = "testing"
    .getElementByID("password").value = "testpass"
'    .getElementByID("form").submit
  End With

n.b. I'm doing this in QlikView which is currently shipped with VBScript version 3.1.

[RESOLVED] SelfCallback (Caton/LaVolpe); identical set-up works in one UC but not other

$
0
0
So I'm trying to use the ssc_SetCallbackAddr from the 2.0 LaVolpe re-write of the selfsubclass routines in a UserControl, and it works fine in the project I based it on, works fine in a basic, empty project, but then fails with a 'Callback address not found' error in my full project. I tried disabling all the other subclassing in case that interfered, but no help. What could cause it to fail like this?

Code:

Public Function testcb() As Long
 m_cbSort = scb_SetCallbackAddr(3, 2)
testcb = m_cbSort
End Function
Public Function LVSortProc(lParam1 As Long, lParam2 As Long, lParamSort As Long) As Long
Dim hr As Long

        LVSortProc = -1 

End Function
Public Function somefunction(szSys As String) As Long

End Function

that's the end of the UserControl in both cases, and both have the full standard self-subclass/self-callback code, with no other parts of it being used. I put the UC where it was working into the main project, and it still works there, but not in the other UC.

Edit: Attaching the project... it's for my shell browser control; I added the UC where it's working to the standard current release, with the same setup to test. I don't know how to simplify it more. The Demo project loads both controls and the command button has debug output that can switch between them.
Attached Files

[RESOLVED] GetSaveFileNameW API and supplying "default" file name

$
0
0
Good morning,

I've always tried to keep my Open File and Save File dialogs fairly simple, as typically, I have little need for these.

However, I'm working on my little PNG utility, and now I need it a bit more fancy.

Here's what I want. I want my Save File dialog to put in a "default" file name, and not be blank. I did a quick search (not thorough) of the CodeBank, and didn't find what I was looking for.

Here's the ShowSaveFileDialog wrapper I'm currently using for my little utility. I really don't want some radical new approach to this. I just want to "fix" this to do what I want. Will I need to dive into the lpfnHook to get this done?

Code:


Option Explicit
'
Public Const MAX_PATH_W = 1024  ' This can actually go as high as 32767, but it's set at this to preserve a bit of memory.
'
' These are used to get information about how the dialog went.
Public FileDialogSpec As String            ' Used for both Open & Save.
Public FileDialogFolder As String          ' Used for both Open & Save.
Public FileDialogName As String            ' Used for both Open & Save.
Public FileDialogSuccessful As Boolean      ' Used for both Open & Save.
'
Private Type OpenSaveType
    lStructSize As Long
    hwndOwner As Long
    hInstance As Long
    lpstrFilter As String
    lpstrCustomFilter As String
    nMaxCustFilter As Long
    nFilterIndex As Long
    lpstrFile As String
    nMaxFile As Long
    lpstrFileTitle As String
    nMaxFileTitle As Long
    lpstrInitialDir As String
    lpstrTitle As String
    flags As Long
    nFileOffset As Integer
    nFileExtension As Integer
    lpstrDefExt As String
    lCustData As Long
    lpfnHook As Long
    lpTemplateName As String
End Type
'
Public Enum FileDialogFlags
    OFN_READONLY = &H1
    OFN_OVERWRITEPROMPT = &H2
    OFN_HIDEREADONLY = &H4
    OFN_NOCHANGEDIR = &H8
    OFN_SHOWHELP = &H10
    OFN_ENABLEHOOK = &H20
    OFN_ENABLETEMPLATE = &H40
    OFN_ENABLETEMPLATEHANDLE = &H80
    OFN_NOVALIDATE = &H100
    OFN_ALLOWMULTISELECT = &H200
    OFN_EXTENSIONDIFFERENT = &H400
    OFN_PATHMUSTEXIST = &H800
    OFN_FILEMUSTEXIST = &H1000
    OFN_CREATEPROMPT = &H2000
    OFN_SHAREAWARE = &H4000
    OFN_NOREADONLYRETURN = &H8000
    OFN_NOTESTFILECREATE = &H10000
    OFN_NONETWORKBUTTON = &H20000
    OFN_NOLONGNAMES = &H40000        '  force no long names for 4.x modules
    OFN_EXPLORER = &H80000            '  new look commdlg
    OFN_NODEREFERENCELINKS = &H100000
    OFN_LONGNAMES = &H200000          '  force long names for 3.x modules
End Enum
#If False Then ' Intellisense fix.
    Public OFN_READONLY, OFN_OVERWRITEPROMPT, OFN_HIDEREADONLY, OFN_NOCHANGEDIR, OFN_SHOWHELP, OFN_ENABLEHOOK, OFN_ENABLETEMPLATE, OFN_ENABLETEMPLATEHANDLE, OFN_NOVALIDATE, OFN_ALLOWMULTISELECT, OFN_EXTENSIONDIFFERENT, OFN_PATHMUSTEXIST, OFN_FILEMUSTEXIST
    Public OFN_CREATEPROMPT, OFN_SHAREAWARE, OFN_NOREADONLYRETURN, OFN_NOTESTFILECREATE, OFN_NONETWORKBUTTON, OFN_NOLONGNAMES, OFN_EXPLORER, OFN_NODEREFERENCELINKS, OFN_LONGNAMES
#End If
'
Private Declare Function GetSaveFileNameW Lib "comdlg32.dll" (ByVal pOpenfilename As Long) As Long
'

Public Sub ShowSaveFileDialog(hwndOwner As Long, FileFilter As String, Optional InitialFolder As String, Optional flags As FileDialogFlags, Optional Title As String = "Save File")
    ' See "Public" variables for what is set upon return.
    Dim SaveFile As OpenSaveType
    Dim l As Long
    '
    SaveFile.lStructSize = LenB(SaveFile)
    SaveFile.hwndOwner = hwndOwner
    SaveFile.hInstance = App.hInstance
    SaveFile.lpstrFilter = FileFilter
    SaveFile.nFilterIndex = 1
    SaveFile.lpstrFile = String$(MAX_PATH_W, 0)
    SaveFile.nMaxFile = MAX_PATH_W
    SaveFile.lpstrFileTitle = vbNullString
    SaveFile.nMaxFileTitle = 0
    SaveFile.lpstrInitialDir = InitialFolder
    SaveFile.lpstrTitle = Title
    SaveFile.flags = flags
    '
    l = GetSaveFileNameW(VarPtr(SaveFile))
    If l = 0 Then
        FileDialogSpec = "none"
        FileDialogFolder = vbNullString
        FileDialogName = vbNullString
        FileDialogSuccessful = False
    Else
        FileDialogSpec = RTrimNull(SaveFile.lpstrFile)
        FileDialogFolder = Left$(FileDialogSpec, InStrRev(FileDialogSpec, "\"))
        FileDialogName = Mid$(FileDialogSpec, InStrRev(FileDialogSpec, "\") + 1)
        FileDialogSuccessful = True
    End If
End Sub

Public Function RTrimNull(s As String) As String
    Dim i As Integer
    i = InStr(s, vbNullChar)
    If i Then
        RTrimNull = Left$(s, i - 1)
    Else
        RTrimNull = s
    End If
End Function

Thanks,
Elroy

[RESOLVED] ChooseColorAPI and double-click

$
0
0
And while I'm at it, here's another pet peeve. I use ChooseColorAPI in my little utility, but it's not allowing me to double-click a chosen color. Has this thing always worked that way? Is there another approach that would allow a double-click of a chosen color?

Here's what I'm using.

Code:


Option Explicit
'
Public ColorDialogSuccessful As Boolean
Public ColorDialogColor As Long
'
Private Type ChooseColorType
    lStructSize As Long
    hwndOwner As Long
    hInstance As Long
    rgbResult As Long
    lpCustColors As String
    flags As Long
    lCustData As Long
    lpfnHook As Long
    lpTemplateName As String
End Type
'
Private Declare Function ChooseColorAPI Lib "comdlg32.dll" Alias "ChooseColorA" (pChoosecolor As ChooseColorType) As Long
'

Public Function ShowColorDialog(hwndOwner As Long, Optional NewColor As Long) As Boolean
    ' You can optionally use ColorDialogSuccessful & ColorDialogColor or the return of ShowColorDialog and NewColor.  They will be the same.
    '
    Dim uChooseColor As ChooseColorType
    Dim CustomColors(15) As Long
    '
    uChooseColor.hwndOwner = hwndOwner
    uChooseColor.lpCustColors = VarPtr(CustomColors(0))
    uChooseColor.flags = 0&
    uChooseColor.hInstance = App.hInstance
    uChooseColor.lStructSize = LenB(uChooseColor)
    '
    ColorDialogSuccessful = False
    If ChooseColorAPI(uChooseColor) = 0 Then Exit Function
    If uChooseColor.rgbResult > &HFFFFFF Then Exit Function
    '
    ColorDialogColor = uChooseColor.rgbResult
    NewColor = uChooseColor.rgbResult
    ColorDialogSuccessful = True
    ShowColorDialog = True
End Function


Thanks,
Elroy

EDIT1: Here, you can just throw the above into a BAS module, and then the following into Form1 to test, if you like:

Code:


Option Explicit

Private Sub Form_DblClick()
    ShowColorDialog Me.hWnd
End Sub


VbRichClient5 and SQLite datatype (episode 2)

$
0
0
Hi for all.

I have used the CConnection and CRecordset objects of VBRichClien54 successfully.
But I met a small problem that I do not understand.
This is the code (based on Olaf Schmidt example)
Code:

Option Explicit

Private oCn As vbRichClient5.cConnection
 
Private Sub cmdCommand1_Click()
  PrintRsFieldTypes oCn.OpenRecordset("Select * From myTable")

End Sub

Private Sub Form_Load()
  Set oCn = New_c.Connection(, DBCreateInMemory)
      oCn.Execute "CREATE TABLE MyTable(ID INTEGER PRIMARY KEY, Name TEXT, myDate DATE, Timestamp DATETIME current_timestamp)"
End Sub
 
Private Sub PrintRsFieldTypes(oRs As cRecordset)
  Dim oFld As vbRichClient5.cField
  For Each oFld In oRs.Fields
    Select Case oFld.ColumnType
      Case FieldType.SQLite_BLOB:                Debug.Print oFld.Name & " " & "SQLite_BLOB"
      Case FieldType.SQLite_DOUBLE:              Debug.Print oFld.Name & " " & "SQLite_DOUBLE"
      Case FieldType.SQLite_INTEGER:            Debug.Print oFld.Name & " " & "SQLite_INTEGER"
      Case FieldType.SQLite_NULL:                Debug.Print oFld.Name & " " & "SQLite_NULL"
      Case FieldType.SQLite_TEXT:                Debug.Print oFld.Name & " " & "SQLite_TEXT"
      Case FieldType.VB_Boolean_AutoConverted:  Debug.Print oFld.Name & " " & "VB_Boolean_AutoConverted"
      Case FieldType.VB_DATE_AutoConverted:      Debug.Print oFld.Name & " " & "VB_DATE_AutoConverted"
      Case FieldType.VB_ShortDate_AutoConverted: Debug.Print oFld.Name & " " & "VB_ShortDate_AutoConverted"
      Case FieldType.VB_Time_AutoConverted:      Debug.Print oFld.Name & " " & "VB_Time_AutoConverted"
      Case Else:                                Debug.Print oFld.Name & " " & oFld.ColumnType
    End Select
  Next
End Sub

this is the output debug window
Name:  Immagine3.png
Views: 51
Size:  2.2 KB
Why the fileld myDate is identify as VB_DATE_AutoConverted and not as VB_ShortDate_AutoConverted?
Why the fileld Timestamp is identify as VB_DATE_AutoConverted and not as VB_Time_AutoConverted?
Thanks
Attached Images
 

VB - Editing Filenames in Folders AND Subfolders - Help!

$
0
0
Greetings All,

I'm an extreme beginner when it comes to VB. I'm trying to write a script that removes certain characters from files within folders. I have code that removes the characters from files within a single folder, but I'd like to modify it such that it automatically tackles sub folders as well (and preferably sub-sub folders as well). I've been trying to merge code from script that changes the characters with script that simply lists the subfolders. Needless to say I haven't gotten it yet and I thought it might be something relatively simple I've been missing. Any help you could provide would be most greatly appreciated.

Thanks in Advance!
David

Code:

Sub ShowFolderList("C:\Users\dejohnson\Desktop\test")
    Dim fs, f, f1, s, sf
    Set fs = CreateObject("Scripting.FileSystemObject")
    Set f = fs.GetFolder("C:\Users\dejohnson\Desktop\test")
    Set sf = f.SubFolders
    For Each f1 in sf

        Set objFso = CreateObject("Scripting.FileSystemObject")
        'Set Folder = objFSO.GetFolder("C:\Users\dejohnson\Desktop\test")

        For Each File In f.sf
            sNewFile = File.Name
            sNewFile = Replace(sNewFile,"%"," ")
            sNewFile = Replace(sNewFile,"&"," ")
            sNewFile = Replace(sNewFile,"?"," ")
            sNewFile = Replace(sNewFile,"<"," ")
            sNewFile = Replace(sNewFile,">"," ")
            sNewFile = Replace(sNewFile,"#"," ")
            sNewFile = Replace(sNewFile,"{"," ")
            sNewFile = Replace(sNewFile,"}"," ")
            sNewFile = Replace(sNewFile,"~"," ")
            sNewFile = Replace(sNewFile,"/"," ")
            sNewFile = Replace(sNewFile,"\"," ")
            if (sNewFile<>File.Name) then
                File.Move(File.ParentFolder+"\"+sNewFile)
            end if

        Next
    Next
End Sub

How to rename specify folder's name in all sub folders?

$
0
0
Dear all expert programmers,
I want to rename folder's name in all sub folders.

Example : Main folder is "c:\temp-app"
c:\temp-app
c:\temp-app\Test-1
c:\temp-app\Test-1\Test-001\Test-007
c:\temp-app\Test-1\Test-001\Test-002
c:\temp-app\Test-2
c:\temp-app\Test-2\Test-002

I want to rename folder name "Test-002" to "Export", result will be
c:\temp-app
c:\temp-app\Test-1
c:\temp-app\Test-1\Test-001\Test-007
c:\temp-app\Test-1\Test-001\Export
c:\temp-app\Test-2
c:\temp-app\Test-2\Export

Please help me for this job.

Thank you for all post.

How to print DataReport in SQLite

$
0
0
Hello everyone
This is how I was connecting DataReport datasource in Access
Code:

strSQL = "select * from Person_tbl inner join Transac_tbl on Person_tbl .ID = Transac_tbl.PID WHERE " & _
          "PID=" & Txt_ID.Text & ";"
    Set RS = cnn.OpenRecordset(strSQL)
    If Not RS.EOF Then
    Set DataReport1.DataSource = RS
    DataReport1.Show
    DataReport1.Refresh
DataReport1.Sections("Section1").Controls("text1").DataField = "Nom"
DataReport1.Sections("Section1").Controls("text2").DataField = "Prenom"
DataReport1.Sections("Section1").Controls("text3").DataField = "Tel"
DataReport1.Sections("Section1").Controls("text4").DataField = "Birthdate"

Code:

With SQLite, I'm getting Type mismatch error on this line:
Set DataReport1.DataSource = RS

Thank you for any help.

Why is 64 bit Integer slower than Currency calculations

$
0
0
64 bit integer calculations can be useful for manipulating Large_integer or FileTime values returned from WinApi calls such as GetFileTime, GetProcessTimes , GetDiskFreeSpaceEx and QueryPerformanceCounter for example.

I was expecting variant Integer 64 calculations to be faster than Currency as there is no decimal place adjustment, and faster than decimal variant which are 96 bit calculations, but a quick test shows Integer 64 calculations are slower.

The test repeats the addition of two numbers 10000000 times. This test compared both the variant additions of variant integer 64, variant currency, variant decimal and currency addition.

Int64 0.492 Seconds
Decimal 0.352 Seconds
VarCurr 0.264 Seconds
Currency 0.053 Seconds

The Currency addition is almost ten times faster than Variant Integer 64, and 5 times faster than Variant Currency.

The Code used to convert 64bit LargeInteger into Integer 64 Variant:

Code:

Public Const VT_I8 As Integer = &H14
Public Type LARGE_INTEGER
    lowpart    As Long
    highpart    As Long
End Type
Private Type PROPVARIANT
    vt          As Integer
    wReserved1  As Integer
    wReserved2  As Integer
    wReserved3  As Integer
    hval        As LARGE_INTEGER
End Type
Private Declare Function PropVariantToVariant Lib "Propsys" _
    (ByRef pPropVar As PROPVARIANT, ByRef pVar As Variant) As Long
       
Public Function LargeIntegerToVariant(li As LARGE_INTEGER) As Variant
Dim pv As PROPVARIANT
    pv.vt = VT_I8
    pv.hval = li
    PropVariantToVariant pv, LargeIntegerToVariant
End Function

The code to time each type is very similar to the following for the Int64 variant:

Code:

Private Sub DoAddTestInt64(List1 As ListBox, Iterations As Long, _
            StartSeconds As Variant, StopSeconds As Variant)
Dim i          As Long
Dim vInt64A    As Variant
Dim vInt64B    As Variant
Dim vInt64C    As Variant
Dim li          As LARGE_INTEGER
    li.highpart = &H100000: li.lowpart = 0&:    vInt64B = LargeIntegerToVariant(li)
    li.highpart = &H200000: li.lowpart = 0&:    vInt64C = LargeIntegerToVariant(li)
   
    StartSeconds = GetTickSeconds
    vInt64A = vInt64B + vInt64C
    StopSeconds = GetTickSeconds
   
    List1.AddItem "Int64  " & vbTab & "Var Type : " & VarType(vInt64A)
    List1.AddItem "Int64  " & vbTab & vInt64A & " = " & vInt64B & " + " & vInt64C
    List1.ListIndex = List1.ListCount - 1: List1.ListIndex = -1
   
    StartSeconds = GetTickSeconds
    For i = 0 To Iterations
        vInt64A = vInt64B + vInt64C
    Next i
    StopSeconds = GetTickSeconds

    List1.AddItem "Int64  " & vbTab & Format((StopSeconds - StartSeconds), "#,##0.000 Seconds")
    List1.ListIndex = List1.ListCount - 1: List1.ListIndex = -1

End Sub

The key different, apart from the different declarations, is setting the initial value

Code:

'Int64
    li.highpart = &H100000: li.lowpart = 0&:    vInt64B = LargeIntegerToVariant(li)
    li.highpart = &H200000: li.lowpart = 0&:    vInt64C = LargeIntegerToVariant(li)
'Decimal
    li.highpart = &H100000: li.lowpart = 0&:    vDecimalB = CDec(LargeIntegerToVariant(li))
    li.highpart = &H200000: li.lowpart = 0&:    vDecimalC = CDec(LargeIntegerToVariant(li))
'VarCurrency
    li.highpart = &H100000: li.lowpart = 0&:    CopyMemory currB, li, 8:    vCurrB = currB
    li.highpart = &H200000: li.lowpart = 0&:    CopyMemory currC, li, 8:    vCurrC = currC
'Currency
    li.highpart = &H100000: li.lowpart = 0&:    CopyMemory currB, li, 8
    li.highpart = &H200000: li.lowpart = 0&:    CopyMemory currC, li, 8

The code to return the time in decimal seconds:

Code:

Private CountsPerSecond As Variant
Private Declare Function QueryPerformanceFrequency Lib "kernel32" _
    (ByRef lpFrequency As LARGE_INTEGER) As Long
Private Declare Function QueryPerformanceCounter Lib "kernel32" _
    (ByRef lpPerformanceCount As LARGE_INTEGER) As Long

Public Function GetTickSeconds() As Variant
Dim Counter As LARGE_INTEGER
Dim RetApi  As Long
    If IsEmpty(CountsPerSecond) Then GetCountsPerSecond
    RetApi = QueryPerformanceCounter(Counter)
    GetTickSeconds = (CDec(LargeIntegerToVariant(Counter)) / CountsPerSecond)
End Function
Private Sub GetCountsPerSecond()
Dim CPS    As LARGE_INTEGER
Dim RetApi  As Long
    RetApi = QueryPerformanceFrequency(CPS)
    CountsPerSecond = CDec(LargeIntegerToVariant(CPS))
End Sub

The result:

Name:  INT64performance.png
Views: 93
Size:  23.4 KB
Attached Images
 

[help]How to use SetWinEventHook to determine an application's window is created.

$
0
0
Dear All,

I want to write some code to determine whether there is a application is started, and if its title satisfies some string, then close it before showing up.

First step, use the SetWinEventHook to determine the windows operation system's event:

code of bas:
Code:


Option Explicit
'
Public Declare Function SetWinEventHook Lib "user32" (ByVal eventMin As Long, ByVal eventMax As Long, ByVal hmodWinEventProc As Long, ByVal pfnWinEventProc As Long, ByVal idProcess As Long, ByVal idThread As Long, ByVal dwFlags As Long) As Long
Public Declare Function UnhookWinEvent Lib "user32" (ByVal hWinEventHook As Long) As Long
'

Public Sub WinEventProc( _
                        ByVal hWinEventHook As Long, _
                        ByVal dwEvent As Long, _
                        ByVal hWnd As Long, _
                        ByVal idObject As Long, _
                        ByVal idChild As Long, _
                        ByVal dwEventThread As Long, _
                        ByVal dwmsEventTime As Long)


    Debug.Print dwEvent

End Sub

code of form:
Code:

Option Explicit

Private hWinEventHook As Long
Private Const EVENT_OBJECT_CREATE As Integer = &H8000

Private Sub Form_Load()
    hWinEventHook = SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_CREATE, 0, AddressOf WinEventProc, 0, 0, 0)
    Debug.Print "The prior hook address: "; hWinEventHook
End Sub

Private Sub Form_Unload(Cancel As Integer)
    If hWinEventHook Then UnhookWinEvent hWinEventHook
End Sub

After the form showing up, hWinEventHook has value greater than 0, but when I run a notepad.exe, WinEventProc do nothing.

Please teach me how to use SetWinEventHook to determine application's start.

Thank you very much.

Best Regards,

Sniperhgy

Windows department disappears from Microsoft.

$
0
0
I saw a news that Microsoft split the Windows department and Windows disappeared from the department name list. Microsoft has been reorganized several times back and forth, but this is still the first time to remove "Windows" from the department name list since the Gates era.

In the past two years, Windows only accounted for 9% of Microsoft's total revenue.

Although Windows didn't really leave us (it's become an unobtrusive basic setting-infrastructure), it is gradually disappearing from the public eye.

This is why I once said that the future of VB6 (or True-VB7) is ServerSide-Apps, Web-Apps and Mobile-Apps.

Although VB6 is best at developing Windows desktop programs, if we only focus on Windows desktop programs, VB6 will have no future.

[RESOLVED] VbRichClient5 and SQLite datatype (episode 2)

$
0
0
Hi for all.

I have used the CConnection and CRecordset objects of VBRichClien54 successfully.
But I met a small problem that I do not understand.
This is the code (based on Olaf Schmidt example)
Code:

Option Explicit

Private oCn As vbRichClient5.cConnection
 
Private Sub cmdCommand1_Click()
  PrintRsFieldTypes oCn.OpenRecordset("Select * From myTable")

End Sub

Private Sub Form_Load()
  Set oCn = New_c.Connection(, DBCreateInMemory)
      oCn.Execute "CREATE TABLE MyTable(ID INTEGER PRIMARY KEY, Name TEXT, myDate DATE, Timestamp DATETIME current_timestamp)"
End Sub
 
Private Sub PrintRsFieldTypes(oRs As cRecordset)
  Dim oFld As vbRichClient5.cField
  For Each oFld In oRs.Fields
    Select Case oFld.ColumnType
      Case FieldType.SQLite_BLOB:                Debug.Print oFld.Name & " " & "SQLite_BLOB"
      Case FieldType.SQLite_DOUBLE:              Debug.Print oFld.Name & " " & "SQLite_DOUBLE"
      Case FieldType.SQLite_INTEGER:            Debug.Print oFld.Name & " " & "SQLite_INTEGER"
      Case FieldType.SQLite_NULL:                Debug.Print oFld.Name & " " & "SQLite_NULL"
      Case FieldType.SQLite_TEXT:                Debug.Print oFld.Name & " " & "SQLite_TEXT"
      Case FieldType.VB_Boolean_AutoConverted:  Debug.Print oFld.Name & " " & "VB_Boolean_AutoConverted"
      Case FieldType.VB_DATE_AutoConverted:      Debug.Print oFld.Name & " " & "VB_DATE_AutoConverted"
      Case FieldType.VB_ShortDate_AutoConverted: Debug.Print oFld.Name & " " & "VB_ShortDate_AutoConverted"
      Case FieldType.VB_Time_AutoConverted:      Debug.Print oFld.Name & " " & "VB_Time_AutoConverted"
      Case Else:                                Debug.Print oFld.Name & " " & oFld.ColumnType
    End Select
  Next
End Sub

this is the output debug window
Name:  Immagine3.png
Views: 78
Size:  2.2 KB
Why the fileld myDate is identify as VB_DATE_AutoConverted and not as VB_ShortDate_AutoConverted?
Why the fileld Timestamp is identify as VB_DATE_AutoConverted and not as VB_Time_AutoConverted?
Thanks
Attached Images
 

Continuing on with GDI+, point me in the right direction please.

$
0
0
Okay, I suppose I'll keep playing around with this GDI+ stuff. As stated recently, manipulating images is not my strong suit.

However, here's my next idea. I'd like to learn how to do a "paintbrush". Say, a round opaque one that's always black and of a set size. (I'll work out more details later.)

Now, in my little Png/Tga editor, I've got the image on a form, and also in a GDI+ ARGB (hBitmap) image, and these two will be pixel-for-pixel. So, I can use the X,Y of the form to figure out what to do with the hBitmap.

I'm guessing I'll need to use GDI32 for the form, and something in GDI+ to change the hBitmap.

And, I suppose what I'm looking for is someone to just point me in the right direction: The GDI32 and GDI+ calls I'd use to create the paintbrush and then how to apply it (upon mouse-down) to the hDC of the form as well as the GDI+ hBitmap in memory.

Thanks,
Elroy

EDIT: Just as a further FYI, I'll be sticking with my philosophy of splitting out the R,G,B,A channels, and editing those individually. So, I won't be editing the whole image directly, just those channels. Therefore, since I'm displaying the Alpha channel as its separate grayscale, there's no actual concern with an Alpha layer with respect to this paintbrush. In other words, Alpha is entirely opaque for each of my displayed R,G,B,A channels. That would seem to make the GDI32 ideal for actually showing a paintbrush's work on the actual hDC of the forms.

vb6 & GitHub

$
0
0
Hello,

I'm thinking to put one of my vb6 projects to GitHub.
I see that there is not a lot of vb6 on GitHub, does it make any sense to put it there, or is this a waste of time?
Does anyone know where can I find some info on how to do this with vb6 projects (tools, instructions, do and don't)

Thanks,
Davor

Is it possible to create a manifest file for a VB6 app that refs a .NET dll?

$
0
0
Is it possible to create a manifest file for a VB6 application which references a C# .DLL, so that the .DLL does not have to be registered?

I do this with VB6 com dlls with no issues. Can it be done when using .net .dlls if so how?

The C# .dll is com visible and works fine ren registered, but I need to distribute it to X number of machines.

Problem With Multiple Instances of MDI_Child

$
0
0
Hi
I have a Windows application which can create a number of instances of MDI-Child forms via the following code.
Each instance of the form is created ok however when I click on a control on the active instance another instance is created with .Caption = ""

How do I define which instance of the form is the active one?

Thanks in advance

' this sub resides in a different MDI-Child form which has a button to create an instance of MyForm1
Public Sub cmdCreateNewForm_Click()

Dim frm As MyForm1

Static iCount As Integer

Set frm = New MyForm1
iCount = iCount + 1
frm.Caption = "Form Instance " & iCount
frm.Show ' all good to here

End Sub

' this sub resides in the MDIMain form and allows the User to perform an action on the active instance MyForm1
Private sub tblToolbar_ButtonClick()

Select Case ActiveForm.Name

Case "MyForm1"

MyForm1.cmdDoSomething_Click ' which instance of MyForm1 though????

End Select

End Sub


' this sub resides in each instance of frm
' the preceding code should have detected the active instance but that doesn't seem to be the case
Public Sub cmdDoSomething_Click()

'#### this next call causes a new instance of the form to be created (due to the control ssgrdRFSDocumentList not having a valid reference?)
If bRFSVerifyTagged(ssgrdRFSDocumentList) Then 'I tried passing me.ssgrdRFSDocumentList but that doesn't seem to work

Msgbox MyForm1.caption ' returns blank
Msgbox me.caption ' returns blank

End If

End Sub

Traslate PHP To VB6

$
0
0
Hi, I need too convert this PHP script in VB6. How To?

<?php
$PIVA = '12345678901';
$PAESE = 'IT';
$client = new SoapClient("http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl");
var_dump($client->checkVat(array(
'countryCode' => $PAESE,
'vatNumber' => $PIVA
)));
?>

I have tryed with

Private Sub Command1_Click()
Dim client, result
Set client = CreateObject("MSSOAP.SoapClient30")

client.MSSoapInit "http://ec.europa.eu/taxation_customs/vies/checkVatService.wsdl"

result = client.checkVat("countryCode=IT", "vatNumber=12345678901")
End Sub


But it not work.

Tnx to everybody.

How to develop a border smooth(anti-aliased) rounded-rect button user control?

$
0
0
I know that RC5.Cairo, GDIPlus and GDI can draw smooth (anti-aliased) rounded rectangles in a Form or PictureBox. However, I don't know how to develop a rounded-rect button control with a smooth (anti-aliased) corner?

Any advice and suggestions would be greatly appreciated.
Attached Images
  

[RESOLVED] Problem With Multiple Instances of MDI_Child

$
0
0
Hi
I have a Windows application which can create a number of instances of MDI-Child forms via the following code.
Each instance of the form is created ok however when I click on a control on the active instance another instance is created with .Caption = ""

How do I define which instance of the form is the active one?

Thanks in advance

' this sub resides in a different MDI-Child form which has a button to create an instance of MyForm1
Public Sub cmdCreateNewForm_Click()

Dim frm As MyForm1

Static iCount As Integer

Set frm = New MyForm1
iCount = iCount + 1
frm.Caption = "Form Instance " & iCount
frm.Show ' all good to here

End Sub

' this sub resides in the MDIMain form and allows the User to perform an action on the active instance MyForm1
Private sub tblToolbar_ButtonClick()

Select Case ActiveForm.Name

Case "MyForm1"

MyForm1.cmdDoSomething_Click ' which instance of MyForm1 though????

End Select

End Sub


' this sub resides in each instance of frm
' the preceding code should have detected the active instance but that doesn't seem to be the case
Public Sub cmdDoSomething_Click()

'#### this next call causes a new instance of the form to be created (due to the control ssgrdRFSDocumentList not having a valid reference?)
If bRFSVerifyTagged(ssgrdRFSDocumentList) Then 'I tried passing me.ssgrdRFSDocumentList but that doesn't seem to work

Msgbox MyForm1.caption ' returns blank
Msgbox me.caption ' returns blank

End If

End Sub

[RESOLVED] How to develop a border smooth(anti-aliased) rounded-rect button user control?

$
0
0
I know that RC5.Cairo, GDIPlus and GDI can draw smooth (anti-aliased) rounded rectangles in a Form or PictureBox. However, I don't know how to develop a rounded-rect button control with a smooth (anti-aliased) corner?

Any advice and suggestions would be greatly appreciated.
Attached Images
  
Viewing all 21705 articles
Browse latest View live


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