Extract properties of a control in VB 6( .ctl file ) - vb6

I have a VB 6 control file ( example. ctl ) file, my requirement is to change the properties of this file at runtime...basically some kinda bulk operations...(change the properties of all the ctl files )
This ctl file is part of a project..
Is it possible to change the properties for example
height = 100
width = 200
background = white
font = calibri
via code, for example using batch file or c# or vb ??...Is there a tool available already??

The ctl files exist only within your development environment. Once compiled into your application they become part of the compiled output and you will only be able to modify properties of objects that are instantiated according to the rules defined within your control files.
If each of the controls expose height, width and background fonts as properties, then you will be able to manipulate the controls at runtime in the way that you wish. If you have a list of control objects that you wish to manipulate in this way you can create a list of them and iterate through them.

I'm using a custom VB6 IDE Add-In to get a reference to VBIDE.VBE. Then in immediate window or in a public function all modules in all loaded projects can be manipulated with code.
Register GetVBERef.dll, load Get VBE Reference add-in in VB6 IDE, open Project2.vbp from the zip and type this in immediate window:
For Each oCmp In VBERef.ActiveVBProject.VBComponents: ? oCmp.Name: Next
(You'll get Module2 only because there is nothing more in Project2)
You can copy/paste the code from Module2 in your project and add a reference to Microsoft Visual Basic 6.0 Extensibility. With a bit of trial & error you can write a public function (in the same module for instance) that resizes all user controls or sets colors, fonts, etc. of all forms in your project group.

Related

How to register a System Supplied Property Handler for XPS and OPC files in registry for a custom file type?

I'm creating a custom file format for use by my application based on the OPC (or maybe the XPS) file format. This MSDN link, Using System-Supplied Property Handlers, gives an example but it doesn't appear to be correct. Does anybody know how to do this properly?
Edit:
This can apply to OPC files as well as XPS. XPS is build on top of OPC.
You have to:
Create a key named with your extension (e.g. a key named .doc) under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\PropertySystem\PropertyHandlers.
Then set the default value for the key you just created to {45670FA8-ED97-4F44-BC93-305082590BFB}
Under Root/SystemFileAssociations add a key named with your file extension (e.g. .doc).
Under that key add "shellex\PropertyHandler"
Set default value under the PropertyHandler key to {45670FA8-ED97-4F44-BC93-305082590BFB}.
Now you have to tell Windows what properties to display depending on circumstance.
Add FullDetails, PreviewDetails, ExtendedTileInfo, and InfoTip keys to the Root/SystemFileAssociations/ key.
This property handler is good for both OPC (open package conventions) and XPS files.
PreviewDetails is the property pane at the bottom of windows explorer (Win 7) or the left hand side of explorer (Win 8).
FullDetails is the properties you see when you right click and select properties and go to the Details tab.
InfoTip is the properties you see when you hover over a file.
ExtendedTileInfo I'm not sure about. I think it's the properties you see when you select the content folder view in explorer.
{45670FA8-ED97-4F44-BC93-305082590BFB} is the GUID for the OPC/XPS property handler given in the MSDN link in my question.
OPC is basically a standard for creating a (zipped) file type. Can see more here: MSDN Magazine - Aug. 2007 OPC - A New Standard For Packaging Your Data.
I only tested in Windows 7 but it should work in Vista and above. I'll post back after I do further testing.

how to add ocx files in vb4.0 (I am migrating from vb4 to vb6

I am migrating vb4 application to vb6.0 app. I am using windows xp. I want to add ocx controls to the application. Any simple steps to do add ocx controls/files to the application. What are .frm files
Object = "{bla-lablabla-lablabla}#2.0#0"; "THREED20.OCX"
Object = "{blabla-bla-bla-blabla-blablabla}#2.0#0"; "vsview2.ocx"
I want to add these two ocx controls in vb6 ( 16 bit to 32 bit)
You don't state if you already have the OCX files.
To address your first question on how to add OCX controls to your VB6 project. You need to go to Projects -->Components( CtrlT ) then click the Browse button and navigate to where the OCX is located and select it.
As far as the actual OCX Files are concerned there is a Threed20.ocx that is included on the VB6 install media, I believe it is on Disk 2. There is also a registry file that you will need to run to enable design time use of the control. As far as the vsview2.ocx file is concerned if it is not a 32 bit OCX you will need to contact the vendor, who I believe is ComponentSource to get the proper version if you don't currently have it.
And as far is what is a .frm file it is according to this article
A form holds the description of all objects and their properties for each form, as well as the basic code that you have written to respond to the events.

Building a specific Runtime image using Platform Builder 5.0

I am trying to create a run-time image using Platform Builder 5.0, I know how to make run-time images but I need specific modules and files to be inside the run-time image, I am basically trying to clone an original run-time image and I want to add some extra stuff such as drivers for an ethernet card that was incorrectly configured, by using viewbin I was able to obtain the following modules and files, if it is possible can someone tell me exactly what catalog items I should add because at the moment I am using trial and error and it is not working, the modules and files are as follows
Modules
nk.exe,GIISR.dll, isr16550.dll, coredll.dll, filesys.exe, gwes.exe, device.exe, devmgr.dll, regenum.dll, pm.dll, fatfsd.dll, diskcache.dll, fatutil.dll, shell.exe, shellcelog.dll, toolhelp.dll, cmd.exe, atapi.dll, udfs.dll, fsdmgr.dll, mspart.dll, ceddk.dll, ppp.dll, pppoe.dll, export.dll, iphlpapi.dll, mbridge.dll, winsock.dll, ws2.dll, wsinstl.dll, wspm.dll, nspm.dll, secur32.dll, ntlmssp.dll, credsvc.dll, credprov.dll, afd.dll, ndis.dll, dhcp.dll, tcpstk.dll, tapi.dll, unimodem.dll, netbios.dll, ping.exe, ipconfig.exe, ndisconfig.exe, route.exe, netstat.exe, tracert.exe, serial.dll, mmtimer.dll, ole32.dll, oleaut32.dll, services.exe, httpd.dll, telnetd.dll,PCIbus.dll, pcc_tipccard.dll, pcc_serv.dll, pcmcia.dll, kbdmouse.dll, com16550.dll, ssce20.dll, ssceca20.dll, e100ce.dll - this is the driver that I am replacing, micro.dll
Files
ceconfig.h, wince.nls, initobj.dat, boot.hv, default.hv, user.hv, cemgrc.exe, cetlkitl.dll, cetlstub.dll, tcpipc.dll,
tlcesrv.dll, httpd_default.htm, NTLMInit.exe, version.exe, HECImageInfo.exe-version.exe and HECImageInfo.exe are run from an app on the drive itself.
I have tried adding the above files and modules that were missing by using the project.bib files in the Parameter view, but still this does not help. I am using this system on a MSM586SEN board and there is problems with the ethernet not connecting to the computer.
You can't just go and add these modules and files into your own BIB files. It's unlikely to work, plus it's a bad idea as there's nothing telling the system to generate those files. Select what you need from the catalog, which will set the proper SYSGEN veriables. That, in turn, will build the proper pieces and include them into the OS.
If you want to "clone" what was in an image, but don't have the project file for it, then look in the \windows\ceconfig.h file of the running OS. It will list every SYSGEN set during the build process. You can then manually set them in your new project, or select the proper catalog items to set them (hover on a catalog item and it will tell you the SYSGEN it sets - alternately you might just manually edit your project file with a text editor and add them).
Once you have that, then you can add drivers, debug connectivity issues, etc.

OleControl instantiated to wrong type - only when using in Reg Free COM?

I have an ActiveX control (created using C#) that I am adding to a form in Visual FoxPro using late binding. It works without problems when I register the control.
I want to use reg free COM and created necessary manifest files. Now it load and displays in an inactive state until I double click or grammatically activate it. I don't think it has anything to do with the reg free com manifest files. However is there something I need to do to set it up before/after making the late binding call AddObject()?
this.AddObject('OleControl1', 'oleControl', 'SomeCompany.SomeOleControl')
When I check the OleTypeAllowed Property of the OleControl created by AddObject() it is 1 (Embedded OLE object) instead of -2 (ActiveX object). So the OleControl got instantiated to the wrong type.
I also tried the following:
DEFINE a subclass of OleControl and set the property OleTypeAllowed = -2. Used late binding to load the control. It did not work as required. The OleTypeAllowed came back as 1
Registered the ActiveX control. Added the ActiveX control to the project as a subclass using the visual editor. Unregistered the control. Used late binding to load the control. It did not work as required. The OleTypeAllowed came back as 1.
Is it possible to load the OleControl as a ActiveX control?
Any input from VB that I can convert to FoxPro would also be appreciated.
You probably have the miscStatusContent attribute wrong. This a snippet from a VB6 app manifest we deploy:
<file name="External\COMCTL32.OCX">
<typelib tlbid="{6B7E6392-850A-101B-AFC0-4210102A8DA7}" version="1.3" flags="control,hasdiskimage" helpdir="" />
<comClass clsid="{9ED94440-E5E8-101B-B9B5-444553540000}" tlbid="{6B7E6392-850A-101B-AFC0-4210102A8DA7}" progid="COMCTL.TabStrip.1" threadingModel="Apartment" miscStatus="" miscStatusContent="recomposeonresize,cantlinkinside,insideout,activatewhenvisible,setclientsitefirst">
<progid>COMCTL.TabStrip</progid>
</comClass>
....
</file>
Notice that miscStatus has to be explicitly cleared.
We are using UMMM for manifest creation in our automated builds.

XNA Framework Importers

I am working on a game using the XNA framework. My game has several levels which I am storing the data in a plain old text file. In VS 2008 when I add the level file to the project and compile, I receive the following error message.
Error 1 Cannot autodetect which importer to use for "Levels\0.txt". There are no importers which handle this file type. Specify the importer that handles this file type in your project. F:\Projects\BrickBreaker\BrickBreaker\Content\Levels\0.txt BrickBreaker
The reason I am bringing this out is because if I change on of my levels and run the game, the level is not updated. I have found that the level is not updated because VS runs the game from the bin\debug folder and since the level files are not included in the project, they are not copied when they change. I also found that the platform sample that comes with the framework includes the level data in the project, that's where I got the technique from.
So, should I use a different file format or just deal with having to manually copy the new level files over?
Resolution - After digging into the answers on this post I found a solution. I added the text files to the project and set the build property to none. The error no longer occurs when compiling and the file is included in the project.
You can have Visual Studio just copy over the files if you want to the output directory. Under the properties of the text file in the project, choose Build Action: None and change the copy to output directory to as needed.
You can also check out the platformer sample. They use text files as their level format.
There is no content importer for text files. Ignore the content pipeline and just read the file in just as you would any other normal text file.
string line = string.empty;
using(StreamReader sr = new StreamReader("filename")){
while((line = sr.ReadLine()) != null){
//reads line by line until eof
//do whatever you want with the text
}
}
I had similar problem, and found it easier to have the files added to content project, and build action set to none, than to skip content pipeline altogether.

Resources