CTL3DV2.DLL - crashing 
Author Message
 CTL3DV2.DLL - crashing


Quote:
Davison) writes:

>I would be forever grateful if someone could check this code and tell me
>why it constantly causes apps to crash.  All the code is stored in a .bas
>file which i add to many of my projects - usually with the same
>catastrophic results.

>Start3d is called in Form_Load, and End3d from Form_Unload.
>Using Win 3.10 and VB 3.0 (Standard)

>Many thanks in advance!

The code looks correct, but there is a bit more to using it than that.
You have to make sure no matter HOW the user ends the app (System Menu,
task bar cancel, File menu END, or you code does an unload or an END )
that the unregister code gets called.

The second issue is that it is difficult to use in the IDE.  You cant Hit
Ctl Break and then stop your app.  This prevents the normal shut down
stuff from happening andhence the End3D is not called and WHAMMO, it
crashes.

More info at:
How to Use CTL3D.DLL in Your Visual Basic Program

Article ID: Q113898

Copyright (c) Microsoft Corporation. All rights reserved.



Sun, 26 Jul 1998 03:00:00 GMT  
 CTL3DV2.DLL - crashing

Your code looks good.  The only thing I can suggest is that you test
that the line:

   hInstance = GetModuleHandle(App.EXEName)

gives you a valid module handle, that is, test that hInstance <> 0
before using it to register your app with ctl3d.  Also, I've looked at
an old project of mine and the way I got my module handle was:

   hMod = GetModuleHandle(app.exename & ".exe")

I can't check to see why I appended the ".exe" since I don't have VB30
on disk anymore.  However, consider this snippet from MSVC 4.0's help
file about the argument passed to the function:

--------
"Points to a null-terminated string that names a Win32 module (either
a .DLL or .EXE file). If the filename extension is omitted, the
default library extension .DLL is appended. The filename string can
include a trailing point character (.) to indicate that the module
name has no extension. The string does not have to specify a path. The
name is compared (case independently) to the names of modules
currently mapped into the address space of the calling process."
--------

I know the above refers to Win32 but the Win31 API help file doesn't
say much about the function.  HTH.

George


Quote:
>I would be forever grateful if someone could check this code and tell me
>why it constantly causes apps to crash.  All the code is stored in a .bas
>file which i add to many of my projects - usually with the same
>catastrophic results.

>Start3d is called in Form_Load, and End3d from Form_Unload.
>Using Win 3.10 and VB 3.0 (Standard)

>Many thanks in advance!

>--

>>>Redeye<<

>----------------------------
>Option Explicit

>Declare Function GetModuleHandle Lib "Kernel" (ByVal lpModuleName As
>String) As Integer
>Declare Function Ctl3dRegister Lib "CTL3DV2.DLL" (ByVal hInstance As
>Integer) As Integer
>Declare Function Ctl3dAutoSubClass Lib "CTL3DV2.DLL" (ByVal hInstance As
>Integer) As Integer
>Declare Function Ctl3dUnRegister Lib "CTL3DV2.DLL" (ByVal hInstance As
>Integer) As Integer

>Sub End3D ()

>    Dim hInstance As Integer
>    Dim nReturn As Integer

>    hInstance = GetModuleHandle(App.EXEName)
>    nReturn = Ctl3dUnRegister(hInstance)

>End Sub

>Sub Start3D ()

>    Dim hInstance As Integer
>    Dim nReturn As Integer

>    hInstance = GetModuleHandle(App.EXEName)
>    nReturn = Ctl3dRegister(hInstance)
>    nReturn = Ctl3dAutoSubClass(hInstance)

>End Sub

===============================================================================
 George R. Torralba              xxxxxxxxxxxx                  Batang Cebu!!!
 Seattle, Washington             206.277.0821              MIME mail accepted
===============================================================================


Sun, 26 Jul 1998 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. ctl3dv2.dll * MS-Office = CRASH!!!

2. CTL3dV2 MS-OFFICE = CRASH!!!

3. CTL3D.DLL and CTL3DV2.DLL?

4. CTL3DV2.DLL disappearing from client's machine

5. CTL3DV2.DLL error message

6. "ctl3dv2.dll" usage question

7. CTL3DV2.DLL Won't Load - Arrgh!

8. CTL3DV2.DLL

9. CTL3dv2.dll usage

10. ctl3dv2.dll conflicts

11. ctl3dv2.dll

12. CTL3DV2.DLL causes STACK Fault

 

 
Powered by phpBB® Forum Software