Dart Home | PowerTCP SSL for ActiveX | Custom Development | Reply | PowerTCP SSL for ActiveX Topics | Forums |
Author | Forum: PowerTCP SSL for ActiveX Topic: CertificateList - setting SelectedIndex does not highlight row |
BrendanM From: Durban, South Africa Posts: 80 Member Since: 07/11/02 |
posted August 4, 2011 1:00 AM We use a CertificateList to allow a user to select a Certificate from the list. To show the previously selected certificate we try and set the SelectedIndex to a value but it does not highlight the row in the list. The index gets set - its just that the row does not get highlighted. i = 1 For Each Cert1 In CertificateList1.Certificates If Cert1.IssuedBy = Cert.IssuedBy And Cert1.SerialNumber = Cert.SerialNumber Then CertificateList1.SelectedIndex = i cmdOk.Enabled = True Exit For End If i = i + 1 Next Cert1 |
BrendanM From: Durban, South Africa Posts: 80 Member Since: 07/11/02 |
posted August 4, 2011 1:40 AM Our workaround to the above code snippet is found below. BTW - we also found it was possible to multi-select rows in the CertificateList which one should not be able to do ..... i = 1 For Each Cert1 In CertificateList1.Certificates If Cert1.IssuedBy = Cert.IssuedBy And Cert1.SerialNumber = Cert.SerialNumber Then CertificateList1.SelectedIndex = i Call SelectRowInListView(CertificateList1.hWnd, i - 1) ' workaround Dart anomaly CertificateList1.SetFocus ' workaround Dart anomaly cmdOk.Enabled = True Exit For End If i = i + 1 Next Cert1 Private Function SelectRowInListView(ByVal hWnd As Long, Row As Long) Dim lProcID As Long Dim hProc As Long Dim lxprocLVITEM As Long Dim LVITEM As LV_ITEM Dim lItemPos As Long GetWindowThreadProcessId hWnd, lProcID ' Get the process ID in which the ListView is running If lProcID <> 0 Then hProc = OpenProcess(PROCESS_VM_OPERATION Or PROCESS_VM_READ Or PROCESS_VM_WRITE, False, lProcID) ' make sure we have read write permissions in the process space If hProc <> 0 Then lxprocLVITEM = VirtualAllocEx(hProc, 0, LenB(LVITEM), MEM_RESERVE Or MEM_COMMIT, PAGE_READWRITE) ' Grab enough memory in the other procedure's space to hold our LV_ITEM ' Set up our local LV_ITEM to change the selected item LVITEM.mask = LVIF_STATE LVITEM.state = True LVITEM.stateMask = LVIS_SELECTED ' Copy the local LV_ITEM into the space we reserved in the foreign process WriteProcessMemory hProc, ByVal lxprocLVITEM, ByVal VarPtr(LVITEM), LenB(LVITEM), 0 ' Now send the message, but pass the address of the copy of our LV_ITEM that now exists in the foreign process instead of our local versiony lItemPos = Row& ' desired row SendMessage hWnd, LVM_SETITEMSTATE, lItemPos, ByVal lxprocLVITEM ' Clean up VirtualFreeEx hProc, ByVal lxprocLVITEM, LenB(LVITEM), MEM_RELEASE CloseHandle hProc End If End If End Function |
Jason Farrar (Admin) From: Oneida, NY USA Posts: 223 Member Since: 07/24/07 Extra Support Options Custom Application Development |
posted August 5, 2011 5:32 PM Thank you for pointing these issues out. The issue where setting the SelectedIndex property does not result in the certificate being highlighted has been recorded as issue #5492 Selecting multiple certificates has been recorded as Issue #5493. You can contact jamie.powell@dart.com for resolution status updates, please include this issues numbers as reference when you do so. |
Reply | PowerTCP SSL for ActiveX Topics | Forums |
This site is powered by PowerTCP WebServer for ActiveX |