How do I save and restore all the vb6 ide settings? - ide

I've seen this tip on DevX which should 'account for most of the Visual Basic IDE settings'.
Does anyone whether this is sufficient or whether there are more settings out there?

It looks pretty complete, however if you have custom Add-Ins this will not get them. I did a quick search of my Add-Ins and I don't see any generic way of backing them up as they have their own registry keys. The HKEY_CURRENT_USER\Software\Microsoft\Visual Basic\6.0 has an Addins sub-folder so if you have custom add-ins you should at least get a message that they can't be found. Otherwise, use Process Monitor and take note of the registry keys and files that are read when you start Visual Basic.

They are stored in these two registry keys:
HKEY_CURRENT_USER\Software\Microsoft\VBA\Microsoft Visual Basic HKEY_CURRENT_USER\Software\Microsoft\Visual Basic\6.0
Access them by running Regedit.

Related

Debug .NET com dll when running from Access

I have a com dll developed in VB.net that provides an interface to eBay api's. Been working for many years. Recently eBay change certificate authority and moved to TLS 1.2. Sorted through that but now the dll seems to quit in mid transaction when called from Access. The functionality does listings from local inventory to eBay. The first part loads pictures of the listing item to eBay. That works fine. I can see the calls and responses using Fiddler. It then moves on to actually listing the item which seems to stop when called from Access. What I get back in Access is "Can't find x.dll at file location". I know the call is going to the dll because it uploads the pictures.
I have a test project developed in VB.net to test the dll and when run from that everything works. I can see the listing call and response in fiddler. When run from Access there is no listing call. I can verify that the endpoints for the calls are the same from test project or Access.
My question is how to debug the dll in the Visual Studio IDE when it is called from Access. Any thoughts?
Yes, the way you do this is open up the vs class you have for the .dll.
Then in debug of the project, setup this:
Now, when you hit f5, then access will launch and run.
If at this point, say you close access (exit), then you note the debugging process stops.
However, go though the forms and whatever in Access, and get to the point where you hit that button or whatever.
You find now that you can say set a break point and even step and debug your .net code like any other code. So say in my example (a custom sage 300 .net interface to access), I want to debug "find customer" routine from VBA.
Well, in vb.net I have this code:
so, when any routine - even those in the class instances is called, you can set break-points etc.
And to stop? Just exit access.
So, you can make a change to your code, and even hit f5.
It not clear how you are registering your .dll (or do you use some VBA to side-load the .net - that's what I do, since it is a pain to have to register my .net com objects on each PC.
But, do give the above a try. It should let you debug your .dll code. The trick is to have VS launch ms-access as a attached debug session - and that is exactly what the above setting in your class project above allows you to do.
do note in above, I used the path to access 2010 (access 14), so replace the path name to the access.exe with your version of access you are using.
And keep in mind, that if have some installer, or some custom "thing" that registers your .net .dll for you?
Well, during this process, if your VBA assumes a registered com object, then ensure you have this check box enabled:
On compile for the project settings, you thus want this option checked:
NOTE very careful, checking the above option does not change the code or anything at all - it ONLY does a regasum automatic for you, and this would of course re-register your existing .dll - which is what we want for debugging. After you done, do run your re-register of your .dll to switch back from the debug .dll that going to be in your current project bin folder to whatever you "regular" use on your PC.
FYI:
In MOST cases, I find this whole idea does NOT work unless you launch VS as administraor. So, make sure VS is being run as administraor for this to work.
I tend to just tap windows key, or even right click on your vs shortcut, and of course choose run as administraor.
This is so often required, you note that VS will EASY and quite CLEAR show you running in admin mode, and I quite much now always run VS this way.
You should see this:

Is Implementing IDTExtensibility2 And Registering An Add-In Not Enough For It To Be Visible To Office?

So, I am trying to create a COM Add-In for 64-bit MS Office (no application in particular, just trying to get something working). I am not trying to make an add-in for the VBE, just something for the Office application itself. I have implemented IDTExtensibility2 like this (top of the file):
<Guid("94164866-CD9D-497A-9A8B-B476BE39749F"),
ProgId("COM_Add-In_Test.Connection"),
ComDefaultInterface(GetType(IDTExtensibility2)),
ClassInterface(ClassInterfaceType.None), ComVisible(True)>
Public Class Connection
Implements IDTExtensibility2
I have added registry entries under HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\Excel\Addins\COM_Add-In_Test.Connection (FriendlyName, Description, and LoadBehavior).
The add-in is automatically registered for COM-Interop by Visual Studio (the box is checked).
I have also tried adding registry entries manually under HKCU\Classes\CLSID{94164866-CD9D-497A-9A8B-B476BE39749F}, but to no avail.
When I load up Excel, the add-in is not in the COM Add-Ins dialog box and nothing happens (My OnConnection method is MsgBox("Hello World!")).
I am not using any add-in framework of any kind (VSTO, ExcelDNA, etc). I have used these before, but would very much like to understand how to do this process manually.
What am I missing here?
So, after doing some research, this is what I found:
Don't have Visual Studio register COM interop classes for you.
Use the RegAsm tool with the /reg argument to have it generate a .reg file for you.
Edit the .reg file and replace references to HKEY_CLASSES_ROOT with references to HKEY_LOCAL_MACHINE\SOFTWARE\Classes, if you don't want to require admin rights to install. Example:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{YOUR_GUID}]
#="YOUR_PROG_ID"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{YOUR_GUID}\Implemented Categories]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{YOUR_GUID}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{YOUR_GUID}\InprocServer32]
#="mscoree.dll"
"ThreadingModel"="Both"
"Class"="YOUR_PROG_ID"
"Assembly"="YOUR_ASSEMBLY_FULL_NAME"
"RuntimeVersion"="v4.0.30319"
"CodeBase"="file:///PATH_TO_YOUR_DLL"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{YOUR_GUID}\InprocServer32\1.0.0.0]
"Class"="YOUR_PROG_ID"
"Assembly"="YOUR_ASSEMBLY_FULL_NAME"
"RuntimeVersion"="v4.0.30319"
"CodeBase"="file:///PATH_TO_YOUR_DLL"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{YOUR_GUID}\ProgId]
#="YOUR_PROG_ID"
Use add-in spy (available here: https://github.com/NetOfficeFw/AddInSpy) to help diagnose problems and monitor your progress along the way.

How to show custom update/modifications text when I publish my outlook-addin. VB.NET

Recently I have created an Addin for my outlook 2013 in VB.net. I usually do a lot of modifications on this application especially in the beginning. These modification automatically download when a user starts its outlook as soon I publish the project.
The question I have, and which I cant seem to figure out how to do it is:
Is it possible to show the user some kind of custom made UPDATE pop-up text when outlook automatically updates the addin?
So a user starts its outlook, then the outlook usually executes the updates pretty fast and then I want them to show some kind of message which contains the updates being done.
I have no clue if this is possible though and I cant seem to find an option for it in the publish tab of visual studio. Can this be done with code, and if so, how?
ClickOnce doesn't provide anything for that. See Deploying an Office Solution by Using ClickOnce for more information.
In the new version of the software which you are going to publish you may add a message box. It can be shown for the first run only. For example, add a windows registry key which indicates that the add-in (new version) is run for the first time. Reading the value at runtime will help you to decide whether such message box is required or not.

vb.net sequential file access

I'm working on finding a way to monitor a folder's files.
I want to get information on what files are used the most in a folder.
I've looked into using vb.net FileSystemWatcher but it doesn't seem to contain any classes for this. The articles I've found don't mention anything functions like this. I found one forum that said to use the timestamp from LastAccess in FileSystemWatcher. But the description doesn't really match that function.
Is there a way in vb.net to do this?
The FileSystemWatcher is indeed the class you want to use.
The msdn documentation contains an example of how to use it.
Just ensure you are setting the NotifyFilter to use the LastAccess filter:
watcher.NotifyFilter = NotifyFilters.LastAccess
This way you could create an application or service that monitors your folder and count how often each file is accessed.
But to have this work, you have to have the Last Access Time functionality enabled. By default, this is disabled on Windows Vista and up.
You can enable/disable this by either using this registry key
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisableLastAccessUpdate
or by simply running
fsutil behavior set disablelastaccess 0
from a command prompt with administrator rights.

File Cannot Be Saved Because it is Write-Protected

I am using Visual Web Developer 2010 Express and I just added my files into Visual SourceSafe. When I try to save files in Visual Web Developer, it says, "The file cannot be saved because it is write-protected." It gives me the option to overwrite, but I don't know if that's how it's supposed to work. Ideally, I will click save and it will save the various versions into source safe. I've never used source safe before; my previous source-control system just enabled be to click "commit."
Files under source control are marked as read-only to prevent accidental changes to files and only made writeable when you check them out for editing.
Because there is no source control integration with the Visual Studio Express 2010 editions when you make an edit the file is not automatically checked out from source control so it remains read-only, thus causing the problem you have here.
You either need to check out the files before editing the project or force an overwrite and then check out the file after the event. Neither of which is an ideal solution.
When you add items to source control, such a Source Safe, it marks them as Read Only to ensure they are not written by anyone who has not checked-out the files.
You need to check-out the file you wish to edit, then edit it, save it, then check it back in.
Source Safe is rather old and not really maintained by Microsoft anymore - consider using something more modern like Subversion or Git.