OCX

Started by John Messingham, July 11, 2010, 02:47:09 PM

Previous topic - Next topic

José Roca

 
If it works in your computer and not in the other, probably the creation of an instance of the grid has failed for some reason.

Check if after pGrid = OC_GetDispatch(HWND_FORM1_OCXCONTROL1), pGrid is 0 or not.

Also, it will help if you show the lines of code used to create the control.

Peter House

Try looking at some of the tools from HTTP://www.sysinternals.com

Most of them can be run directly from the Address bar like this one:
http://live.sysinternals.com/procexp.exe

There are some very powerful system analysis tools here.

Cho Sing Kum

#17
Hi John,

What is the OS on the target computers? Is it Vista?

Do your VB6 apps that use this OCX work on the target computers?

Edit: Please ignore my this post and questions.

I re-read the thread and found this:

Quote from: John Messingham on July 21, 2010, 01:48:35 PM
...
I have a couple of vb6 apps that use the grid and they install and work fine.
...

John Messingham

Here is the code:


Function FORM1_WM_CREATE ( _
                         hWndForm As Dword, _      ' handle of Form
                         ByVal UserData As Long _  ' optional user defined Long value
                         ) As Long

   Local pGridEvents As GridImpl
   Local pGridDispatch As FlexCellGrid

   pGridEvents = Class "CGrid" 
   OC_Advise HWND_FORM1, pGridEvents, Guid$("{45F22D4C-97EB-4E59-A691-16B803275AC6}")     
   pGridEvents = Nothing

         
   pGridDispatch = OC_GetDispatch(HWND_FORM1_OCXCONTROL1)
   
   If IsObject(pGridDispatch) Then
   
      pGridDispatch.AutoRedraw = %False
      pGridDispatch.BackColorBkg = Rgb(90, 158, 214)
     
      pGridDispatch.Rows = 1
      pGridDispatch.Cols = 7
       
      setCellText(HWND_FORM1_OCXCONTROL1, 0, 0, "ID")
      setCellText(HWND_FORM1_OCXCONTROL1, 0, 1, "Priority")
      setCellText(HWND_FORM1_OCXCONTROL1, 0, 2, "Title")
      setCellText(HWND_FORM1_OCXCONTROL1, 0, 3, "Category")
      setCellText(HWND_FORM1_OCXCONTROL1, 0, 4, "Contact")
      setCellText(HWND_FORM1_OCXCONTROL1, 0, 5, "Project")
      setCellText(HWND_FORM1_OCXCONTROL1, 0, 6, "Assigned To")
     
      pGridDispatch.ReadOnly = %True
      pGridDispatch.SelectionMode = %SelectionModeContrants_cellSelectionByRow
      pGridDispatch.AutoRedraw = %True
      pGridDispatch.refresh
      pGridDispatch = Nothing
   
   Else
   
      MsgBox "No Grid Object Created"
     
   End If

End Function

Function setCellText(hWndControl As Long, cRow As Long, cCol As Long, cText As String) As Long

    Local pGridDispatch As FlexCellGrid
    Local pCell As FlexCellCell
   
    pGridDispatch = OC_GetDispatch(hWndControl)
   
    If IsObject(pGridDispatch) Then         
        pcell = pGridDispatch.Cell(cRow, cCol)
        pcell.Text = UCode$(cText)
        pGridDispatch = Nothing
    End If

End Function


On my development machine (Vista) it works but on the target machine (XP Pro) I get the "No Grid Object Created" message.

Thanks for the link Peter, I will have a look at the tools.
Many Thanks
John Messingham
http://www.jmds.co.uk

Cho Sing Kum

I don't have experience with OCX in FF/PB, only with VB6 which is quite straight forward.

However, if you have a simple FF/PB demo project with the Grid, I can test it on my computers. Just a simple one that show the Grid and maybe populate a cell.

I have downloaded the trial and noted the dependency on msvbvm60.dll and iobjsafe.tlb.

John Messingham

Hi Cho,

I have attached a little sample program for FF.
Many Thanks
John Messingham
http://www.jmds.co.uk

Rolf Brandt

John,

I just tried your example on my XP Pro SP3 machine. Works perfectly, the grid is created. So there must be something else in the bush.
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

John Messingham

Cheers Rolf,

These are always the worst ones arent they?
Many Thanks
John Messingham
http://www.jmds.co.uk

Rolf Brandt

They sure are. Can be extremely time consuming and nerving!
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Cho Sing Kum

The sample works ok on my pc (WinXP Pro SP3).

I copied project1.exe and FlexCell.ocx onto a thumb drive. Went over to another pc that does not have the FlexCell trial installed. Regsvr32 the OCX and it runs okay (WinXP Pro SP3).

On both pc, when I unregistered FlexCell.ocx, I get the error "No Grid Object Created" when I run project1.exe.

Looks ok at my end.


John Messingham

Cheers Cho,

So it really looks like it is something to do with the machine here.

Thanks for all the repsonses.

Many Thanks
John Messingham
http://www.jmds.co.uk

John Messingham

Hi Cho,

Did you just copy the project1.exe and FlexCell.ocx files? what about the dependancie files? I only ask as if the extra files are not required for the little demo then at least I know it is not them.
Many Thanks
John Messingham
http://www.jmds.co.uk

Rolf Brandt

Just copy the project1.exe and FlexCell.ocx, register the ocx and Bingo! No need for other dependency files, they are part of the OS.
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

Cho Sing Kum

Hi John,

Yes, I just copied project1.exe and FlexCell.ocx only.

Although according to the help file:
Quote
What do I need to do when distributing my application?

When you create the application's installer, pack and register these files as follows:

[Program Files]\FlexCell\FlexCell.ocx, COMSelfReg
[System]\msvbvm60.dll, COMSelfReg
[System]\iobjsafe.tlb, COM
[System]\xls.dll, DoNotRegister, required for ExportToExcel method.
[System]\zlib.dll, DoNotRegister, required for ExportToPDF method.
[System]\msvcr71.dll, DoNotRegister, required for ExportToPDF method.

msvbvm60.dll is installed by WinXP
iobjsafe.tlb should be required on developer pc only???
xls.dll, zlib.dll and msvcr71.dll are required only if the stated functions are required.

John Messingham

I have got back onto the grid developers again because I have tried the tests using the demo version and it works fine but as soon as I replace the demo with the full grid version the problem occurs.
Many Thanks
John Messingham
http://www.jmds.co.uk