|
When I am setting the WMI property value, I get the error. The method SetProperty() raises the error.
void CTL_Memory::OnMemoryInstances(CWbemInstanceList& instList, LPWBEMMETHODCTX ptrs)
{
// Create instance!
LPWBEMINSTANCE pInst = CreateWbemInstance(ptrs);
if (pInst)
{
CComVariant varValue(11ul);
varValue.ChangeType(VT_UI8);
//varValue.ullVal = 0l;
pInst->SetProperty(L"EWFUsage",UINT32(11));
instList.Add(pInst);
}
}
|
|
|
|
|
When I change the code to :
pInst->SetProperty(L"EWFUsage",int(11));
I.e., intead of casting it as UINT32 I cast it to int() then it works. My other property values are 64 bit, which data type casting will I be required to use?
|
|
|
|
|
__int64?
Look at the source code for the WMI Provider framework you're using - that should define the mappings between C++ types and VARIANT types.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I checked the atlcomcli.h file, which defines the C++ to VARIANT mappings.
In order to support uint64 I have _ATL_SUPPORT_VT_I8 defined in stdAfx.h file, the code snippet from atlcomcli.h based on which I defined the directive is :
#if (_WIN32_WINNT >= 0x0501) || defined(_ATL_SUPPORT_VT_I8)
CComVariant(__in LONGLONG nSrc) throw()
{
vt = VT_I8;
llVal = nSrc;
}
CComVariant(__in ULONGLONG nSrc) throw()
{
vt = VT_UI8;
ullVal = nSrc;
}
#endif
In the code I tried using __int64 and LONGLONG but still I am getting the same error (0x80041005).
|
|
|
|
|
I'm thinking more of the code that implements the 'SetProperty' method
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I just figured out that this method is in a header file I took from a book.
I am debugging the code and trying to figure out the reason.
|
|
|
|
|
Got it working, 64 bit integers are handled differently from 32 bit integers.
I tweaked the code to handle 64 bit integers as well and it worked.
Thanks for your time.
|
|
|
|
|
how to get the name of propertie in actvieX control.
Eg:
"BackColor"
"Visible"
"Caption"
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
You need to interrogate the control for its type information. This CodeProject article[^] has code that does that.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello,
I am trying to simulate a SONY TV remote control to our Set Top box's (STB) remote control.
We use Serial Communication to communicate between the TV and the STB. We are using SONY TV RS232C Control Protocol Manual to send information thru our remote to the SONY TV.
To ensure serial communication I have used a SerialPort class of Microsoft.
Now we know interfaces as Ethernet, FireWire, and USB all that send data as a serial stream, the term "serial port" usually identifies hardware more or less compliant to the RS-232 standard, intended to interface with a modem or with a similar communication device.
But the Control Protocol doc specifies that it is RS232C complaint?
Will the same class support the serial communication?
I ask that as I feel that there is an error in the communication between my remote and the SONY TV?
|
|
|
|
|
This SerialPort[^]? Yes, it refers to the RS232C you commonly get (or used to get) on PCs.
BTW - this forum is for COM[^] programming, not COM[^] programming...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Are you shure, that your cable has the right connections? Sometimes it is necessary to have some pins bridget inside the connectors. Is it a Control-S protocol we are talking about?
Regards: Didi
|
|
|
|
|
Can someone help with why if I can see my object in the ROT (via IROTVIEW.EXE), but when I call GetObject() it returns null.
private static Hashtable GetROT()
{
Hashtable result = new Hashtable();
IntPtr pnumFetched = IntPtr.Zero;
IRunningObjectTable runningObjectTable;
IEnumMoniker monikerEnumerator;
IMoniker[] monikers = new IMoniker[1];
Ole32.GetRunningObjectTable(0, out runningObjectTable);
runningObjectTable.EnumRunning(out monikerEnumerator);
monikerEnumerator.Reset();
while (monikerEnumerator.Next(1, monikers, pnumFetched) == 0)
{
IBindCtx ctx;
Ole32.CreateBindCtx(0, out ctx);
string runningObjectName;
monikers[0].GetDisplayName(ctx, null, out runningObjectName);
object runningObjectVal;
runningObjectTable.GetObject(monikers[0], out runningObjectVal);
System.Diagnostics.Debug.WriteLine(runningObjectName);
result[runningObjectName] = runningObjectVal;
}
return result;
}
|
|
|
|
|
What HRESULT does runningObjectTable.GetObject(monikers[0], out runningObjectVal); return? That generally sheds light on unexpected results...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
The HResult returned was 0x80070005.
I also tried,
object retval = Marshal.GetActiveObject("MyNamespace.MyClass"); and the exception that got thrown was...
System.Runtime.InteropServices.COMException was unhandled
Message="Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))"
Source="mscorlib"
ErrorCode=-2147221021
;
The return value for the call to register the object in the ROT was 65536. This value seems to be the same everytime.
int register = rot.Register((ROTFLAGS_REGISTRATIONKEEPSALIVE | ROTFLAGS_ALLOWANYCLIENT), pObj, moniker);
|
|
|
|
|
lee23 wrote: The return value for the call to register the object in the ROT was 65536. This value seems to be the same everytime.
I think you'll find this is a token that identifies the running-object you've registered, which you pass into the IRunningObjectTable::Revoke method.
If your program registered the object and exited without revoking, then that could lead to the situation you describe, where IROTVIEW shows your object, but you can't reference it.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
hi,
how can i write any text,value on bars using mschart
thanks
|
|
|
|
|
I explored this control so long ago, I'd forgotton what the object model was like, so, I GOOGLED, and found this over at MSDN: MSChart Control Objects Listed Alphabetically[^]. Unfortunately, the code is Visual Basic, but, it gives you the specifics of the object model hierarchy.
You could use Dumpbin to determine the exported function prototype, and the rest would be fairly simple.
|
|
|
|
|
You can see on Adv. Win32 group
where a complete code in native Win32 had been posted (a few weeks ago)
|
|
|
|
|
I have a Windows Serviced written in .Net which creates an instance of a comvisible class on start up of the service. In the constructor of this class, it tries to register this instance on the running object table with the ROTFLAGS_ALLOWANYCLIENT flag.
I read, in order for a ROT registration with ROTFLAGS_ALLOWANYCLIENT to succeed, the following registry entries must be present:
[HKEY_CLASSES_ROOT\AppID\app.exe] "AppID"="{APPIDGUID}"
What I like to ask is who creates this appid guid or where can I find it in the project?
I am getting the below error and cannot understand why. I tried installing the service as account type LocalSystem, LocalService & User and still got the same result...
Service cannot be started. System.Runtime.InteropServices.COMException (0x80004015): The class is configured to run as a security id different from the caller (Exception from HRESULT: 0x80004015)
I am unclear as to what other registry entries I need to make to get this to work.
Any help is appreciated.
|
|
|
|
|
lee23 wrote: What I like to ask is who creates this appid guid or where can I find it in the project?
This blog post[^] looks informative.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I have seen this article and have tried getting dcomcnfg.exe to create it. I loaded it up but didn't see any prompt asking if I want to create an appid for my exe. I also didn't see it listed there after it's finished loading up.
|
|
|
|
|
This Google groups thread[^] may be informative.
In addition - I created an ATL service project, just to see what ATL would have for that - it contained the definition of the AppID, which it would put in the registry as necessary - that kind of says your executable needs to do that.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks Stuart for your responses. I have also seen this article and have followed it and created a MyRegisterObject function and still isn't clear to me this AppID guid I need.
I have created my windows service in .Net and therefore not sure where to find this appid. I tried entering the assembly guid and the object's (the one I want to register on the ROT) guid for the {APPIDGUID} value and that didn't help.
[HKEY_CLASSES_ROOT\AppID\app.exe] "AppID"="{APPIDGUID}"
Just to clarify, I have a Windows Service project written in .Net, it also contains a class made to be comvisible. On start up of the service, I create an instance of this class. In the constructor of this class, I try to register this instance on the running object table with the ROTFLAGS_ALLOWANYCLIENT flag.
|
|
|
|
|
lee23 wrote: Just to clarify, I have a Windows Service project written in .Net, it also contains a class made to be comvisible. On start up of the service, I create an instance of this class. In the constructor of this class, I try to register this instance on the running object table with the ROTFLAGS_ALLOWANYCLIENT flag.
Yeah, I understand all that - I'm just finding it difficult to work out what the implications of that are when mixed in with services, user permissions, the running object table etc
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|