I'm working on migrating code from Visual Basic 6 to Visual Basic.NET, but before I can do that I need to get it to build. Currently I cannot get it to build because of a missing reference in an MSHTML for an IDocHostUIHandler. Specfically I get the error on the line using DOCHOSTUIFLAG_DIALOG. I've tried added different references, but the error stays the same. If it makes any difference, I'm running XP with IE8.
MSDN says that the IDocHostUIHandler interface is defined in mshtmhst.idl which is in the Platform SDK. I can't find this defined in any DLL or type library so you may need to compile the IDL into your own library to register.
You will also need to make sure that there are no references listed as "(MISSING)" as these cause random object reference problems.
Try this in a module
Public Enum DOCHOSTUIFLAG
DOCHOSTUIFLAG_DIALOG = 1
DOCHOSTUIFLAG_DISABLE_HELP_MENU = 2
DOCHOSTUIFLAG_NO3DBORDER = 4
DOCHOSTUIFLAG_SCROLL_NO = 8
DOCHOSTUIFLAG_DISABLE_SCRIPT_INACTIVE = &H10
DOCHOSTUIFLAG_OPENNEWUI = &H20
DOCHOSTUIFLAG_DISABLE_OFFSCREEN = &H40
DOCHOSTUIFLAG_FLAT_SCROLLBAR = &H80
DOCHOSTUIFLAG_DIV_BLOCKDEFAULT = &H100
DOCHOSTUIFLAG_ACTIVATE_CLIENTHIT_ONLY = &H200
DOCHOSTUIFLAG_OVERRIDEBEHAVIORFACTORY = &H400
DOCHOSTUIFLAG_CODEPAGELINKEDFONTS = &H800
DOCHOSTUIFLAG_URL_ENCODING_DISABLE_UTF8 = &H1000
DOCHOSTUIFLAG_URL_ENCODING_ENABLE_UTF8 = &H2000
DOCHOSTUIFLAG_ENABLE_FORMS_AUTOCOMPLETE = &H4000
DOCHOSTUIFLAG_ENABLE_INPLACE_NAVIGATION = &H10000
DOCHOSTUIFLAG_IME_ENABLE_RECONVERSION = &H20000
DOCHOSTUIFLAG_BROWSER = &H12
DOCHOSTUIFLAG_DESKTOP = &H2E
End Enum
Related
With some vb.net code I try to retrieve data from an Oracle database (simplified example):
strQuery = "Select 2.3, 2.3/1, 2.3/3.1 From Owner.TableName Where ROWNUM < 10"
Dim da As OracleDataAdapter
da = New OracleDataAdapter(strQuery, ConnectionString)
da.Fill(GetData)
This results in an "Specified cast is invalid" error.
The 2.3/3.1 is the problem.
I learned from "Specified cast is not valid" when populating DataTable from OracleDataAdapter.Fill() that Oracle works with a higher precision than dot net can handle and that I should use SuppressGetDecimalInvalidCastException in the OracleDataAdapter. But I don't know how to code it in VB.net. Can anyone help me?
Automatic translation from the C# code did not work.
The C# code itself did not work for me (probably due to the fact that I don't know how to handle the async stuff) and if I simplify it to
string queryString = "Select 2.3, 3.1 From owner.table";
string connectionString = "Data Source=Data.plant.be/database;User ID=****;Password=****";
var table = new DataTable();
var connection = new OracleConnection(connectionString);
var command = new OracleCommand(queryString, connection);
var adapter = new OracleDataAdapter(command) {
SuppressGetDecimalInvalidCastException = true
};
adapter.Fill(table);
I get error CS0117: OracleDataAdaptor does not contain a definition for SuppressGetDecimalInvalidCastException.
Extra info:
As proposed by #Andrew-Morton - thank you Andrew - I wrote:
Dim table = New DataTable()
Dim connection = New OracleConnection(ConnectionString)
Dim cmd = New OracleCommand(strQuery, connection)
Dim adapter = New OracleDataAdapter(cmd) With {.SuppressGetDecimalInvalidCastException = True}
adapter.Fill(GetData)
But I get BC30456: SuppressGetDecimalInvalidCastException is not a member of 'OracleDataAdapter'.
Remark: I have version 19.6 of Oracle.ManagedDataAccess.
I could not install package 'Oracle.ManagedDataAccess 21.9.0'. I Get: You are trying to install this package into a project that targets '.NETFramework,Version=v4.5', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.
I have downloaded the latest version of Lua and included the source in to my project in c++builder from Embarcadero. All went rather well. Compiles perfectly.
But when I run my script, that's when it stops working correctly.
This script is ok
-- Script
Tp = tonumber( Temp )
Sp = tonumber( Setpoint )
Clr = "0xFF00FF00"
Db = 0.5
Hi = (Sp+Db)+1
Lo = (Sp-Db)-1
f = Hi
--
This script fails
-- Script
Tp = tonumber( Temp )
Sp = tonumber( Setpoint )
Clr = "0xFF00FF00"
Db = 0.5
Hi = (Sp+Db)+1
Lo = (Sp-Db)-1
f = math.floor( Hi )
--
It also fails if I try to use string.format, so it looks like the libs have not loaded correctly.
I use luaL_openlibs() to load the libraries.
I have come to the conclusion that there must be a compiler directive that I need to use. But I can't find anything that makes any difference.
If anyone has any info on building the source into their own application, I would love to know.
The main reason I have done it this way is for speed.
My Application is a data server that runs scripts against incoming data, and I expect to have several hundred data connections, both in and out.
The Answer is to call
lua_openlibs( state );
and not this code
static const luaL_reg lualibs[] =
{
{"base", luaopen_base},
{"table", luaopen_table},
{"io", luaopen_io},
{"string", luaopen_string},
{"math", luaopen_math},
{"debug", luaopen_debug},
{"loadlib", luaopen_loadlib},
/* add your libraries here */
{NULL, NULL}
};
static void openstdlibs( lua_State *l )
{
const luaL_reg *lib = lualibs;
for (; lib->func; lib++)
{
lib->func(l); /* open library */
lua_settop(l, 0); /* discard any results */
}
}
I can only assume that there is some path information missing that openlibs has.
Sorry about the formatting, couldn't get it to look right
In Genexus, how to know if is compiling for Android or IOS in Smart Device?
Example:
A procedure:
If platform = ‘IOS’
&Variavel = 1
Else if platform = ‘ANDROID’
&VARIAVEL = 2
endif
There is no way to know at complie time, but you can check in runtime.
You can use the DeviceType property in ClientInformation
&deviceType = ClientInformation.DeviceType
if &deviceType = SmartDeviceType.iOS
&variavel = 1
else // if &deviceType = SmartDeviceType.Android
&variavel = 2
endif
See more info in the official documentation: ClientInformation external object
I'm searching for a one-click way to inspect preprocessed or assembly output.
It's just tedious to open file properties, change the respective setting, compile, go to the obj directory and open the resulting file by hand.
Does anyone know of any Visual Studio add-in, macro or whatever to automate this task?
EDIT: An extension for VS 11+ is available # https://github.com/Trass3r/DevUtils
I solved it myself by creating a nice macro.
It's way more sophisticated but basically works like this:
Imports EnvDTE
Imports Microsoft.VisualStudio.VCProjectEngine
Dim doc As EnvDTE.Document = DTE.ActiveDocument
Dim prj As VCProject = doc.ProjectItem.ContainingProject.Object
Dim file As VCFile = prj.Files.Item(doc.Name)
Dim fileconfigs As IVCCollection = file.FileConfigurations
Dim fileconfig As VCFileConfiguration = fileconfigs.Item("Release|x64")
Dim tool As VCCLCompilerTool = fileconfig.Tool
Dim asmFile = System.IO.Path.GetTempFileName + ".asm"
tool.WholeProgramOptimization = False
tool.AssemblerOutput = asmListingOption.asmListingAsmSrc
tool.AssemblerListingLocation = asmFile
fileconfig.Compile(True, True)
Dim window = DTE.ItemOperations.OpenFile(asmFile, Constants.vsViewKindCode)
Very useful in combination with AsmHighlighter.
Preprocessed file can be generated similarly with
tool.GeneratePreprocessedFile = preprocessOption.preprocessYes
' there's no separate option for this, so misuse /Fo
tool.ObjectFile = System.IO.Path.GetTempFileName + ".cpp"
I'm trying some VS2005 IDE macros to modify a large amount of projects (~80) within a solution. Some of the properties I wish to set do expose a programmatic interface to 'default', but many others do not. Is there a generic way to set such properties to their default? (eventually meaning erasing them from the .vcproj file)
Simplified example, setting some random properties:
Sub SetSomeProps()
Dim prj As VCProject
Dim cfg As VCConfiguration
Dim toolCompiler As VCCLCompilerTool
Dim toolLinker As VCLinkerTool
Dim EnvPrj As EnvDTE.Project
For Each EnvPrj In DTE.Solution.Projects
prj = EnvPrj.Object
cfg = prj.Configurations.Item(1)
toolLinker = cfg.Tools("VCLinkerTool")
If toolLinker IsNot Nothing Then
' Some tool props that expose a *default* interface'
toolLinker.EnableCOMDATFolding = optFoldingType.optFoldingDefault
toolLinker.OptimizeReferences = optRefType.optReferencesDefault
toolLinker.OptimizeForWindows98 = optWin98Type.optWin98Default
End If
toolCompiler = cfg.Tools("VCCLCompilerTool")
If toolCompiler IsNot Nothing Then
' How to set it to default? (*erase* the property from the .vcproj)'
toolCompiler.CallingConvention = callingConventionOption.callConventionCDecl
toolCompiler.WholeProgramOptimization = False
toolCompiler.Detect64BitPortabilityProblems = False
End If
Next
End Sub
Any advice would be appreciated.
For VS 2005, I believe you can use the ClearToolProperty method on VCConfiguration. The following code would accomplish this for CallingConvention (this is C#, but I'm sure something similar works for VB):
cfg.ClearToolProperty( toolCompiler, "CallingConvention" );
This would have the same effect as going into the GUI and choosing "<inherit from parent or project defaults>" for this option.
Unfortunately this seems to be deprecated in VS 2010, and I'm not sure what the new supported method is.