Enumerate Installed Com Objects With Vfp
Reinstalling Windows is a good way to fix serious problems with your computer, or just to get a fresh slate. But before you reinstall Windows, you should make a list of programs you currently have installed on your PC so you know what you want to reinstall on the new system.
Having a list of installed programs is also useful if you just bought a new computer and you want to install the same programs you had on your old computer. Here are a few different methods for doing so on Windows 10, 8/8.1, and 7.
VFP 9.0 DTS - Using TRY - CATCH to capture unhandled exception errors and close curently open form does hapen because the combo box's Valid Event won't release from memory. Selecting Code from the Right-Click of a Control: VFP8: DataEnvironment doesn't release object stored in DataSource property.
The Easy Way: Use a PowerShell Command
RELATED:Geek School: Learn How to Automate Windows with PowerShell
PowerShell is one of the most powerful things built into Windows, so of course it can do something as simple as list your installed programs. In fact, all you need is one command, which you can copy and paste right from this page.
First, open PowerShell by clicking on the Start menu and typing “powershell”. Select the first option that comes up and you’ll be greeted with an empty PowerShell prompt.
Copy and paste the following command, pressing Enter when you’re done:
PowerShell will give you a list of all your programs, complete with the version, name of the developer, and even the date you installed it.
You will probably want to export that to a file though, which is also easy enough. You can just send the output using the > symbol and adding the path to a new text file that you want to create. For example:
Obviously, replace C:UsersLoriDocumentsInstalledPrograms-PS.txt
with the path and name you want to use for your file.
What makes using PowerShell really neat is that if you do this on two different machines, you can easily compare the software installed on them. Just take your two text files and add them to this command:
In this example, one text file has programs from my PC, and the other has programs from my laptop. Any entries with a side indicator pointing to the right (=>) mean that the software is installed on my laptop but not on my PC, and any entries with a side indicator pointing to the left (<=) mean that the software is installed on my PC but not on my laptop.
The No-Command-Line Way: Create a List of Installed Programs Using CCleaner
CCleaner is a Windows application designed to free up space on your PC by deleting temporary files and erasing private data, such as your browsing and download history and lists of recent documents in various programs. However, it can also give you a list of all the programs on your computer, which is particularly useful if you already have CCleaner installed (or are very uncomfortable using the command line).
To create a list of installed programs using CCleaner, either double-click on the CCleaner icon on your desktop or right-click on the Recycle Bin and select “Open CCleaner” from the popup menu.
Click “Tools” on the toolbar in the left pane on the main CCleaner window.
Make sure the Uninstall screen is active. You’ll see a list of programs installed on your PC. You can use CCleaner to uninstall, repair, rename, and delete programs, but you can also save the list of installed programs to a text file by clicking the “Save to text file” button in the lower-right corner of the window.
On the Save As dialog box, navigate to where you want to save the text file containing the list of installed programs, enter a name for the file in the “File name” edit box, and then click “Save”.
You now have a list of programs currently installed on your computer.
The list of installed programs includes the company, date installed, size, and version number for each program. The text is tab-delimited, which means you can open the text file in Word and easily convert the text to a table to make it more readable. Note, however, if you convert the text file to a Word file, that you will have to install Word on your new or redone PC before you can access your list of installed programs.
Save this text file (or the Word file) to an external hard drive or a cloud service, so you can access it on your new PC or after you reinstall Windows on your current PC.
READ NEXT- › Slack for Desktop and Web Gets a Dark Mode—Here’s How to Enable It
- › How to Quickly Search Google Drive
- › How to Use the chgrp Command on Linux
- › Could Your Bluetooth Devices Be Hacked in 2019?
- › Can You Get Multiple User Accounts on an iPad?
I'm writing a program to generate a VFP form class with lots (90+ each) of labels and radio buttons on it. That's the easy part. (and yes, I know that's a lot of radio buttons, but that's what the users want).
We have several VCXs in our application which do something similar, but not with anywhere near as many individual controls. So, rather than spend a huge fraction of my life dragging and dropping fields around, and realizing that I happen to have a handy list of all the fields, their options and default values, I used the 'View Class Code' option from the Class Browser to get a sample of what the code looks like as a base. Then I wrote code to generate a PRG with all the pieces I need.
Dll
My actual problem is that the code output by 'View Class Code' seems to include invalid syntax:
The class frmae is a class (from a VCX) which includes a container called 'cntouter'. Class cntctrls is the container that contains all the labels/radio buttons.
The problem is that apparently you can't, in the DEFINE CLASS command, ADD OBJECT to a member. The dotted syntax causes a syntax error. Yet, this technique is used in the 'View Class Code' output.
I suspect I could get around this by generating an Init method which calls ADDOBJECT() to add my control container to cntouter, but I'd rather have it in the class definition.
2 Answers
The 'View Class Code' option doesn't produce runnable code; it never has.
My suggestion for doing what you need is to create an option button class with the appearance that you want. Then, use your existing list to populate a cursor and write code that spins through that and adds option buttons to a container class.
The key thing you need to know here is that you can run code in the IDE that affects a form or class that's open in the Form Designer or Class Designer. Cirrus logic driver windows 10. That's what Builders do. So rather than generate a code-based class, use code to create a visual class.
Tamar E. GranorTamar E. GranorIf you want to do this in code, then first you shouldn't depend view code as Tamar already pointed out. You can do any form and its controls in code (with the exception of one or two activex controls maybe) but you need to understand how to code container type controls. First, to add a class from a class library you need to sepcify its source. ie:
wouldn't work. Instead you would need to define a class in your code like this:
Second, you would need to create your inner controls first and then add as needed to create the outermost object.
AT designtime, you could go to command window, pop up a code window:
and then using ASELOBJ() function you can get a reference to any object on the form you are designing. Onece you have the desired reference(s), you can add and arrange objects within that code window programmatically, select the code and execute selection (erase the controls, correct your code and retry if you can't do it right for the first time). That is temporary 'do and throw away' style builder.
Cetin BasozCetin Basoz