[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

BeeJ

5/29/2012 8:29:00 PM

Two part question

I am working with both VB6 file I/O and API file I/O.
If while running in the IDE, I encounter a File I/O problem and I quit
debugging the file may remain open or at least attached and cannot be
opened again in the IDE or copied or opened with Notepad from Windows
Explorer. If so, the trying to make subsequent runs is foiled since it
will not open the file again. The only way I know to recover is to
close the IDE and reopen the IDE and run again. This looses all the
breakpoints and bookmarks.

VB Reset in the code just before the next open attempts does nothing
for the problem. Reset can't seem to get at the attached / open files.

1) is there a way to force the IDE to close all files it has attached
to?

2) is there a way to capture and retain all breakpoints and bookmarks
for an easier reload of the IDE and the app?
MZTools has only (as far as I can figure) the ability to save favorite
methods but not breakpoints and bookmarks.

2a) is there an add-in that can save breakpoints and bookmarks? Are
breakpoints and bookmarks available so that someone could write an
add-in for that purpose? I might try if I thought there was a chance
but do not know the terminology for these ops.

--
So where are we?
Not the street address.
Not the city.
Not the country.
Not the Earth.
Not the Solar System.
Not the Galaxy.
Not the Universe.
Not the Brane.
So where is the Brane?
Where are we?

Life is but a dream!


16 Answers

unknown

5/29/2012 9:04:00 PM

0

"BeeJ" <nospam@spamnot.com> wrote in message
news:jq3bib$550$1@speranza.aioe.org...
> Two part question
>
> I am working with both VB6 file I/O and API file I/O.
> If while running in the IDE, I encounter a File I/O problem and I quit
> debugging the file may remain open or at least attached and cannot be
> opened again in the IDE or copied or opened with Notepad from Windows
> Explorer. If so, the trying to make subsequent runs is foiled since it
> will not open the file again. The only way I know to recover is to close
> the IDE and reopen the IDE and run again. This looses all the breakpoints
> and bookmarks.
>
> VB Reset in the code just before the next open attempts does nothing for
> the problem. Reset can't seem to get at the attached / open files.
>
> 1) is there a way to force the IDE to close all files it has attached to?
>
> 2) is there a way to capture and retain all breakpoints and bookmarks for
> an easier reload of the IDE and the app?
> MZTools has only (as far as I can figure) the ability to save favorite
> methods but not breakpoints and bookmarks.
>
> 2a) is there an add-in that can save breakpoints and bookmarks? Are
> breakpoints and bookmarks available so that someone could write an add-in
> for that purpose? I might try if I thought there was a chance but do not
> know the terminology for these ops.

Set dwShareMode parameter in the call to CreateFile() to the following:

FILE_SHARE_READ Or FILE_SHARE_WRITE

This will not close the file, but allows you to open it again.




Ralph

5/29/2012 10:07:00 PM

0

On Tue, 29 May 2012 13:29:01 -0700, BeeJ <nospam@spamnot.com> wrote:

>Two part question
>
>I am working with both VB6 file I/O and API file I/O.
>If while running in the IDE, I encounter a File I/O problem and I quit
>debugging the file may remain open or at least attached and cannot be
>opened again in the IDE or copied or opened with Notepad from Windows
>Explorer. If so, the trying to make subsequent runs is foiled since it
>will not open the file again. The only way I know to recover is to
>close the IDE and reopen the IDE and run again. This looses all the
>breakpoints and bookmarks.
>
>VB Reset in the code just before the next open attempts does nothing
>for the problem. Reset can't seem to get at the attached / open files.
>
>1) is there a way to force the IDE to close all files it has attached
>to?
>
>2) is there a way to capture and retain all breakpoints and bookmarks
>for an easier reload of the IDE and the app?
>MZTools has only (as far as I can figure) the ability to save favorite
>methods but not breakpoints and bookmarks.
>

Nope.

Won't say it is impossible but many have tried down the years and no
one has been successful. (There were a few utilities online that
supposedly worked for bookmarks - but generally failed when I tried
them.)

Bookmarks:

For returning to the same spot where you left off or any other spot,
you simply place an undeclared variable (with Option Explicit on), or
an operator out of context. Then when you open the IDE, and hit F5,
this will cause a syntax error and you will be immediately moved to
that location in the editor.

I use something like this ...
stopped_here, or thisisjumnk, or kkffjflslsl
Others with a tad more sophisticated will place a series of "!!!!",
"%%%", etc. after the line. Bob being 'classier' uses a double
dot/period at the beginning of the line.

For multiple bookmarks, MZTools' 'Favorites' works for me. Usually
gets me close enough, and then a comment or two, to fine tune the
closure.

Which leads to the most obvious solution - use comments. I use a
MZTools macro to add them ...
' BOOKMARK <fill in name>
Then I just search for "BookMark".

Breakpoints:

Simply insert the line ...
Debug.Assert False
Where ever you want the debugger to stop.

-ralph

Henning

5/29/2012 10:26:00 PM

0


"BeeJ" <nospam@spamnot.com> skrev i meddelandet
news:jq3bib$550$1@speranza.aioe.org...
> Two part question
>
> I am working with both VB6 file I/O and API file I/O.
> If while running in the IDE, I encounter a File I/O problem and I quit
> debugging the file may remain open or at least attached and cannot be
> opened again in the IDE or copied or opened with Notepad from Windows
> Explorer. If so, the trying to make subsequent runs is foiled since it
> will not open the file again. The only way I know to recover is to close
> the IDE and reopen the IDE and run again. This looses all the breakpoints
> and bookmarks.
>
> VB Reset in the code just before the next open attempts does nothing for
> the problem. Reset can't seem to get at the attached / open files.
>
> 1) is there a way to force the IDE to close all files it has attached to?
>
> 2) is there a way to capture and retain all breakpoints and bookmarks for
> an easier reload of the IDE and the app?
> MZTools has only (as far as I can figure) the ability to save favorite
> methods but not breakpoints and bookmarks.
>
> 2a) is there an add-in that can save breakpoints and bookmarks? Are
> breakpoints and bookmarks available so that someone could write an add-in
> for that purpose? I might try if I thought there was a chance but do not
> know the terminology for these ops.
>
> --
> So where are we?
> Not the street address.
> Not the city.
> Not the country.
> Not the Earth.
> Not the Solar System.
> Not the Galaxy.
> Not the Universe.
> Not the Brane.
> So where is the Brane?
> Where are we?
>
> Life is but a dream!
>
>

Not tried, but isn't it possible to Close in the immediate window?

/Henning


Dee Earley

5/30/2012 7:47:00 AM

0

On 29/05/2012 21:29, BeeJ wrote:
> Two part question
>
> I am working with both VB6 file I/O and API file I/O.
> If while running in the IDE, I encounter a File I/O problem and I quit
> debugging the file may remain open or at least attached and cannot be
> opened again in the IDE or copied or opened with Notepad from Windows
> Explorer. If so, the trying to make subsequent runs is foiled since it
> will not open the file again. The only way I know to recover is to close
> the IDE and reopen the IDE and run again. This looses all the
> breakpoints and bookmarks.
>
> VB Reset in the code just before the next open attempts does nothing for
> the problem. Reset can't seem to get at the attached / open files.
>
> 1) is there a way to force the IDE to close all files it has attached to?

No.
The IDE has no concept of anything you've opened by going direct to the
Win32 API.
As your code has stopped running, the file handle has been discarded, so
you can use Process Explorer to close the file.

The best way is to make sure you run/skip to CloseHandle(YourFileHandle)
before stopping.

This is one of the reasons that End (and the "stop" command) are very
frowned upon as they do no cleanup whatsoever.

--
Deanna Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)

Tony Toews

5/30/2012 5:33:00 PM

0

On Tue, 29 May 2012 13:29:01 -0700, BeeJ <nospam@spamnot.com> wrote:

>I am working with both VB6 file I/O and API file I/O.

I've noticed a similar problem with INI files when using the API
calls. I shrug a bit and mutter a few bad words.

I always uses stop rather than breakpoints as there bugs with
breakpoints years past in Access VBA.

As others have stated I use other tricks for code bookmarks.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/ac...
Tony's Microsoft Access Blog - http://msmvps.com/blo...
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeup...

BeeJ

5/31/2012 1:23:00 AM

0

Unfortunately this happens when I induce an error by making edits while
running. Then I cannot do anything other than acknowledge the error
which stops the editing / run session and leaves a file/folder
attached.

Sometimes it is not a file but an empty folder that I cannot delete
through Windows Explorer.

In both cases I have to exit the IDE and restart thus the desire for
saving bookmarks and breakpoints.

How about this - write an add-in that is like the Bookmark ops that
inserts comment text at the caret then can find these bookmarks with a
text search. That would be just as convenient as the Bookmark. Now
the question is can an Add-In set breakpoints? If so then have the
add-in button insert the breakpoint and a text comment. These would be
searchable too. Wonder how doable that is?

Anybody an expert add-in coder?

--
So where are we?
Not the street address.
Not the city.
Not the country.
Not the Earth.
Not the Solar System.
Not the Galaxy.
Not the Universe.
Not the Brane.
So where is the Brane?
Where are we?

Life is but a dream!


Ralph

5/31/2012 3:49:00 AM

0

On Wed, 30 May 2012 18:22:52 -0700, BeeJ <nospam@spamnot.com> wrote:

>Unfortunately this happens when I induce an error by making edits while
>running. Then I cannot do anything other than acknowledge the error
>which stops the editing / run session and leaves a file/folder
>attached.
>

Editiing what? The code? The file?
With what? The VBEditor (IDE)? Outside editor?

The only thing that would stop "Error, edit, and continue" from
working is a catastrophic error in the IDE itself - in which case if
you can't do it manually, then no Add-In is going to run either.

All the suggestions given should help to provide "bookmarks", insert
breakpoints, free files, etc. But apparently are not helpful...

So what's the real story? What is really going on? What is actually
causing failures of such magnitude that files and directories are
locked and the VBIDE can't continue?

What are you doing?

Perhaps you should just stop doing that. <g>

-ralph

Dee Earley

5/31/2012 8:20:00 AM

0

On 31/05/2012 02:22, BeeJ wrote:
> Unfortunately this happens when I induce an error by making edits while
> running. Then I cannot do anything other than acknowledge the error
> which stops the editing / run session and leaves a file/folder attached.

Then be careful to CloseHandle(XXX) from the immediate window.

> Sometimes it is not a file but an empty folder that I cannot delete
> through Windows Explorer.
>
> In both cases I have to exit the IDE and restart thus the desire for
> saving bookmarks and breakpoints.

Or just close them in process explorer.

> How about this - write an add-in that is like the Bookmark ops that
> inserts comment text at the caret then can find these bookmarks with a
> text search. That would be just as convenient as the Bookmark. Now the
> question is can an Add-In set breakpoints? If so then have the add-in
> button insert the breakpoint and a text comment. These would be
> searchable too. Wonder how doable that is?
>
> Anybody an expert add-in coder?

I have a simple addin I wrote a while back that does similar.
It looks for and lists 'TODO and 'FIXME comments with their description:
http://www.earlsoft.co.uk/projects/vbtasklist/VBTa...

I did have a nice page explaining it somewhere but I seem to have lost
it over the years.

I'll post a link to the repo as soon as I can copy it to my server.

--
Deanna Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)

Dee Earley

5/31/2012 8:35:00 AM

0

On 31/05/2012 09:20, Deanna Earley wrote:
> On 31/05/2012 02:22, BeeJ wrote:
>> How about this - write an add-in that is like the Bookmark ops that
>> inserts comment text at the caret then can find these bookmarks with a
>> text search. That would be just as convenient as the Bookmark. Now the
>> question is can an Add-In set breakpoints? If so then have the add-in
>> button insert the breakpoint and a text comment. These would be
>> searchable too. Wonder how doable that is?
>>
>> Anybody an expert add-in coder?
>
> I have a simple addin I wrote a while back that does similar.
> It looks for and lists 'TODO and 'FIXME comments with their description:
> http://www.earlsoft.co.uk/projects/vbtasklist/VBTa...
>
> I did have a nice page explaining it somewhere but I seem to have lost
> it over the years.
>
> I'll post a link to the repo as soon as I can copy it to my server.

http://code.earlsoft.co.uk/hg/v...

You can hg pull from this and all patches welcome :)

--
Deanna Earley (dee.earley@icode.co.uk)
i-Catcher Development Team
http://www.icode.co.uk...

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)

unknown

5/31/2012 1:58:00 PM

0

"Deanna Earley" <dee.earley@icode.co.uk> wrote in message
news:jq7ag4$v4u$1@speranza.aioe.org...
> On 31/05/2012 09:20, Deanna Earley wrote:
>> On 31/05/2012 02:22, BeeJ wrote:
>>> How about this - write an add-in that is like the Bookmark ops that
>>> inserts comment text at the caret then can find these bookmarks with a
>>> text search. That would be just as convenient as the Bookmark. Now the
>>> question is can an Add-In set breakpoints? If so then have the add-in
>>> button insert the breakpoint and a text comment. These would be
>>> searchable too. Wonder how doable that is?
>>>
>>> Anybody an expert add-in coder?
>>
>> I have a simple addin I wrote a while back that does similar.
>> It looks for and lists 'TODO and 'FIXME comments with their description:
>> http://www.earlsoft.co.uk/projects/vbtasklist/VBTa...
>>
>> I did have a nice page explaining it somewhere but I seem to have lost
>> it over the years.
>>
>> I'll post a link to the repo as soon as I can copy it to my server.
>
> http://code.earlsoft.co.uk/hg/v...
>
> You can hg pull from this and all patches welcome :)
>
> --
> Deanna Earley (dee.earley@icode.co.uk)
> i-Catcher Development Team
> http://www.icode.co.uk...

If you are going to add comments through Add-ons, I suggest comments like
the following:

'{#BM:BookmarkCategoryHere:BookmarkNameHere}+

I was going to use something like that for an Add-on that adds Macro support
for VB. I would use "+" and "-" at the end to indicate if the macro was
expanded or not, so if something goes wrong like the IDE crashing, I know
how to compact the Macro. This also doesn't require me to store information
about the modified lines in external database with line numbers of the
changes, because there is a possibility that they would go out of sync if
the file was modified outside the IDE or restored from a backup, etc., so
all the information that I need are in the source code.

<Yes, I stole the {#BM} idea from how Inno Setup use similar features :-) >