Papierkorb auslesen

The place for programming-related topics.
thomas

error executing exe-file

Post by thomas »

Hi,
read this thread very interested and tried to test the last posted exe (Projekt1.exe 9.9.05)
Thought, I could start it without installing any typelibs. But when I press the 'start'-Button, I get the error-message 'Laufzeitfehler 91 - Objektvariable oder with-block nicht festgelegt'.
I didn't install the mentioned typelibs jet, as I have already two versions of older typelibs of extreview on my system. (BTW: great help!).
What do you recommend?
Thanks in advance! Thomas
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

You shouldn't need any typelibs to run the exe, because typelibs are compiled into it.
I suggest you open the project in Visual Basic (note: you'll need the typelib to do this) and run it with the debugger. This should tell you the line of code in which the problem occurs.

BTW, which version of Windows do you use?

TiKu
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Thomas

error executing exe-file

Post by Thomas »

Error occurs in line

IRecycleBin.EnumObjects Me.hWnd, enumFlags, IEnum

in sub

command1_click

where IEnum is producing the error-message.

Im workin under W2K SP4, VB6 SP6 installed.

BTW: Is there a comfortable way, to change extreeview-controls in existing projects into new versions? Or is it still necessary, to delete the old one, insert the new one and adjust all the properties?

(again: a really helpfull and mighty ocx! Thanks a lot. First version I worked with was 1.6x)
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Re: error executing exe-file

Post by TiKu »

Thomas wrote:Error occurs in line

IRecycleBin.EnumObjects Me.hWnd, enumFlags, IEnum

in sub

command1_click

where IEnum is producing the error-message.
Are you sure IEnum is the problem? I'm pretty sure that IRecycleBin is Nothing. However, I don't know why it should be Nothing. Do you have the Recycler's icon removed from your desktop? That's the only reason I can think of, that may lead to IRecycleBin being Nothing.
Thomas wrote:BTW: Is there a comfortable way, to change extreeview-controls in existing projects into new versions? Or is it still necessary, to delete the old one, insert the new one and adjust all the properties?
Huh?:? This shouldn't be necessary. The following should work just fine:
- replace the old version of ExTvw.ocx with the new one (or register the new one with regsvr32.exe)
- test whether your compiled programs are still working
- if they don't, simply recompile them

TiKu
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Guest

Post by Guest »

Thanks first!!
Are you sure IEnum is the problem?
Well, if I call ?IEnum in the direct-window of VB-IDE while debugging the error-code it produces just this error-message: "Laufzeitfehler 91...".
But, at the same time, your right: I removed the recyclers-icon from the desktop.
But, even after rebuilding it with rightclick-> new folder, caption
"Papierkorb.{645FF040-5081-101B-9F08-00AA002F954E}" the error still remains.
- (or register the new one with regsvr32.exe)
this means, that I have to deregister the old version first?

again btw:
regsvr32 "E:\thomas\Vb\OCX\extvw1.11.1\Typelibs\explorer Treeview.tlb"
tells me, load library failed, 'das angegebene modul wurde nicht gefunden'. Path is correct.
Setting the 'Verweise'-path in VB6 in your demo-projekt helps only for this session. Even though I saved the project, the tlb isnt found the next start of the vb-IDE.

Thanks for your help again!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

Anonymous wrote:Well, if I call ?IEnum in the direct-window of VB-IDE while debugging the error-code it produces just this error-message: "Laufzeitfehler 91...".
Replace the following line

Code: Select all

IRecycleBin.EnumObjects Me.hWnd, enumFlags, IEnum
with this:

Code: Select all

Debug.Print Hex(IRecycleBin.EnumObjects(Me.hWnd, enumFlags, IEnum))
and tell me what it prints out. It should be 0.
Anonymous wrote:this means, that I have to deregister the old version first?
You can do this, but it isn't necessary, because the entries will be overwritten when you register the new version.
Anonymous wrote:again btw:
regsvr32 "E:\thomas\Vb\OCX\extvw1.11.1\Typelibs\explorer Treeview.tlb"
tells me, load library failed, 'das angegebene modul wurde nicht gefunden'. Path is correct.
No, you don't register the tlb. You register the ocx - at least if you want to use the ActiveX control.
The tlb is a different beast. It is independent from ExplorerTreeView. The only reason it is called ExplorerTreeView.tlb, is that I'm using it inside ExplorerTreeView. To update the tlb, it is the best to simply overwrite the old file with the new one.
Anonymous wrote:Setting the 'Verweise'-path in VB6 in your demo-projekt helps only for this session. Even though I saved the project, the tlb isnt found the next start of the vb-IDE.
Yes, that's a known problem of VB6. If you have only one instance of a tlb on your system, everything works fine. But if you have multiple instances, VB6 sometimes goes nuts.
Also don't forget to save the project after you've corrected the 'Verweise' path.

TiKu
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Thomas

Post by Thomas »

Debug.Print Hex(IRecycleBin.EnumObjects(Me.hWnd, enumFlags, IEnum))
that doesnt print out nada. It produces the mentioned error 91. Shouldn't you expect this as IEnum is producing the error?
replace the old version of ExTvw.ocx with the new one (or register the new one with regsvr32.exe)
this works fine now, wonderful! It didn't so in the builds, I have been working with. Thanks! Well done!
Yes, that's a known problem of VB6. If you have only one instance of a tlb on your system, everything works fine. But if you have multiple instances, VB6 sometimes goes nuts.
Im not shure what you mean with 'multiple instances'. From this .tlb I have only one on my system, I prooved it.
This problem persists even after registring the current version of your ocx. (I DID save the projekt after setting the tlb-verweis).

(maybe I won't answer today. Read you tomorrow! Thanks again.)
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

Thomas wrote:that doesnt print out nada. It produces the mentioned error 91. Shouldn't you expect this as IEnum is producing the error?
Well, that's why I asked whether you are sure, that IEnum is causing the error.;) IEnum gets set in this line and is Nothing before. If this line fails, then IRecycleBin is Nothing.

Code: Select all

  SHGetSpecialFolderLocation Me.hWnd, CSIDL_BITBUCKET, pIDLRecycleBin
Debug.Print pIDLRecycleBin
Debug.Print Hex(IDesktop.BindToObject(pIDLRecycleBin, 0, IID_IShellFolder, IRecycleBin))
Debug.Print (IRecycleBin Is Nothing)
What does this print out? I'm pretty sure the last line gives a "Wahr".
Im not shure what you mean with 'multiple instances'. From this .tlb I have only one on my system, I prooved it.
With 'multiple instance' I mean that the tlb file exists more than once on your system.
This problem persists even after registring the current version of your ocx. (I DID save the projekt after setting the tlb-verweis).
Once again: The ocx has nothing to do with the tlb.
The following procedure should work. If it doesn't, I'm out of ideas.
- replace all copies of ExplorerTreeView.tlb on your system with the new one
- open the project
- if it complains that it can't find the tlb, click on "Durchsuchen" in the "Verweise" dialog and select the tlb
- save the project

Sometimes this still won't work. In such cases, I remove all registry entries that the tlb is creating and try from scratch.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Thomas

Post by Thomas »

Well, i notice, that your custom-working-hours are not as usual as lets say a teacher's time-table ;-)
Debug.Print pIDLRecycleBin
Debug.Print Hex(IDesktop.BindToObject(pIDLRecycleBin, 0, IID_IShellFolder, IRecycleBin))
Debug.Print (IRecycleBin Is Nothing)
gives you
0
80070057
Wahr
so its 'wohl wahr' what you supposed ;-)
- replace all copies of ExplorerTreeView.tlb on your system with the new one
as I told you, I got just the one, I downloaded today, no older tlbs on my system! Explorer-search over all partitions just shows me the one I put the 'verweis' to each session, I start your project first.
I remove all registry entries that the tlb is creating
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Explorer Bars\{C4EE31F3-4768-11D2-BE5C-00A0C9A83DA1}\FilesNamedMRU, key is '000' value is filename
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\*, key is 'f', value is the full patz
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\tlb, Key is 'a', value is the full path
HKEY_USERS\S-1-5-21-1801674531-1078145449-839522115-1000\Software\Microsoft\Internet Explorer\Explorer Bars\{C4EE31F3-4768-11D2-BE5C-00A0C9A83DA1}\FilesNamedMRU, key is '000', value again filename
HKEY_USERS\S-1-5-21-1801674531-1078145449-839522115-1000\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\*, key is 'f', value full path
HKEY_USERS\S-1-5-21-1801674531-1078145449-839522115-1000\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\tlb, key is 'a', value full path

no other hits for search for ExplorerTreeView.tlb in registry.
Should I just delet those keys?

Hope not to bother you. Thanks and good night!
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

Thomas wrote:
Debug.Print pIDLRecycleBin
Debug.Print Hex(IDesktop.BindToObject(pIDLRecycleBin, 0, IID_IShellFolder, IRecycleBin))
Debug.Print (IRecycleBin Is Nothing)
gives you
0
80070057
Wahr
so its 'wohl wahr' what you supposed ;-)
So our problem is, that pIDLRecycleBin is zero. Obviously SHGetSpecialFolderLocation is failing and I've no clue why it does fail, sorry. You may take a look at the return value of SHGetSpecialFolderLocation. It should be 0 (which means success) and I guess it isn't 0.
You may also call the API 'CoInitialize' in your Form_Initialize, but I guess it won't help, because AFAIK the Visual Basic runtime already calls this API and calling it once per thread is enough.
I remove all registry entries that the tlb is creating
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Explorer Bars\{C4EE31F3-4768-11D2-BE5C-00A0C9A83DA1}\FilesNamedMRU, key is '000' value is filename
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\*, key is 'f', value is the full patz
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\tlb, Key is 'a', value is the full path
HKEY_USERS\S-1-5-21-1801674531-1078145449-839522115-1000\Software\Microsoft\Internet Explorer\Explorer Bars\{C4EE31F3-4768-11D2-BE5C-00A0C9A83DA1}\FilesNamedMRU, key is '000', value again filename
HKEY_USERS\S-1-5-21-1801674531-1078145449-839522115-1000\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\*, key is 'f', value full path
HKEY_USERS\S-1-5-21-1801674531-1078145449-839522115-1000\Software\Microsoft\Windows\CurrentVersion\Explorer\ComDlg32\OpenSaveMRU\tlb, key is 'a', value full path

no other hits for search for ExplorerTreeView.tlb in registry.
Should I just delet those keys?
No, those entries are created by Windows Explorer and other programs.
Look for this entry and delete it:
HKEY_CLASSES_ROOT\TypeLib\{8F20FF30-ABD6-4FD4-A63E-50EC2D38B741}
Another thing that should make the beast work: Open HKEY_CLASSES_ROOT\TypeLib\{8F20FF30-ABD6-4FD4-A63E-50EC2D38B741}\1.7\0\win32 and make sure it contains the correct path to the tlb.

Good night
TiKu
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Thomas

Post by Thomas »

Mornin!
You may take a look at the return value of SHGetSpecialFolderLocation.
ii = SHGetSpecialFolderLocation(Me.hWnd, CSIDL_BITBUCKET, pIDLRecycleBin)
produces error: "Fehler beim Kompilieren: Function oder variable erwartet", because the api is declared as a SUB. Changing the declaration of the api to FUNCTION makes the IDE Crash: "VB hat fehler verursacht und wird geschlossen".
As I noticed today, in
IRecycleBin.EnumObjects Me.hWnd, enumFlags, IEnum
IEnum is NOTHING. dunno if it helps.

But I have a welcome feedback as well:
I coped with the tlb-problem: Opening the .vbp in an editor, deleting
Reference=*\G{8F20FF30-ABD6-4FD4-A63E-50EC2D38B741}#1.7#0#D:\Projekte\VB6\ExplorerTreeView\res\tlb\bin\ExplorerTreeView.tlb#TimoSoft Shell-Interfaces for ExplorerTreeView
starting the vbp in VB6, adding the korrekt tlb-Link, saving changed the behavior: Now VB stored the korrekt reference
Reference=*\G{8F20FF30-ABD6-4FD4-A63E-50EC2D38B741}#1.7#0#..\..\..\Vb\OCX\extvw1.11.1\Typelibs\ExplorerTreeView.tlb#TimoSoft Shell-Interfaces for ExplorerTreeView
what it refused to do before, I dunno why.

The reg-entry HKEY_CLASSES_ROOT\TypeLib\{8F20FF30-ABD6-4FD4-A63E-50EC2D38B741}\1.7\0\win32 contained the correct path, btw.

Im really sorry about the troubles but would be glad to get your demo working.
Thanks again! TH
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

Good morning,
Thomas wrote:
You may take a look at the return value of SHGetSpecialFolderLocation.
ii = SHGetSpecialFolderLocation(Me.hWnd, CSIDL_BITBUCKET, pIDLRecycleBin)
produces error: "Fehler beim Kompilieren: Function oder variable erwartet", because the api is declared as a SUB. Changing the declaration of the api to FUNCTION makes the IDE Crash: "VB hat fehler verursacht und wird geschlossen".
Oops, my fault. I took the declaration from APIViewer without checking it for correctness. SHGetSpecialFolderLocation should be a function with a return value of type Long. Please change it and try again.
Thomas wrote:As I noticed today, in
IRecycleBin.EnumObjects Me.hWnd, enumFlags, IEnum
IEnum is NOTHING. dunno if it helps.
As I said, that's normal, because this line sets IEnum. Until then, it is of course Nothing.
Thomas wrote:I coped with the tlb-problem
Glad to hear that.
Thomas wrote:Im really sorry about the troubles
No problem. That's what the forum is for.
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Thomas

Post by Thomas »

SHGetSpecialFolderLocation should be a function with a return value of type Long. Please change it and try again.
I changed the SUB to FUNCTION but didn't define the function as LONG, sorry.

Now
ii = SHGetSpecialFolderLocation(Me.hWnd, CSIDL_BITBUCKET, pIDLRecycleBin)
returns
-2147024809 (hex 80070057)

which is the same that
Hex(IDesktop.BindToObject(pIDLRecycleBin, 0, IID_IShellFolder, IRecycleBin))
returns

any new ideas?
User avatar
TiKu
Administrator
Administrator
Posts: 832
Joined: 28 Sep 2004, 21:10
Location: München
Contact:

Post by TiKu »

Thomas wrote:Now
ii = SHGetSpecialFolderLocation(Me.hWnd, CSIDL_BITBUCKET, pIDLRecycleBin)
returns
-2147024809 (hex 80070057)
This error code means "One or more arguments are invalid". It seems like for some spooky reason your system doesn't support the CSIDL_BITBUCKET constant.
Try the following code:

Code: Select all

Private Const CSIDL_DESKTOP = &H0
Dim pIDLDesktop As Long

SHGetSpecialFolderLocation Me.hWnd, &H0, pIDLDesktop
Debug.Print pIDLDesktop
If this gives you a 0, too, the problem seems to exist for all system folders and not only for the recycler. However, this awareness won't help us, because I've absolutely no idea why a system shouldn't support CSIDL_BITBUCKET.
On Windows 2000 and above, there exists an alternative API: SHGetFolderLocation.

Code: Select all

Private Declare Sub SHGetFolderLocation Lib "shell32.dll" (ByVal hwnd As Long, ByVal csidl As Long, ByVal hToken As Long, ByVal dwFlags As Long, ByRef ppidl As Long)

SHGetFolderLocation Me.hWnd, CSIDL_BITBUCKET, 0, 0, pIDLRecycleBin
But I'm pretty sure, it won't work either, because AFAIK they both use the same code internally.

TiKu
Crunching for Fab36_Folding-Division at Folding@Home. Join Fab36/Fab30! - Folding@Home and BOINC
Boycott DRM! Boycott HDCP!
Guest

Post by Guest »

SHGetSpecialFolderLocation Me.hWnd, &H0, pIDLDesktop
Debug.Print pIDLDesktop
gives 1670016, not 0.

ii = SHGetFolderLocation(Me.hwnd, CSIDL_BITBUCKET, 0, 0, pIDLRecycleBin)
Debug.Print pIDLRecycleBin, ii, Hex(ii)
gives
0 -2147024809 80070057

Hope, it helps!
Post Reply