We try migrate our vb6 project to use sxs tehnology ....but have problem with dynamic add control to form (VBControlExtender ).
Problem is when add control to form with "Controls.Add" got instance of VBControlExtender that is not functional....rise error like "object doesn't support this property or method" or "Invalid object use" when use property or method
I found that people have like same problem (Strange Case of the missing method, Legacy vb6 application with SXS = "object doesn't support this property or method.") and suggestion is implement "Direct user control". Can somebody know how implement this in vb6 code?
How we can fix problem with sxs and dynamic add control to form?
Related
The file msstdfmt.dll is I believe supplied with Visual Basic 6 and is sometimes a dependency for deployment.
The copy on my PC includes the helpstring
Microsoft Data Formatting Object Library 6.0 (SP6)
which is not very informative.
What is this DLL for? What are the key functionalities that it provides?
According to Microsoft documentation:
The Microsoft Standard Data Formatting Object Library is required for
controls that implement a DataFormat property. An Application Error
occurs when a control makes an attempt to use the DataFormat property
and the Microsoft Standard Data Formatting Object Library is not
registered. Controls that implement a DataFormat property include, but
are not limited to, the following:
CheckBox, ComboBox, Image, Label, ListBox, PictureBox, TextBox,
ImageCombo, MonthView, DTPicker, Calendar, DataCombo, DataList,
DBCombo, DBList, MaskEdBox, RichTextBox.
It is used pretty extensively for data formatting.
It gets used implicitly with many databound controls and when you create databound UserControls or datasource UserControls and Classes. Instances of the StdDataFormat object it provides can also be used explicitly, either for direct use in code or even assigned to an ADO Field object's DataFormat property.
It is a pretty fundamental library for any VB6 program that is not written in "Let's pretend we are writing QBasic" i.e. Dark World scripting mode. Egad, you may as well be using stone knives and bearskins (a.k.a. Python).
I'm creating a ActiveX control. I've created a bunch of properties in a User Control and now I want to access those properties in the other modules, classes, forms, etc in the same project but I can't seem to find the correct syntax to do so?
Syntaxt I've tried:
connectString = user_control_name.DBConnectionString
connectString = Property("DBConnectionString")
connectString = Property(DBConnectionString)
connectString = Property Get ("DBConnectionString")
If you want to access a property on an instance of a UserControl on a specific form, you can do:
my_form_reference.my_usercontrol_name.my_property = <whatever>
If you want to access the instance of a UserControl that is in a UserControl, you will have to pass the reference to the UserControl via a property on the containing UserControl.
I generally recommend you don't pass UserControl references around. It is generally better to wrap up these controls, and not break abstraction.
If you want to access a property on an instance of a UserControl from inside the ActiveX Control project, I would recommend against it. The only way you can do this is by using module-level variables in a BAS module. This variable would potentially be accessible from every module in the project. You would have to set the variable in the UserControl_Initialize event of the control. However, I would strongly recommend you not doing this, because this creates an extra reference to your UserControl, which should really only have a reference from the containing Form or UserControl. This extra reference would mean that if the containing Form or UserControl was unloaded, the control would stick around in memory for the lifetime of your application, causing a memory leak. There are ways around this issue by using "weak references". But this is not supported in VB6, requires API hacks, and is prone to causing crashes.
I seriously would suggest you find some other way to do what you want. Perhaps you could explain exactly why you have this requirement.
Till current moment I knew only one recipy to create form VC++ designer:
1. Add dialog resource and design what you want in designer.
2. Create MFC form by using designed dialog resources
But now I got project sample that has form and has no *.rs files with form information. Instead of that it has header file that has form icon. Header file contains many code that creates controls and sets style. It is also possible select from menu "View Designer". That makes me think that there is another way of creating form. Besides that looks that codes does't uses MFC.
How to create simple form application with designer that would generate header file (not resource) and not use MFC?
Unfortunately I can't "View Designer" because during this procedure error is generated:
C++ CodeDOM parser error: Line: 1520, Column: 42 --- Unknown type 'AxKgLib.AxKg'. Please make sure that the assembly that contains this type is referenced. If this type is a part of your development project, make sure that the project has been successfully built.
Correct me if I'm wrong. Looks like I need registered ActiveX for this project. I have registered ocx that was included in source, but this didn't helped.
How to solve this problem? How to get list of all ocx that system has to make sure there is no required AxKgLib.AxKg? How to make designer to show me form without required control?
Often, when I'm looking for information of how to set certain properties of controls (I'm using Visual Studio primarily, but this question does apply to any IDE), the examples I find normally involve programatically setting said properties.
Here's an example, using the DataGridView.DefaultCellStyle property on MSDN:
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.defaultcellstyle(v=vs.110).aspx
So my question is: is it better for a programmer to modify these properties by code, or is it better to use the IDE itself to change them via the properties pane? I realize that doing it the latter way will result in auto-generated code anyway, but it will be "somewhere else" in relation to the main bulk of user-generated code.
It depends on your requirements. If the app you are developing is planned to be dynamic, then it is a good idea to do it the way it is described in the reference you provided. For example, you may create a class containing the method which will set the basic settings of the gridview, so on every page you may just call this method and pass to it the gridview as a parameter instead of repeating setting the grid properties on every page.
I am implementing a custom Outlook Property page in C++ as an ActiveX control as per this article.
Basically, I have noticed that when passing an initialized object (my ActiveX object) to the 'raw_add' method on the property pages obtained within the namespace event 'OpetionsPagesAdd', the second parameter (the property page tab title) is ignored in Outlook 2003. In 2007 and 2010 my code works absolutely fine, only in 2003 does that second parameter seem to be ignored.
I'm sure I have come across articles in the past describing this as a known bug in Outlook 2003, but I was wandering if anyone had found a way around the issue? I found this article describing the same issue, and the resolution, but that is for C#, and I can't for the life of me see how to port his 'fix' to C++.
I ended up raising a support case with Microsoft for this issue, and it is a bug in Outlook 2003. The way around it is to derive from public IDispatchImpl and define the caption property in the prop map:
( PROP_ENTRY_TYPE("Caption", DISPID_CAPTION, CLSID_PropPage, VT_BSTR)
Then implement the put_caption and get_caption methods and it should work.