Solved

Using the VCFormulaOne (OCX)

Posted on 1998-12-16
39
666 Views
Last Modified: 2012-06-22
Hi,

I need some help using the VCFormulaOne Component.
I can do everything i want with it (including writing to file) but i can't use the read function.

To write a file :
test.write(opendialog1.filename, F1FileExcel5);

The help-file says to read:
test.read(opendialog1.filename, F1FileExcel5);

but this doesn't work, does anyone know why??

I get the error message "Types of actual and formal var parameters must be indentical".

Anyone???



0
Comment
Question by:rick_mulder
  • 15
  • 13
  • 9
  • +1
39 Comments
 
LVL 4

Expert Comment

by:davidmwilliams
ID: 1351263
 Possibly the problem is with the opendialog1.filename - because it is likely to be a property and not a simple String type, which is what I'd imagine the read function wants, if it is declaring it as a var.
  Perhaps try this -

var
  S: String;

.

  S := OpenDialog1.FileName;
  Test.Read (S, F1FileExcel5);

  If this still gives the same error, then the problem must be with the other parameter.  If so, maybe show us its declaration so we see what type it is.
0
 
LVL 4

Expert Comment

by:StevenB
ID: 1351264
 The VCFormulaOne component is hideously unreliable. Unless you absolutely have to use it then I'd recomend that you don't. It is packed with bugs that can only be solved by shelling out the full price for the complete version and even then there are some problems. One of the biggest problems I had with the component was loading Excel spreadsheets.

  The authors of the component have told me that they don't specifically support Delphi and that the product should not ship with Delphi since it is essentially incompatable. Borland are to blame for continuing to ship an obselete version of a basically incompatable  product with Delphi.

  Which leads me to ask: Why do you need to use the VCF1, would not a simpler component suffice?

  Steven
0
 

Author Comment

by:rick_mulder
ID: 1351265
Well stevenB,

Why i use VCF1?

Coz, i want to import to Excel and i tried to use OLE but that wasn't working either. Because for each version of Excel, you need to use the local language code(yukkk!!).

So i guess VCF1 is the best alternative.

I solved the problem.
The help-file of the VCF1 isn't really so good. But i figured it out now! So thanks for your comments.
0
 
LVL 4

Expert Comment

by:davidmwilliams
ID: 1351266
What was the problem? How did you solve it?
0
 

Author Comment

by:rick_mulder
ID: 1351267
The problem was that i tried to use:
test.read('c:\test.xls', F1FileExcel5); and that didn't work.

The helpfile was not correct as the F1FileExcel5 was a small int and not a long one.

I have only one problem. I have 2 computers on the first one everything works just fine but on the 2nd one something is wrong.
When i put a VCFormula1 component on the form the error message ("Class not registered!") appears. How is this possible???
0
 
LVL 4

Expert Comment

by:davidmwilliams
ID: 1351268
 The VCFormula1 component has not been registered properly with Windows.  It's an ActiveX component, and requires certain registry entries to work.  Normally, this should occur during the Delphi install.  Did you perhaps add it to your second machine in some other way, perhaps by copying the .ocx or .dll from one PC to the other?
  Re-installing Delphi should work.
  Also, if you can find out the underlying file for that component (perhaps using the type manager) then you can run the Windows-supplied regsvr32 utility on it, to register it.
0
 

Author Comment

by:rick_mulder
ID: 1351269
Did you perhaps add it to your second machine in some other way, perhaps by copying the .ocx or .dll from one PC to the other?

Nope, i also did  full delphi install and i tried it again and again and again!!!

But what when i use the OCX in my Application and install it on a pc without delphi. Must i register the component then in the windows registry??


0
 

Author Comment

by:rick_mulder
ID: 1351270
VCF132.OCX
MFCANS32.DLL
OC30.DLL
MSVCRT20.DLL

these files are needed to use the ocx!
Does this mean they al have to be registered???

I tried: regsvr32 c:\winnt\system32\MSVCRT20.DLL
and get the message "the dll was loaded but the dllServerEntryPoint was not found. DllRegisterServer may not be  exported, or a corrupt version of c:\winnt\system32\MSVCRT20.DLL
may be in memory. Consider using Pview to detect and remove it"

Can someone tell me what Pview is, and how to solve this problem??
0
 
LVL 4

Expert Comment

by:StevenB
ID: 1351271
 I think you can use install shield which comes on the Delphi Setup disk to do all this for you. Hang on I'll just check...
0
 
LVL 4

Expert Comment

by:StevenB
ID: 1351272
  ... yeah, you might like to look at the Install Shield For Delphi that comes with your setup disk. You can use this to automatically install these components on the target machine when you build a setup utility for your application (highly recomended if you're going to be using OCX controls). Look at the "Select Install Shield Objects for Delphi" tab.

  Steven
0
 
LVL 4

Expert Comment

by:davidmwilliams
ID: 1351273
 Just run regsvr32 on the VCFormula1 OCX itself, which is likely to be the VCF132.OCX file that you list.
  You can make an InstallShield setup to install the component, but that is what it will be doing behind the scenes.
  Yes - if you want to use an ActiveX component on a machine, it must be registered.  Delphi should do this with all its ActiveX controls, when you install it.  InstallShield registers components as part of its procedures.  You can do it yourself manually by using regsvr32.
0
 
LVL 4

Expert Comment

by:davidmwilliams
ID: 1351274
 Just to answer your other question - the MSVCRT.DLL doesn't need registering, because it is NOT an ActiveX control - it's a run-time library of routines.  It just needs to be somewhere in the PATH.
0
 

Author Comment

by:rick_mulder
ID: 1351275
Thank you for your answer.

On my Winnt machine the regsvr32.exe thing works perfectly.
After it's being registered in the registry. I do a find in the regedit.exe on c:\winnt\system32\Vcf132.ocx in i see that there are many (about 10 or more) references to this file.
One of this is in the HKEY_CURRENT USER\Software\Microsoft\Windows\CurrentVersion\\RUN MRU\
with the value c:\winnt\system32\vcf132.ocx..

If i want to get the ocx component register automaticaly during the installing of my program. What shoul i write in the registry then???

If regsvr32 makes many references should i create them also manualy???


0
 
LVL 4

Expert Comment

by:StevenB
ID: 1351276
 You're better off using regsvr32 or Install Shield (which as david points out: "that is what it will be doing behind the scenes.") to register the ActiveX control, rather than try and make all the registry entries yourself.
  It depends what you want the end product to be. If you will be distributing it to many people, then I'd recomend building an installation utility. If you only have a few target machines in mind then you might prefer to use regsvr32.
  If you really want to make all the registry entries yourself, then you're probably going to have to get hold of a utility which will snapshot the registry before and after an install of the OCX and then report the differences. I know these exist, but I cant think of one just this minute.

  Steven
0
 
LVL 4

Expert Comment

by:davidmwilliams
ID: 1351277
 I agree entirely with what StevenB said above.  As to a snapshot utility, here's a few thoughts :

  - Make a batch file that exports the registry to a text file, before and then again after. Then, just use the simple DOS FC command to compare the two text files.

  - Use Csdiff from http://www.componentsoftware.com/csdiff/ which is a bit slower than FC, but does a better job.

  - Use Trial Magician from http://www.procode.com.au/TrialMagician/index.html which allows a full restore of your system after installing any software (e.g. components).  You should be able to extract what changed from it.
0
 

Author Comment

by:rick_mulder
ID: 1351278
I posted my problem also in the delphi-install newsgroup. There someone said that in the Install Shield i can make a group and make that location (winsystem). I then put the *.ocx file in that group. During the install the file is copied correctly into the system directory.

By the way, i use delphi 2.0 with its installer program.

The solution you guys are giving me.... eh..
You can't tell me this is the way to do this..
There must be a better way to solve this..

If you have comments, please respond..


0
 
LVL 4

Expert Comment

by:davidmwilliams
ID: 1351279
 Just putting the file in the Windows Systems directory is not enough -- the Active X control has to be registered (otherwise Windows doesn't know about the ocx file, or what functionality it offers).  The answer you got in the Delphi-Install newsgroup doesn't solve the problem -- it just duplicates the situation you described earlier, where the file is there, but Windows knows nothing about it.
  You can run regsvr32 on the ocx through InstallShield -- even InstallShield Express allows you to run an external program.  If you wish to register a number of controls, you should make a .bat file and put in a command to register each one, one to a line.  Then run this .bat file at the end of your installation.
  You could add the registry entries manually, if you like, but as SteveB said, this is very complicated.  If you want, maybe you can extract the information from the Windows' guide to logo applications at http://msdn.microsoft.com/developer/winlogo/downloads.htm
  Alternatively, recall SteveB spoke about an InstallShield option to add objects; this should probably do the trick, with InstallShield handling all the registration (probably even just through regsvr32 silently).
  I'm sorry you don't like our solution -- but it's true.  You simply cannot use an ActiveX control until it's been registered in Windows.
0
 
LVL 4

Expert Comment

by:StevenB
ID: 1351280
 There isn't a better way to solve this I'm afraid. If you use an ActiveX control then it has to be rgistered on the target machine and the recomended technique for registering an ActiveX control is by using regsvr32.
  As you suggest, it might be possible to register the control yourself, by making the appropriate registry changes, but I'm not entirely sure why you'd want to do that, when there are utilities which will do it for you.

  How many installations do you anticipate making?

  Steven.
0
 
LVL 4

Expert Comment

by:StevenB
ID: 1351281
 oops, simultaneous posting, didn't mean to repeat everything.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 4

Expert Comment

by:davidmwilliams
ID: 1351282
 Just putting the file in the Windows Systems directory is not enough -- the Active X control has to be registered (otherwise Windows doesn't know about the ocx file, or what functionality it offers).  The answer you got in the Delphi-Install newsgroup doesn't solve the problem -- it just duplicates the situation you described earlier, where the file is there, but Windows knows nothing about it.
  You can run regsvr32 on the ocx through InstallShield -- even InstallShield Express allows you to run an external program.  If you wish to register a number of controls, you should make a .bat file and put in a command to register each one, one to a line.  Then run this .bat file at the end of your installation.
  You could add the registry entries manually, if you like, but as SteveB said, this is very complicated.  If you want, maybe you can extract the information from the Windows' guide to logo applications at http://msdn.microsoft.com/developer/winlogo/downloads.htm
  Alternatively, recall SteveB spoke about an InstallShield option to add objects; this should probably do the trick, with InstallShield handling all the registration (probably even just through regsvr32 silently).
  I'm sorry you don't like our solution -- but it's true.  You simply cannot use an ActiveX control until it's been registered in Windows.
0
 

Author Comment

by:rick_mulder
ID: 1351283
The problem is that i tried to install the OCX file with regsvr32.

It works on my Winnt machine and Win98 machine. But on a pc with a very old win95 version regsvr32 is called regserv.exe.
When i try regserv.exe c:\windows\system\...ocx then nothing happens.

When i try to use the activex component, the message "class not found" appears.

davidmwilliams, you said i can make a batch file but where in the install shield can i use it???

My app. will be used by many different people who must install this by them selves. I think users shouldn't have to add this manualy the registry.
0
 

Author Comment

by:rick_mulder
ID: 1351284
The problem is that i tried to install the OCX file with regsvr32.

It works on my Winnt machine and Win98 machine. But on a pc with a very old win95 version regsvr32 is called regserv.exe.
When i try regserv.exe c:\windows\system\...ocx then nothing happens.

When i try to use the activex component, the message "class not found" appears.

davidmwilliams, you said i can make a batch file but where in the install shield can i use it???

My app. will be used by many different people who must install this by them selves. I think users shouldn't have to add this manualy the registry.
0
 
LVL 4

Expert Comment

by:davidmwilliams
ID: 1351285
 Are you sure regserv is the same as regsvr32?  If the ActiveX component can't be found I would suspect it is not the same.
  I'm sure you can bundle regsvr32 with your InstallShield installer anyway - I believe it is redistributable.
  I agree that end users should not have to be concerned with technical issues like this, that should be automated.
  I've just had a look in InstallShield Express now, and unfortunately it does not seem able to explictly run a program at your request, like you can do with InstallShield 5.  However - there are two things you can do.  At the final dialog, you can run programs and specify parameters, under the 'Settings' tab.  However, this means the user can influence this adversely by unchecking the 'Launch program' box.  Alternatively, in your InstallShield setup you could write to the 'RunOnce' registry key, and have it point to your .bat file.  Then, in this same spot in InstallShield, require that the computer be reset.  When it boots up, your bat file will run automatically, and only ever that one time.
0
 

Author Comment

by:rick_mulder
ID: 1351286
I checked the helpfile of the FormulaOne Component.

The following files are needed to run:
VCF132.OCX
MFCANS32.DLL
OC30.DLL
MSVCRT20.DLL

On the pc with a very old version of win95 the last 3 dll's are not present. Do you know what they do and if they are standard in windows. If they aren't present, can i just copy these files from another computer??
0
 

Author Comment

by:rick_mulder
ID: 1351287
Isn't it possible to download Install Shield 5.0 ??
0
 
LVL 4

Expert Comment

by:davidmwilliams
ID: 1351288
 You could probably download an evaluation version - try www.installshield.com -- but beware, it's not anywhere near as straightforward as InstallShield Express.
  The MSVCRT20.dll is a Visual C++ run-time file and the MFCANS32.DLL is a run-time file for the Visual C++ Microsoft Foundation Classes (MFC) - presumably therefore, the OCX was written in Visual C++.  These files are not standard in Windows, but you can just copy them from another computer.  Your InstallShield setup can just dump them in the appropriate directory with no further processing.
  I'm not sure what the OC30.DLL is, but if regsvr32 can't do anything with it, then I'd suspect it's more run-time libraries, and can be safely copied over.
0
 

Author Comment

by:rick_mulder
ID: 1351289
Is are the winnt dll's the same as the win95 dll's??
0
 
LVL 4

Expert Comment

by:davidmwilliams
ID: 1351290
 I shouldn't think there would be a problem with run-time libraries between NT and 95 (because both will be just calling the Win32 API on each platform).  However, you would be advised to manually install the files on both a 95 and an NT machine, and test.
0
 
LVL 4

Expert Comment

by:StevenB
ID: 1351291
 Install shield express 2.11 does allow you to run an executable as part of the installation, however the "lite" version which you get with Delphi does not. You can download the 15 day trial version of 2.11 from the install shield website. The Delphi version does however have a special feature "Select Install Shield Objects for Delphi" which I believe alows you to install the Sample ActiveX Components on the target machine as part of the install.
  I'd definitely recomend getting hold of version 2.11 and at least having a look. You'll see how easy it is and I can talk you through any problems you might have. Install Shield 5 is a completely different story and best avoided unless you need a hardcore installation application.

   Steven.
0
 
LVL 1

Expert Comment

by:slautin
ID: 1351292
Read(const pPathName: string; var pFileType: Smallint);
                              ^^^^^^^^^^^^^^
procedure Write(const pPathName: string; FileType: Smallint);
                                         ^^^^^^^^^^^^^^^

Understend differents!
0
 
LVL 1

Expert Comment

by:slautin
ID: 1351293
procedure Read(const pPathName: string; var pFileType: Smallint);
procedure Write(const pPathName: string; FileType: Smallint);

var pFileType AND FileType: Smallint - not identical parameters!

0
 
LVL 4

Expert Comment

by:davidmwilliams
ID: 1351294
I think Slautin clearly did not bother reading where the discussion was up to before submitting an answer ...
0
 
LVL 4

Expert Comment

by:StevenB
ID: 1351295
 Hey Rick, you still there? Christmas is over you know   :o)

  Steven  
0
 

Author Comment

by:rick_mulder
ID: 1351296
I'm sorry Steven. I was a few days away.
But now i'm here again. Slautin clearly didn't read the messages.

Ok. i guess now the best solution is to use the regsvr32 command is the best option to get what i want. Unless someone else has better idea.

The only real problem is that not all windows versions have a regsvr32.exe file.

By the way, a happy 1999 to u all!!!!!!!
0
 

Author Comment

by:rick_mulder
ID: 1351297
Well slautin,

I think you haven't read the whole story. I already have the answer to that question.



0
 
LVL 4

Expert Comment

by:StevenB
ID: 1351298
 Happy new year Rick.

  Steven.

  (PS If you're happy with the regsvr32 solution to the OCX registration then you should invite david to lock the question since he provided the answers initially.)
0
 

Author Comment

by:rick_mulder
ID: 1351299
I guess the regsvr32 solution is the best and only option.
So David, please respond so i can give you the points for this question.


0
 
LVL 4

Accepted Solution

by:
davidmwilliams earned 50 total points
ID: 1351300
Thanks, guys, I appreciate this.
I enjoyed thrashing this issue out with both of you - it was a good exchange, I felt.
0
 

Author Comment

by:rick_mulder
ID: 1351301
Thank you all for your help!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
code issue 8 85
QRReport  TQrmemo vertical stretching 1 37
select query - oracle 16 82
JAudiorecorder record freezing the app 30 35
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now