VB6 designer doesn't display opened modules - vb6

Forms and Modules in VB6 don't show when I double click them. In order to have them appear on screen I have to click Window > Cascade and everything moves into place, but when I open them from the project view nothing appears.
It seems like designer windows are displayed out of view... how can I fix this?

The form windows positioning, and which forms are open, is stored in the ProjectName.vbw file. Delete that file then open your project and the previous form windows settings are forgotten. The .vbw file should not be added to your source control system, there's nothing in it that is needed for code history reasons.

Related

disable items showing up in windows 10 timeline

I have a win32 text editor app. Every file that opens in it is automatically added to the Windows 10 timeline. The problem is that these entries in the timeline are useless because they don't actually work (i.e., you can't click on them to re-open the file in my editor), and instead of the editor app name the timeline shows the AppUserModelID instead.
Is there an API that I can call to prevent Windows from adding the files opened in my editor to the timeline? Or maybe an entry in the apps manifest?
Note that I'm setting the AppUserModelID to control the Jumplist feature, which I'd like to keep. I just don't want the files to show up in the timeline.
Also it seems that only files added to the recent docs with SHAddToRecentDocs show up.
Or maybe there's a way to get the entries in the timeline to work properly (i.e., when clicked open them in my editor, and have the app name show up properly).
update:

MFC EditBrowse control does not display the folder icon at runtime

I have a dialog type application that includes a MFC EditBrowse Control. This control includes a folder/magnifier icon on the right side where the user is supposed to click to bring up a folder browser pop-up.
That folder/magnifier icon displays properly in the dialog editor within Visual Studio, but at runtime it displays as a plain flat button. It behaves properly otherwise - that is, the browser pop-up pops up and the selected folder is displayed when the user clicks OK.
When run with the debugger a message is displayed in the VS Output Window saying "Can't load bitmap: 4299". That message is displayed after the CDialogEx::OnInitDialog() line within my OnInitDialog().
I've written test programs and they display the icon properly. I've also added additional EditBrowse controls in my original program, but they experience the same problem and just add another line of "can't load bitmap". I've also added other MFC controls and some of them also do not display their icons (or other stuff).
I've managed to affect the problem slightly by making calls to EnableBrowseButton() and EnableFolderBrowswButton() from my OnInitDialog. If I do that, I get an icon that looks like 3 horizontal dots:
which is better, but I'd prefer the folder/magnifier icon.
It's a complicated enough application I'd rather not re-write it from the beginning and furthermore I'd like to understand what is going on. I'm fairly certain this is a result of adding/deleting controls as the app was developed, but don't have a good idea on where to begin tracking down where things went awry.
Thoughts on how to debug this? BTW, this is VS 2010.
CMFCEditBrowseCtrl uses the Visual Manager to load the bitmap from MFC resources.
This resource is loaded in "afxribbon.rc"
Make sure the following these lines are included in the main *.rc file (this is how VS Wizard creates the *.rc file)
#if !defined(_AFXDLL)
#include "afxribbon.rc" // MFC ribbon and control bar resources
#endif
(I guess you can omit the #if/end statement, but it's probably there for a reason)
Alternatively, CMFCEditBrowseCtrl::SetBrowseButtonImage can be used to assign user icon.

Visual Studio View Code on Multiple Files at Once

I'm in the process of migrating some Web Sites to Web Applications, using Visual Studio 2017. One thing I can't seem to figure out is how do I open multiple .cs files at the same time? I can open the .aspx file for them easy enough by right clicking and choosing Open. I can view the code behind on a single page at a time by right clicking and choosing View Code. In the old Web Sites I could right click multiple files at once and select View Code, however, it appears in Web Applications that option has been replaced with "View Code Gen File" which isn't the same thing. It's painfully slow to open a single page at a time so hopefully there is a setting I am just not finding.
EDIT: As requested, uploading screenshots. Only .aspx files are selected but when more than one is selected the "View Source" option is no longer there. Also I should note that if multiple are selected in Solution Explorer, pressing F7 also has no effect, though that keystroke does work to View Source of a single file at a time.
After further experimentation, I now see what you see and I agree that it's something that Microsoft broke along the way. In fact, in your own image, if you single-select an aspx file in Solution Explorer then you can see the "<>" icon appear in the button bar at the top of Solution Explorer. But that icon disappears whenever you select two or more aspx files.
I've done a lot of work with Visual Studio over the years and I can't imagine any justifiable reason why Microsoft would have deliberately removed the View Code option from the context menu for multiply selected aspx files.
This appears to be a bona fide bug that should be reported to Microsoft.
Meanwhile, as a workaround, use the File | Open option in Visual Studio 2017 and, in the resulting Open File dialog box, simply multi-select any .cs files you need (this dialog box allows you to multi-select files and open all of them at once).

Single layout for 'edit' and 'debug' in Visual Studio

In Visual Studio 2008, 'Start Debugging' switches Visual Studio to a different layout. How can I force Visual Studio to use a single layout at all times?
I could attempt to lay out my windows in both normal and 'Debug' modes as similarly as possible. However, i) Visual Studio will still do a visible redraw, and ii) I have to keep the layouts in sync manually.
Update: It seems the correct terms are 'Design View' and 'Debugging View'. According to Window Layouts: The Four Modes 'There is no way to tell Visual Studio to use one state for all modes at this time.' Is this really true?
As others have pointed out, you can't use one settings group to control both design and debug views. Visual Studio doesn't make it easy to get the most out of window placement settings, but the approach I use to manage layouts might help.
Instead of frequently adjusting window placements by hand, try to think of a fixed number of different views you want to work with. Eclipse has perspectives, window layouts you can switch between. Think of Visual Studio this way. For example, I use two layouts in Visual Studio: one to take advantage of two monitors when I'm sitting at my physical workstation, another for one monitor when I'm working remotely. If you can constrain yourself to using a group of layouts that makes sense for you without manually adjusting windows, you can make design and debug window placements the same for each layout.
However, switching between layouts is painful with Visual Studio out of the box. You have to go to Tools->Import and Export Settings and select the layout manually. It takes more than five mouse clicks and sometimes 15 seconds to switch layouts this way on my workstation. We can do much better!
Save the window positions you want for each layout to settings files
Make a macro to load each settings file
Bind the macros to keyboard shortcuts or toolbar buttons
Save window positions to a settings file
Arrange windows the way you want them for a specific layout. Visual Studio saves the location for nearly every window (e.g. Solution Explorer, Output, Find and Replace), so be thorough. Visual Studio saves design and debug layouts in a single file so arrange windows in both views.
Go to Tools->Import and Export Settings. Choose Export selected environment settings and click Next.
The next dialog prompts you to select the settings to export. Uncheck all settings except General Settings/Window Layouts so only window placements are saved, like in these screen shots (I can't expand the window so here are two shots of the same dialog):
Enter a name for this settings file and save it. Repeat until you have a settings file for each layout. There is no limit to how many settings files you may have.
Make a macro to load each settings file
Go to Tools->Macros->Macro Explorer to show your macros. There should already be a macro project named MyMacros. Create an empty macro project if none are visible. Double click any module in any of these projects to open up the macro editor.
Enter this into the editor. You want one main sub that takes a path to a settings file and loads the file, and one sub for each individual file that calls the main sub. If you save your settings files to the same folder you can have the per-file subs pass just the file name instead of the whole path.
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Public Module Module1
Private RootFolder As String = "C:\Path\To\Folder\With\Settings\Files\"
Private Sub ImportSettingsFile(ByVal FileName As String)
FileName = IO.Path.Combine(RootFolder, FileName & ".vssettings")
DTE.ExecuteCommand("Tools.ImportandExportSettings", "-import:""" & FileName & """")
End Sub
'Corresponds to file layoutA.settings
Public Sub ImportLayoutA()
ImportSettingsFile("layoutA")
End Sub
'Corresponds to file layoutB.settings
Public Sub ImportLayoutB()
ImportSettingsFile("layoutB")
End Sub
'Repeat for each settings file
End Module
Close the macro editor and go back to Visual Studio. You're done! Running any of these macros will load the settings files automatically. You can double click any of the subs in Macro Explorer to run them. If you display Macro Explorer at all times this might be sufficient, but if you don't or would rather not have to click the macros to run them we can do even better ...
Bind the macros to keyboard shortcuts or toolbar buttons
Go to Tools->Options->Environment->Keyboard. This window allows you to change any keyboard bindings. Type "Macro" without quotes into the Show commands containing text box. This will show the macros you created. Select any macro, click in the text box titled Press shortcut keys, and enter the keyboard shortcut you want to use to run the macro. Hit Assign, then OK. You can now use this keyboard command to load the settings file.
Alternately, you can use a toolbar button instead of or in addition to a keyboard binding. Go to Tools->Customize. Select the Commands tab, select Toolbar, and select the toolbar you want to add the button to (Standard is the main toolbar). Click Add Command, select the Macros category, select the macro you want to add a button for, and click OK. You will have a new button on the toolbar that loads the window layout from that macro.
Keep in mind that keyboard shortcuts and toolbar buttons are themselves settings. If you import a settings file that overwrites either of them you will have to redo this last step. The window placement settings files won't overwrite these values because you only exported window locations. It's a good idea to periodically export and back up all settings, not just window settings, in case something like this happens and you want to recover non-window settings.
No, this is not possible. The website you found is indeed accurate:
There are four different window layout modes in Visual Studio:
Design View - this is the one you see when you start up Visual Studio. It's what most people refer to as the "normal" view.
Debugging View - this is the view that you get when you enter Debug Mode like when you are stepping through your code
Full Screen - the view you get when you go to View -> Full Screen (Shift + Alt + Enter).
File View - the lesser known view you can get when you open up a file in DevEnv.eve
The thing to remember here is that, both, your tool windows and your command bar customizations are saved separately for each state. There is no way to tell Visual Studio to use one state for all modes at this time. Additionally, when you shut down Visual Studio in any state, all four states are saved.
It's very strange that you would want to use the same window layout for all four modes. The same windows that are useful at design time are hardly ever useful during debugging, and vice versa.
For example, in Debugging View, I hide the Toolbox, Document Outline, and Property Manager windows. Then, I add the immensely useful Call Stack, Autos, Locals, Processes, Modules, and Breakpoints windows. None of the latter panes would be remotely useful to me in design mode, so I don't want them taking up screen space. But they're invaluable in debug mode, so I want them to show up. I also resize windows in the two different modes, based on their relative importance (such as the Properties window).
If you really still think that the two views should have the same window layout, the best you can do is rearrange the windows manually to achieve the same layout in both modes. I also recommend exporting your Window Layout settings (Tools -> Import and Export Settings) so that you have a fresh copy to revert back to in the case of disaster. I keep settings files containing my preferred window layout settings for single monitor (laptop), dual monitor, and triple monitor configurations.
I think your question was, "How do I use the same settings for both modes?" Am I right? Although #Chris gave an excellent thesis on how to stuff automagically, I wanted to point out, for anyone else that finds this question that there is an easy way to acheive same window settings for both design and debug modes.
Export your settings:
Choose General Settings/Window Layouts (in VS 2013) and save the file.
Open the file in an XML editor (or whatever... it's an XML file)
Find /UserSettings/Category/Design/WindowProfile and copy the entire node.
-- This assumes your Design view is the one you want to use for both modes.
Find /UserSettings/Category/Debug/WindowProfile and replace it with the one you copied from Design.
Save and re-import.
I have one of these settings files for home, remote, and office.
Many people try to turn off this feature because of strange behaviors (glitches) of VS windows on multi-monitor configurations.
In such cases there is another option that can help:
Turn off Environment->General->"Optimize rendering for screens with different pixels densities"
https://developercommunity.visualstudio.com/content/problem/830128/windows-layout-not-restoring-properly-in-multi-mon.html

Cannot view code in the object

I'm not sure if this is right, but I can't view the "code behind" in VB6. Everytime I click the "view code" for an object (for example a button), the code does not display.
Can you help me with this or any workaround for this? I need to do a breakpoint on this.
I ran into the same issue. Could not view the code or the designer.
Seems that VB6 lost track of where things should be displayed, whether offscreen or not I could not tell. Kept clicking View Code and View Object, and neither worked.
Found the solution:
Attempt to open the code or designer that doesn't show up. (It will get opened, just won't show)
Select Window from the menu, then select Cascade.
You should then see the code/designer show up on the screen. No re-install or remove/add needed.
You may need to do this each time, even after saving the .vbp (project) file, upon re-opening VB6 the files once again are not showing for me, but Cascade makes them visible again. (Anyone have any ideas on how to make this more permanent?)
Enjoy!
You may remove the form which is not showing the code in the project explorer window and add it again by right clicking on the project explorer window then select Add -> Form -> (instead of selecting in "New" tab navigate on the "Existing" tab then choose the form you have just remove and try viewing its code again). It will work 100% :D
Double click your controls and the source code will be shown.
Go to this link.
vb6 tutor

Resources