|
Hmmm, I can see that much memory leak, mentioned earlier.
Dont know how you are using it.
|
|
|
|
|
hi
I am working killing a process using WMI iam using the following code .
HRESULT hres;
BSTR ClassName = SysAllocString(L"Win32_Process");
/* YOU NEED TO CHANGE THE NUMBER VALUE OF THE HANDLE
(PROCESS ID) TO THE CORRECT VALUE OF THE PROCESS YOU
ARE TRYING TO TERMINATE (this provides a path to
the class instance you are tying to terminate). */
BSTR ClassNameInstance = SysAllocString(
L"Win32_Process.Handle=\"\1418\"");
_bstr_t MethodName = (L"Terminate");
BSTR ParameterName = SysAllocString(L"Reason");
IWbemClassObject* pClass = NULL;
hres = m_pIWbemService->GetObject(ClassName, 0, NULL, &pClass, NULL);
IWbemClassObject* pInParamsDefinition = NULL;
IWbemClassObject* pOutMethod = NULL;
hres = pClass->GetMethod(MethodName, 0,
&pInParamsDefinition, &pOutMethod);
if (FAILED(hres))
{
cout << "Could not get the method. Error code = 0x"
<< hex << hres << endl;
}
IWbemClassObject* pClassInstance = NULL;
hres = pInParamsDefinition->SpawnInstance(0, &pClassInstance);
// Create the values for the in parameters
VARIANT pcVal;
VariantInit(&pcVal);
V_VT(&pcVal) = VT_I4;
// Store the value for the in parameters
hres = pClassInstance->Put(L"Reason", 0,
&pcVal, 0);
// Execute Method
hres = m_pIWbemService->ExecMethod(ClassNameInstance, MethodName, 0,
NULL, pClassInstance, NULL, NULL);
if (FAILED(hres))
{
cout << "Could not execute method. Error code = 0x"
<< hex << hres << endl;
VariantClear(&pcVal);
SysFreeString(ClassName);
SysFreeString(MethodName);
pClass->Release();
pInParamsDefinition->Release();
m_pIWbemService->Release();
//pLoc->Release();
CoUninitialize();
return 1; // Program has failed.
}
it is working fine ,but here iam gicing the Process ID which has to be terminated like 1418.
Instead of ProcessID i want to use process Name like CAlc.exe or notepad.exe
but when IAm tring to change the code with the process name like
SysAllocString(
L"Win32_Process.Name=\"\notepad.exe\"");
notepad is not terminating . can you please help me to solve it.
Thanks in Advance
abhi
|
|
|
|
|
pItem1Ptr->put_innerHTML(L"");
The code above is to change something in the HTML.
It works well in IE6,I can get the gif picture successfully.
But when I run my code in IE7, this code can't work........and I found that, if I replace c:\\float.gif into http://somesite/somepic.gif It can work nice. So I think there maybe something changed in IE7, can anyone tell me how to show my c:\\float.gif picture in IE7????
|
|
|
|
|
Try using "file:///c:/float.gif" (as you should if file paths are used).
Steve
|
|
|
|
|
well,thanks for your reply.
but both your method or mine get the same result.
I use get_innnerHTML ,and print the result:
It seems just ok.
But whatever,I can't see the picture.
The propertis of picture I just can see:
Protocol: Not Available
Type: Not Available
Address: Not Available
Size: Not Available
|
|
|
|
|
Hi All,
Recently I got some doubts regarding Connection Points. Please replay the mail, if you know the answers.
1. What are the main drabacks (except implementation difficulties). Suppose client requested the server for some operation and doing its wone work. In the time of server doing work, if some problem occurred on the server. Then how server inform the client saying that operation failed.
My doubt is how server inform client sink, when server fails to do the operation.
2. Why Microsft intraduced delegates, while we are having Connection points. I know delegates are type safe, object oriented. But why elemenated Connection points.
3. VB internally uses Sink Map, IConnectionSimpleImple or not.
Thanks
nch srinivas
|
|
|
|
|
Have a debug failure when creating a window of my COM 3d imager. I think its an issue with passing my OLE control through my sub classes.
When I created my 3d imager window inside my application…
bRet = m_pSatMap->Create("Internal_DB_SAT_Map", 0, Rect, pMainFrm, ID_SAT_MEM_MAP, NULL, FALSE);
I got an assertion error from ENSURE(afxOccMgr != NULL)”. After researching this I found that this would occur when AfxEnableControlContainer() was not call. However it is in my main but not in my subclass where the Create is called. So I added it to that class, and now I have another assertion problem. Now “ASSERT(pWndCtrl->m_pCtrlSite == NULL)” is failing.
I think I’m looking for a site that speaks to how to pass afx control to classes inside an application.
Thanks for any help
Glenn
Programmer
Glenn Earl Graham
Austin, TX
|
|
|
|
|
Hi Community,
for my next project, I need a kind of data grid in my application. Is there a handy ActiveX-control which I can use on a FormView, or is there a way to use the Windows Forms DataGridView in my MFC-App?
Thanks,
Frank.
|
|
|
|
|
Hello
I've a problem with an activex component in some machines, in one in it
registry i see that the compability of the activex is 5.17 but the computer
is full of windows update, How can I upgrade the compability in orden to use
the activex component.
thanks for all
|
|
|
|
|
My DCOM server works very well in Intranet,but In Internet it can not work,I always get the error of 0x800706BA!
How can I do? thanks!
Johnson Wen in china
|
|
|
|
|
Hi everybody,
I've got a strange thing using my DCOM application(s).
I wrote both server and client, and one of the last issues I can't resolve is the following:
On the server machine (EXE Server with MFC) I have the following class method (with implementation):
STDMETHODIMP CAugVisionEngine::ReadText(BSTR CharSetName, int pTop, int pLeft, int pHeight, int pWidth, BSTR *OcrString)<br />
{<br />
AFX_MANAGE_STATE(AfxGetStaticModuleState())<br />
... [code omitted here for brevity]
...
char* strTemp = (char*) malloc(sizeof(OcrReport_tmp->readString)+1);<br />
strcpy(strTemp, OcrReport_tmp->readString); <br />
*OcrString = W2BSTR(A2W(strTemp));<br />
<br />
return S_OK;<br />
}
where the last parameter, the BSTR, is the return value of the function (just [out], not [out, retval])
When I call the function from the client (for now MFC application, just to test, but the release will be a console application), in a way like this:
BSTR OCRBSTR;<br />
<br />
pIVE->ReadText ("C:\\Patterns\\3260\\05042800\\1235.abc",40, 249, 48, 83, &OCRBSTR);
I get that the server constructs the BSTR correctly (at least, it seems to do it, since a logfile is populated correctly), but my client retrieves nothing...
I'm stuck...
Any ideas?
Thanks in advance,
Morenz.
|
|
|
|
|
your code doesn't seem to have problem.
morenz wrote: *OcrString = W2BSTR(A2W(strTemp));
As you said, this value you are writing in log file, isn't it?
-- modified at 4:56 Tuesday 14th November, 2006
|
|
|
|
|
yes, I'm writing it in a file as a string. When I debug it, I see that the BSTR has the correct value, too...
For now I workarounded it, making the client open the file directly on the server and getting the string itself, but it's not elegant...
|
|
|
|
|
im using .net 2k3, office 2k3
well every thing was working fine, but after a week during which i've
not edited/used my code !!! and now everything is in mess...
please help me to solve this problem..
dim applicationObject As Object
WithEvents outApp As Outlook.Application
while assigning,
outApp = applicationObject
i'm getting error,
message => "Could not load type
Outlook.ApplicationEvents_11_NewMailEventHandler from assembly
Interop.Outlook, Version=9.1.0.0, Culture=neutral, PublicKeyToken=null."
Err.Number => 429
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
Hello,
I can't figure out how to derive a class from an interface with pure functions side by side a class that implements those functions and use those functions in place of the pure ones. That is:
interface BaseInterface : public IUnknown
{
};
interface DerivedInterface : public BaseInterface
{
STDMETHOD_( INT, AddNumbers )( INT LHS, INT RHS ) PURE;
};
class BaseInterfaceImpl : public BaseInterface
{
STDMETHOD_( ULONG, AddRef )()
{
return S_OK;
}
STDMETHOD_( ULONG, Release )()
{
return S_OK;
}
STDMETHOD( QueryInterface )( REFIID RefIID, LPVOID *ppObject )
{
return S_OK;
}
};
class DerivedInterfaceImpl : public DerivedInterface, public BaseInterfaceImpl
{
public:
STDMETHOD_( INT, AddNumbers )( INT LHS, INT RHS )
{
return LHS + RHS;
}
};
MSVC gives me the error:
c:\documents and settings\todd\my documents\visual studio
2005\projects\whitehall\toying with c++\toying.cpp(72) : error C2259:
'DerivedInterfaceImpl' : cannot instantiate abstract class
due to following members:
'HRESULT IUnknown::QueryInterface(const IID &,void **)' : is
abstract
d:\program files\microsoft visual studio
8\vc\platformsdk\include\unknwn.h(113) : see declaration of
'IUnknown::QueryInterface'
'ULONG IUnknown::AddRef(void)' : is abstract
d:\program files\microsoft visual studio
8\vc\platformsdk\include\unknwn.h(117) : see declaration of
'IUnknown::AddRef'
'ULONG IUnknown::Release(void)' : is abstract
d:\program files\microsoft visual studio
8\vc\platformsdk\include\unknwn.h(119) : see declaration of
'IUnknown::Release'
I've got the source code of my dummy-test scenario at
http://lanlocked.net/junk/toying.cpp. I managed to get it to work by
deriving DerivedInterface from BaseInterfaceImpl but I don't see this
as a solution, rather a workaround (I'd like to keep the interfaces
"clean" and 100% pure). If it's impossible to do what I'm trying to do,
what are the other methods of inheriting in COM?
Thanks in advance,
Todd
|
|
|
|
|
Inactive Cargo wrote: managed to get it to work by
deriving DerivedInterface from BaseInterfaceImpl but I don't see this
as a solution, rather a workaround
Whats problem with this?
Inactive Cargo wrote: (I'd like to keep the interfaces
"clean" and 100% pure).
Can you explain this ?
Inactive Cargo wrote: c:\documents and settings\todd\my documents\visual studio 2005\projects\whitehall\toying with c++\toying.cpp(72) : error C2259: 'DerivedInterfaceImpl' : cannot instantiate abstract class due to following members: 'HRESULT IUnknown::QueryInterface(const IID &,void **)' : is abstract
It is because, compiler doesn't find definition of this function. Dont combine it with one in BaseInterfaceImpl .
|
|
|
|
|
Dear All,
I am new to this COM usage in VB6. I created a COM object and it was given me a dll file and also installed to the computer so I can get the dll in References in VB6.
I typed the example code given in the MatLab and also a sample code Building COM Components Using MATLAB - Part I by A Riazi, But It giving me an error message called "Automation Error. The specified module could not be found".
Please help me to go throught this.
Thaks All
Prageeth
Dhanushka P
|
|
|
|
|
Hi,
How do I create an ActiveX control in VB 6 which will install a certificate to Internet Explorer's Personal Certificate category automatically with the click of a button named "Install Certificate" in IE's web page.
Kindly provide me the code required for the ActiveX control.
Thanks in advance.
Subrahmanyam K
|
|
|
|
|
I've added a dll (added as refernce)
and I am trying to create a new class from the dll
but I get this error:
Retrieving the COM class factory for component with CLSID {DD683B25-1820-412E-AA8A-7AA92321EBC8} failed due to the following error: 8007007e.
in the tips: it tell me something about the location
of the dll and it not being found
can someone please help me?
|
|
|
|
|
i want the code for x to the power n divided by n factorial
aman
|
|
|
|
|
i am working on a project which is a namespace extension which supports drag and drop of file between windows folder and our namespace folders. The technique used to drag and drop a file from our namespace folder to windows folder is like this:
1. when drag is initiated,
a)details of the dragged object are stored in a global variable.
b)IDataObject(which supports 2 formats-CF_HDROP for between windows and private format for between our namespace folders) is created and drag loop is initiated by calling DoDragDrop().
2. In IDataobject::Getdata, for CF_HDROP format, a temp dir is created and the path is written to clipboard.
3. we have a copy hook handler which actually does the work of copying the file from namespace folder to windows folder.The Copycallback method of copyhookhandler gets the info from global variable and puts into windows folder and returns IDNO.
The product is working on thousands of systems correctly but on a perticular system with xp its not working.
log files show that IDataObject::GetData() is called n times with CF_HDROP , temp folder is created and folder path is written to clipboard. But ICopyHook::copyCallback() is not called.Deleting the copyhook handler registry key should create the temp folder(as we have placed this folder path on the clip board in IDataObject::Getdata() and our copyhook handler is not present) in drop target but its not happening here.
what might have gone wrong?can anyone help me?
|
|
|
|
|
I am writing a attributed COM component in Visual Studio .NET 2003 (VC++ 7.1). For reusing the types defined in some other TLB, I want to import this TLB that I do by inserting the following line in stdafx.h.
[ importlib("test.tlb") ];
This 'importlib' attribute places this line in the library block of the IDL file. However, now if some of the interface methods in my COM component want to return an interface defined in test.tlb, it gives me IDL compilation error.
Perhaps, it is probably since the automatic IDL generation by the compiler puts all the interface declarations of my component outside the library block, and the importlib attribute generates the importlib line inside the library block... and, so the interface declarations of my component are not able to recognize the interface types defined in the imported type library.
Can anyone suggest me if I am importing the library in a wrong way, or if there is any other solution to it ?
Thanks & Regards,
Arun
|
|
|
|
|
Hi all
I Am working on windows server 2003 cluster and i need to use WMI for this..
can i know what all we can do with WMI for clusters etc
can i have some script examples for this
Thanks in advance
abhi
abhi
|
|
|
|
|
Hi
As we list all the shared assemblies in GAC using gacutil on a paritcular system.
Is there any way to list or find all those assemblies which are registered as COM component using regasm either programmatically or through some utility.
Regards
Kamal Chauhan
|
|
|
|
|
Reposting a question multiple times and adding "Very Urgent" to the subject is not going to get you an answer, just annoy people.
Have you tried using google ?
Darka [ Xanya]
"I am not a slave to a god that doesn't exist."
|
|
|
|
|