I have got a COM DLL (written in VB) to enable me to preview the Text
Control word processor components from within vfp.

The preview.dll is stored in c:\printpreview and I have registered it
successfully with regsvr32.exe c:\printpreview\preview.dll

My vfp project is stored in M:\SAMPLE with the forms in M:\SAMPLE\FORMS

In the form I have put the two lines in the click method of a commandbutton:

lopreview = createobject("preview.txtpreview")
lopreview.display(thisform.txtcontrol1)

and it fails with the error 'class definition not found'.

This is the first time I have tried to do anything with DLLs so I am
sure I have missed something fairly basic.

Can anybody help please?

Many thanks

Stephen

Re: Preview COM DLL problem by Eric

Eric
Wed Mar 23 04:01:28 CST 2005

Hello, Stephen!

Are you sure the VB class is called txtpreview? And what is the value of the
Instancing property of the VB ClassModule?
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8



Re: Preview COM DLL problem by Stephen

Stephen
Wed Mar 23 09:31:42 CST 2005

Eric den Doop wrote:
> Hello, Stephen!
>
> Are you sure the VB class is called txtpreview? And what is the value of the
> Instancing property of the VB ClassModule?

Fairly sure Eric - but I will go and check with the VB man.

Many thanks

Stephen

Re: Preview COM DLL problem by Stephen

Stephen
Wed Mar 23 16:36:41 CST 2005

Another question Eric - do I need a DECLARE line either before or after the
CREATEOBJECT line? Some DLLs seem to need them and I am not sure when or
why.

Stephen

"Stephen Ibbs" <stephen@datadevelopments.co.uk> wrote in message
news:OnCcq17LFHA.3788@tk2msftngp13.phx.gbl...
> Eric den Doop wrote:
>> Hello, Stephen!
>>
>> Are you sure the VB class is called txtpreview? And what is the value of
>> the
>> Instancing property of the VB ClassModule?
>
> Fairly sure Eric - but I will go and check with the VB man.
>
> Many thanks
>
> Stephen



Re: Preview COM DLL problem by Dan

Dan
Wed Mar 23 17:02:10 CST 2005

You need DECLARE for a Win32 API dll that exposes functions.

You do not need it for a COM server, which is an object sitting out in the
Windows ooze just waiting for CreateObject().

Dan

Stephen & Shelagh Ibbs wrote:
> Another question Eric - do I need a DECLARE line either before or
> after the CREATEOBJECT line? Some DLLs seem to need them and I am not
> sure when or why.
>
> Stephen
>
> "Stephen Ibbs" <stephen@datadevelopments.co.uk> wrote in message
> news:OnCcq17LFHA.3788@tk2msftngp13.phx.gbl...
>> Eric den Doop wrote:
>>> Hello, Stephen!
>>>
>>> Are you sure the VB class is called txtpreview? And what is the
>>> value of the
>>> Instancing property of the VB ClassModule?
>>
>> Fairly sure Eric - but I will go and check with the VB man.
>>
>> Many thanks
>>
>> Stephen



Re: Preview COM DLL problem by Stephen

Stephen
Thu Mar 24 08:20:54 CST 2005

Thanks Dan and Eric

We have some progress - I had misunderstood the name of the function in
the DLL. It is now being called, but is erroring with

OLE idispatch exception code 0 from preview ... Type mismatch

Any ideas - please ?

Stephen


Dan Freeman wrote:
> You need DECLARE for a Win32 API dll that exposes functions.
>
> You do not need it for a COM server, which is an object sitting out in the
> Windows ooze just waiting for CreateObject().
>
> Dan
>
> Stephen & Shelagh Ibbs wrote:
>
>>Another question Eric - do I need a DECLARE line either before or
>>after the CREATEOBJECT line? Some DLLs seem to need them and I am not
>>sure when or why.
>>
>>Stephen
>>
>>"Stephen Ibbs" <stephen@datadevelopments.co.uk> wrote in message
>>news:OnCcq17LFHA.3788@tk2msftngp13.phx.gbl...
>>
>>>Eric den Doop wrote:
>>>
>>>>Hello, Stephen!
>>>>
>>>>Are you sure the VB class is called txtpreview? And what is the
>>>>value of the
>>>>Instancing property of the VB ClassModule?
>>>
>>>Fairly sure Eric - but I will go and check with the VB man.
>>>
>>>Many thanks
>>>
>>>Stephen
>
>
>

Re: Preview COM DLL problem by Craig

Craig
Thu Mar 24 10:51:55 CST 2005

"Windows ooze"????

ROFL

I gotta remember that one!

--
Craig Berntson
MCSD, Visual FoxPro MVP
www.craigberntson.com
Salt Lake City Fox User Group
www.slcfox.org
www.foxcentral.net


"Dan Freeman" <spam@microsoft.com> wrote in message
news:%23A8Fax$LFHA.1156@TK2MSFTNGP09.phx.gbl...
> You need DECLARE for a Win32 API dll that exposes functions.
>
> You do not need it for a COM server, which is an object sitting out in the
> Windows ooze just waiting for CreateObject().
>
> Dan
>



Re: Preview COM DLL problem by Dan

Dan
Thu Mar 24 12:17:49 CST 2005

That error message is pretty self-explanatory. You're passing the wrong data
type.

Going back to your original post, it looks like you're passing it a control
(object) instead of the value (String) stored in that control.

object.method(Thisform.txtWhatever.VALUE)

Dan

Stephen Ibbs wrote:
> Thanks Dan and Eric
>
> We have some progress - I had misunderstood the name of the function
> in the DLL. It is now being called, but is erroring with
>
> OLE idispatch exception code 0 from preview ... Type mismatch
>
> Any ideas - please ?
>
> Stephen
>
>
> Dan Freeman wrote:
>> You need DECLARE for a Win32 API dll that exposes functions.
>>
>> You do not need it for a COM server, which is an object sitting out
>> in the Windows ooze just waiting for CreateObject().
>>
>> Dan
>>
>> Stephen & Shelagh Ibbs wrote:
>>
>>> Another question Eric - do I need a DECLARE line either before or
>>> after the CREATEOBJECT line? Some DLLs seem to need them and I am
>>> not sure when or why.
>>>
>>> Stephen
>>>
>>> "Stephen Ibbs" <stephen@datadevelopments.co.uk> wrote in message
>>> news:OnCcq17LFHA.3788@tk2msftngp13.phx.gbl...
>>>
>>>> Eric den Doop wrote:
>>>>
>>>>> Hello, Stephen!
>>>>>
>>>>> Are you sure the VB class is called txtpreview? And what is the
>>>>> value of the
>>>>> Instancing property of the VB ClassModule?
>>>>
>>>> Fairly sure Eric - but I will go and check with the VB man.
>>>>
>>>> Many thanks
>>>>
>>>> Stephen



Re: Preview COM DLL problem by Dan

Dan
Thu Mar 24 12:19:07 CST 2005

I'm surprised you haven't heard it before. I've been saying it for years.

Think I stole it from Woody Leonhard way back when. <g>

Dan

Craig Berntson wrote:
> "Windows ooze"????
>
> ROFL
>
> I gotta remember that one!
>
>
> "Dan Freeman" <spam@microsoft.com> wrote in message
> news:%23A8Fax$LFHA.1156@TK2MSFTNGP09.phx.gbl...
>> You need DECLARE for a Win32 API dll that exposes functions.
>>
>> You do not need it for a COM server, which is an object sitting out
>> in the Windows ooze just waiting for CreateObject().
>>
>> Dan