PlanetSquires Forums

Support Forums => General Board => Topic started by: David Maruca on March 31, 2010, 12:12:55 AM

Title: New Grid
Post by: David Maruca on March 31, 2010, 12:12:55 AM
Found a new ActiveX grid today called MstGrid.

http://www.mysofttool.com/

The activex version is free and has a nice look and lots of control to it. I managed to get it working in FF3 really easy. The only problem is that it's activex so the component has to be registered on the system. Could be a problem with admin rights issues. I wish you could use activex controls without registering them...
Title: Re: New Grid
Post by: José Roca on March 31, 2010, 02:12:09 AM
Quote
I wish you could use activex controls without registering them...

You can. My OLE container allows it, even for licensed controls.

Quote
This container allows the creation of instances of unregistered OCXs passing a pointer to an instance of the OC_CREATEPARAMS structure in the lParam parameter of CreateWindowEx, e.g.


' Create a registration-free instance of the MSHFlexGrid control
LOCAL  cp AS OC_CREATEPARAMS
cp.clsid = $CLSID_MSFlexGrid
cp.riid = $IID_IMSFlexGrid
cp.szLicKey = $RTLKEY_MSFlexGrid
cp.szLibName = EXE.Path$ & "Msflxgrd.ocx"
hGrid = CreateWindowEx(0, $OC_CLASSNAME, "", _
   %WS_CHILD OR %WS_VISIBLE OR %WS_BORDER OR %WS_TABSTOP, _
   10, 10, 400, 300, hParent, %IDC_GRID, GetModuleHandle(BYVAL %NULL), cp)


Now, request to Paul to add a property to set the path of the ActiveX control...
Title: Re: New Grid
Post by: Michael Stefanik on March 31, 2010, 02:26:03 AM
There's the general purpose solution of Reg-Free COM (http://msdn.microsoft.com/en-us/library/ms973913.aspx) that uses manifests to store the COM registration information, but it sounds like the approach Jose has would be easier for most folks.
Title: Re: New Grid
Post by: José Roca on March 31, 2010, 04:10:24 AM
By passing the needed information (CLSID, IID, path and, if needed, the license key), the container loads the ActiveX, retrieves the address of the IClassFactory (IClassFactory2 for licensed controls) and creates an instance of the control. And since it doesn't use manifests, it also works in Windows 2000 and Windows 98.

One of the main reasons for writing my own OLE container was to not to have to register the ActiveXs.
Title: Re: New Grid
Post by: David Maruca on March 31, 2010, 09:11:33 AM
Wow thanks, Jose. I have already learned so much from your examples and I just keep on learning. Thank you very much for sharing your knowledge. I wonder, is it possible to work that into the FF3 IDE. Right now I am guessing that I could put that into the form's WM_CREATE or edit the generated code when I'm ready to deploy. Any thoughts? Thanks again.
Title: Re: New Grid
Post by: David Maruca on March 31, 2010, 09:07:43 PM
Ok, I'm having trouble getting this to work. I did my declares in FF_AppStart

#Include Once "OLECON.INC"
Global IDC_FORM1_CTLMSTGRID As Long
Global HWND_FORM1_CTLMSTGRID As Dword


And put the control creation in the form's WM_CREATE routine.

Function FORM1_WM_CREATE ( _
                         hWndForm As Dword, _      ' handle of Form
                         Byval UserData As Long _  ' optional user defined Long value
                         ) As Long
      Local cp As OC_CREATEPARAMS
      cp.clsid = $CLSID_MstGridgrdView
      cp.riid = $IID__MstGridgrdView
      cp.szLibName = Exe.Path$ & "MstGrid.ocx"
     
      HWND_FORM1_CTLMSTGRID = Createwindowex(%WS_EX_LEFT Or %WS_EX_LTRREADING, _
                         $OC_CLASSNAME, _
                         "", _
                         %WS_CHILD Or %WS_VISIBLE Or %WS_CLIPSIBLINGS Or %WS_CLIPCHILDREN, _
                         0, _
                         0, _
                         500, _
                         310, _
                         HWND_FORM1, _
                         IDC_FORM1_CTLMSTGRID, _
                         App.hInstance, _
                         cp)
                         'App.hInstance = Getmodulehandle(Byval %Null)
End Function


I run it and nothing.

I did copy the files to the release directory. Here is what should be distributed from the help file.

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]\MstGrid\MstGrid.ocx, COMSelfReg
    [System]\msvbvm60.dll, COMSelfReg


I've attached a project for testing.

[attachment deleted by admin]
Title: Re: New Grid
Post by: José Roca on March 31, 2010, 10:45:28 PM
 
You must call OC_WinInit, that registers the class of the OLE container, before creating a window that uses $OC_CLASSNAME, and also assign a value to IDC_FORM1_CTLMSTGRID.
Title: Re: New Grid
Post by: David Maruca on March 31, 2010, 10:54:10 PM
Hah it works! Thanks, Jose!
Title: Re: New Grid
Post by: Pat Dooley on April 08, 2010, 10:07:05 AM
David,, would you mind posting your revised Mstgrid sample project now that you have it working?
Thanks
Title: Re: New Grid
Post by: David Maruca on April 08, 2010, 10:46:04 AM
Absolutely. I put the init call in FF_WinMain and changed IDC_FORM1_CTLMSTGRID to a constant with a value. That's all that was needed.