SetProcessDpiAwareness error code - windows

I'm adding a call to the SetProcessDpiAwareness windows function as the first thing in my Delphi XE7 application (after dynamically loading the shcore DLL). I know it is preferable to use a manifest to set the DPIAware value and I've got that working separately and will use it eventually. However during development I want to use a command line parameter to set DPIAwareness value, otherwise I have to rebuild the app to change this status.
The problem is that SetProcessDpiAwareness returns the error code $800700A0.
That is not documented in the function description, what does the code mean?
Ah I've found it, thanks to the answer to look at the parameter, I had declared the function type wrong, I had:
TSetDPIFunc = function (const PROCESS_DPI_AWARENESS) : HRESULT; stdcall;
but PROCESS_DPI_AWARENESS was not defined as an enum.
Changed to the following and it now works fine:
TSetDPIFunc = function (const x: Integer) : HRESULT; stdcall;

0x8007XXXX is a Win32 error code encapsulated in a COM HRESULT using HRESULT_FROM_WIN32(). WIN32_FROM_HRESULT(0x800700A0) gives 0xA0, i.e. error code 160, which is ERROR_BAD_ARGUMENTS ("One or more of the input parameters are not correct").
It makes no sense for me though that you get this error, since this function doesn't even take any arguments!
So the only thing I can think of would be that it has something to with the issue described here, assuming you changed the DPI settings yourself for testing and it failed then:
So it seems that in order for SetProcessDPIAware (and the related approaches: SetProcessDpiAwareness() and manifest with true) to work correctly, one has to log out and login again after changing the DPI setting and before running the program.
By the way, in case this is helpful: For testing manifests without totally rebuilding, you could use mt.exe to attach a manifest to your application from the command line.

Related

Type Mismatch in VB6 on call to method in .NET DLL

I have a .NET DLL that serves as a wrapper to a 3rd party application. The DLL is registered for COM-Interop as follows:
C:\Windows\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe /tlb /codebase "C:\Dev\1) Source\TAC10_CAD\Lib\PowerPhoneInterface\PowerPhoneInterface.dll"
There are multiple methods in the DLL that are called from VB6. All work perfectly except one. The .NET function prototype for that method is as follows:
int SetAniAli([Optional] string incidentType);
In VB6, I invoke the problematic method as follows:
If GetSettingBitValue("G_POWERPHONE_ENABLE") Then
If CheckPowerPhoneConnection() Then
frmParent_Dispatch.PowerPhoneInterface.SetCallerInformation person,
phone, Callback, Address.FullText
frmParent_Dispatch.PowerPhoneInterface.SetAniAli
rc = frmParent_Dispatch.PowerPhoneInterface.SetAniAli
If rc = 10 Then
PowerPhoneCallInit = True
Else
Call modCAD.SetWarning("Attempt to set ANIALI information failed.")
End If
End If
End If
PowerPhoneInterface is the object reference to my DLL. The first method call (SetCallerInformation) works great. In addition, there are two other DLL calls invoked from the function CheckPowerPhoneConnection that also work great. However, SetAniAli gives a "type mismatch" error every time. I have rc defined as a Long in VB6, but also tried Variant. No success with either.
I have googled until I get blurred vision and cannot seem to find what is wrong with the call.
Any suggestions would be greatly appreciated.
I'm not sure if this is the reason or not, but I modified the SetAniAli method to make the incidentType parameter required vs optional and the problem is no more. If someone definitively knows that VB6 has a problem with optional parameters or if they require special handling on the VB6 side, please post a comment so that others can benefit.

cfajaxproxy is sending invalid parameters?

For some reason that I don't understand, on my development machine can't call to function of a cfc component from a cfajaxproxy.
In my cfm document:
<cfajaxproxy cfc="#Application.CfcPath#.empleado"
jsclassname="ccEmpleado">
This works, and also I can instantiate an object to get all the functions of that cfc component:
var cfcEmpleado = new ccEmpleado();
But, when I try to call a function of that object:
var nb_Empleado = cfcEmpleado.RSEmpeladoNombreBIND(1,1);
Debug complains:
Error: The ID_EMPRESA parameter to the RSEmpeladoNombreBIND function is required but was not passed in.
I got this from Network tab on Chrome and figured out that something is generating an invalid parameter:
http://127.0.0.1/vpa/componentes/empleado.cfc?method=RSEmpeladoNombreBIND&_cf_ajaxproxytoken=[object%20Object]&returnFormat=json&_cf_nodebug=true&_cf_nocache=true&_cf_clientid=41C92098C98042112AE2B3AAF523F289&_cf_rc=0
As you can see, there's a parameter [object%20Object], that is messing around my request, and that's why it fails. I don't why is happening this. Other people has tested this, and it works, but in mine doesn't.
I have Coldfusion 9, Apache, Windows 8. Is is some configuration issue on Coldfusion, or a bug?
I can't tell if this is your error or not, but it might be. This was a problem that we had for awhile. You should consider using explicit names to avoid any confusion. Add the "js" in there.
<cfajaxproxy cfc="cfcEmpleado" jsclassname="proxyEmpleado">
var jsEmpleado = new proxyEmpleado();
I will try to find a link to an article about this very thing.

DXUTSetD3D11Device function missing from DXUT

I'm writing a basic program using direct3d and DXUT.
I am creating a direct3d device manually with D3D11CreateDeviceAndSwapChain() and passing it to DXUT using the DXUTSetD3D11Device() function which, according to the documentation should be correct.
What confuses me is that I get an LNK2019: unresolved external symbol error when calling DXUTSetD3D11Device(). I can call other DXUT functions such as DXUTCreateWindow() just fine, also I have built DXUT myself and have linked to it properly.
When I look in DXUT.h I can find the declaration of DXUTSetD3D11Device() but when I look in DXUT.cpp I can't find any reference to this function, so I think this might be why I'm getting this linker error.
This seems to be the same problem as mine.
I'll leave the relevant pieces of code here, just in case:
bool DXUTEngine::Initialise()
{
HR(DXUTCreateWindow(m_appname));
if(!m_pDirect3D->Initialise(DXUTGetHWND(), m_width, m_height))
{
OutputDebugString(L"\n\n Failed to initialise Direct3D\n\n");
return false;
}
HR(DXUTSetD3D11Device(m_pDirect3D->GetDevice(), m_pDirect3D->GetSwapChain()));
return true;
}
Here's where I create the device:
result = D3D11CreateDeviceAndSwapChain(NULL, driverType, NULL, 0, &featureLevel, 1,
D3D11_SDK_VERSION, &swapChainDesc, &m_pSwapChain, &m_pDevice, NULL, &m_pContext);
At the moment I either think I'm doing something very wrong or that this function just doesn't exist. I'd really appreciate any help.
Thanks in advance.
From the link you post which point to MSDN forum, the DXUT11 framework was delivered in source code, so there is no lib files. so the error was not about any link errors.
Another important thing is: function DXUTSetD3D11Device has no implementation in DXUT framework. if you want to use it, you should implement it yourself.

Why am I getting an 'Invalid property value' err 380, VB6, VSFlexGrid.buildcombolist?

I'm brand new to working with VB6, and I'm trying to debug an err 380. The error occurs during a call to a function from VSFlexgrid used, and I've found very little specific documentation on the function involved: VSFlexgrid.BuildComboList.
I'm developing in a VM running win XP, and the software usually runs on Win7, so I don't think it falls in the compatibility issue I've seen on SO already.
The portion of code where it occurs happens multiple times in the program without fault, but only occurs on a particular action.
Does anyone know what might be causing the error specifically (or in general with these types of functions)? Is it a property of RecordSets that is triggering an error that I probably don't know about (very new to vb6)? I've confirmed that the parameters to BuildComboList aren't empty/null when the error occurs. My suspicions are with the recordset though....
Some Code:
Public Function LoadFlexCombo(grd As VSFlexGrid, conpassedconnection As Connection,
StoredProcedureName As String, FieldList As String, Optional keyfield As String,
Optional LookupName As String, Optional colKey As String, Optional UDFFilterValue As
String)
...
grd.BuildComboList(rs, FieldList, keyfield) 'bails out to error handler here.
...

ORA-28579: network error during callback from external procedure agent

Has anyone seen this error when trying to call an external C function from an Oracle query? I'm using Oracle 10g and get this error every time I try to call one of the two functions in the library. A call to the other function returns fine every time, though the function that works is all self-contained, no calls to any OCI* functions.
Here's the stored procedure that is used to call the failing C code:
CREATE OR REPLACE PROCEDURE index_procedure(text in clob, tokens in out nocopy clob, location_needed in boolean)
as language c
name "c_index_proc"
library lexer_lib
with context
parameters
(
context,
text,
tokens,
location_needed
);
Any help would be appreciated. Everything I've found on this error message says that the action to take is: Contact Oracle customer support.
Edit: I've narrowed it down to the point that I know that there is a segfault deep in libclntsh after I call OCILobTrim (to truncate it down to 0 length) on the tokens clob. Here is the code I've been using to call this procedure.
declare text CLOB; tokens CLOB;
begin
dbms_lob.createtemporary(tokens, TRUE);
dbms_lob.append(tokens, 'token');
dbms_lob.createtemporary(text, TRUE);
dbms_lob.append(text, '<BODY>Test Document</BODY>');
index_procedure(text, tokens, FALSE);
dbms_output.put_line(tokens);
end;
/
Is there something wrong with this setup that might be causing OCILobTrim problems?
It looks like this is one of those errors that essentially means any number of things could have gone wrong with the external procedure.
There is a known bug in 10.2.0.3, no idea if it's relevant:
ORA-28579 occurs when trying to select
data from a pipelined table function
implemented in "C" using the
ODCITable/ANYDATASET interface.
ODCITableDescribe works fine but
ODCITableFetch generates an ORA-28579
error.
I would suggest:
Look in the database server
trace directories, and the directory
where the external proc is located,
for any log or trace files generated
when the error occurs.
Instrument your external proc in
some way so that you can try to
trace its execution yourself.
Contact Oracle support
Well, an upgrade to 10.2.0.4 (was using 10.2.0.1) at least gave me an understandable error instead of a fairly useless core file and the ORA-28579.
It turns out that the code I was debugging was assuming that calling OCILobRead would return all of the data in one pass. This is the case for any client using a fixed width character set.
For clients using a variable width character set, this isn't the case, OCILobRead was actually reading part of the data and returning OCI_NEED_DATA and future calls to OCILobTrim and OCILobWrite were failing because of the still pending call to OCILobRead. The solution was to loop OCILobRead calls until OCI_NEED_DATA was no longer returned and we had all of the needed data in our buffer.
A call to OCIBreak also would have allowed the OCILobTrim and OCILobWrite functions to continue, though we wouldn't have had all of the needed input data.

Resources