Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Viewing installed ocx and dlls from within my app

Status
Not open for further replies.

Bryan - Gendev

Programmer
Jan 9, 2011
408
AU
I am having trouble getting WIN 8 to register ocx and dll files from my inno setup file. This has never been a problem in previous versions of Windows with my app.

Does anyone have some code procedure that I can 'hide' in my app so that when a user has a problem related to one of the installed files I can inspect the situation as it is on their PC?

I would expect to be able to nominate the ocx and dlls used in my app in the requested code.

Thanks

GenDev
 
PS to the above. I have incorporated the GetDSNs PROCEDURE as a test and this works well.

GenDev
 
To see whether an OCX is in place and correctly registered, try to use it and catch errors instanciating it. If runtime DLLs are missing, the EXE won't start at all. If you're using other dlls, use FILE() or ADIR() to see they are there. Using system DLLs? MSDN tells you a minimum windows version and also deürecation. DECLARE will then fail or calling a declared function will fail. So you could write several test routines.

Bye, Olaf.
 
The ocx and other non-VFP dlls are all in the program folder via the setup inno file installation.

I will have to learn about error catching within the app. I have only used on error when creating tables.

GenDev
 
I will have to learn about error catching within the app.

Here's some code to get you started:

Code:
* Test for a missing OCX
lnErrorNum = 0
TRY
loTest = CREATEOBJECT("myOCX")
CATCH TO loError
  lnErrorNum = loError.ErrorNo
ENDTRY
IF lnErrorNum > 0
  IF lnErrorNum = 1733  && "Class definition ... not found"
    * OCX missing, or error in class name (myOCX in this example)
  ELSE
    * Some other problem with the CREATEOBJECT()
ENDIF

* Test for a missing DLL
lnErrorNum = 0
TRY
  DECLARE INTEGER MyFunctionName IN MyDLL
CATCH TO loError
  lnErrorNum = loError.ErrorNo
ENDTRY
IF lnErrorNum > 0
  IF lnErrorNum = 1754  && "Cannot find entry point ... "
    * DLL missing, or error in function name (MyFunctionName in this example)
  ELSE
    * Some other problem with the DECLARE()
ENDIF

However, note what Olaf said about the DLL being physically missing. In that case, your EXE wouldn't even load. But the above code will tell you if an OCX is missing, or if you are trying to use the wrong class in an OCX or the wrong function in a DLL.

Mike




__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thanks Mike,

I distribute both ocx and dll files so they shouldn't be missing but I will check before running the tester.

Again thanks for your continued help to a tryer.

GenDev
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top