|
Hello,
In the case you described I prefer to use WMI (Windows Management Instrumentation). It's an ultimate tool for making a kind of administrative work both on a local and remote computer under Windows XP & 2000. WMI "System Registry Provider" gives a full control on registry DB. You have to have administrative rights to perform any registry write operations on a remote PC, of course.
If you are interested in using WMI, write me, I may share a simple project with you as an example of administration via WMI.
Regards,
ISerik
|
|
|
|
|
Using WMI from Linux? The only way is using the COM WBEM Scripting locator and it's not automated by default. We MUST change the registry like I said.
Raphael Amorim Dantas Leite
VC++, Java and C# programmer. Win32 and PocketPC enviroments
|
|
|
|
|
i want to programatically call WindowActivate event of word object..
how can i?
"You can do any thing you set to your mind" - theGhost_k8
|
|
|
|
|
Hello, all.
I have windows service. This following code in a application:
CoInitialize(0);
HRESULT hr;
SHDocVw::IShellWindowsPtr spSHWinds;
hr = spSHWinds.CreateInstance (__uuidof(SHDocVw::ShellWindows));
I get error: "Class isn't register".
|
|
|
|
|
It may be due to that a Service by default runs on a different (non visible) windows station.
Try setting the Service up to start as a specific user.
1. Go to the Start Menu, Select Run and type "services.msc" and press return.
2. Select your Service, right click and choose "Properties"
3. Select the "LogOn" tab and enter in the details of a valid user.
Or it could be that you need to check the "Allow Service to Interact with
Desktop" checkbox.
regards,
Darka [ Xanya]
"I am not a slave to a god that doesn't exist."
|
|
|
|
|
I create service with SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS and SERVICE_INTERACTIVE_PROCESS
|
|
|
|
|
Did you try my first suggestion of changing the Service to run as a specific user account ?
Darka [ Xanya]
"I am not a slave to a god that doesn't exist."
|
|
|
|
|
Ok, if the service run in other user account it work. But it is necessary to start service from LocalSystem account.
|
|
|
|
|
Then you need to impersonate another user, see the LogonUser() and ImpersonateLoggedOnUser() functions.
Darka [ Xanya]
"I am not a slave to a god that doesn't exist."
|
|
|
|
|
I am sorry. And it is impossible little bit more in detail? I all time developed programs on a low level. Simply we had a situation, that more anybody is not present at the moment, and to make it is necessary urgently.
|
|
|
|
|
Try something like this:
<code>TCHAR szDomain[] = 'DomainName';
TCHAR szUserName[] = 'Username';
TCHAR szPassword[] = 'Password';
HANDLE hUser = NULL;
BOOL bLoggedOn = LogonUser(szUserName, szDomain, szPassword, LOGON32_LOGON_NEW_CREDENTIALS, LOGON32_PROVIDER_WINNT50, &hUser);
if(!bLoggedOn)
{
DWORD dwErr = GetLastError();
return;
}
if(!ImpersonateLoggedOnUser(hUser))
{
DWORD dwErr = GetLastError();
return;
}
CoInitialize(0);
SHDocVw::IShellWindowsPtr spSHWinds;
HRESULT hr = spSHWinds.CreateInstance (__uuidof(SHDocVw::ShellWindows));
RevertToSelf();
Darka [ Xanya]
"I am not a slave to a god that doesn't exist."
|
|
|
|
|
|
IElementBehaviorFactory* pEBFactory = NULL;
//Create my com object of implementing IElementBehaviorFactory interface
CoCreateInstance(CLSID_Factory, NULL, CLSCTX_INPROC_SERVER,IID_IElementBehaviorFactory, (void**)&pEBFactory);
//Mashal IElementBehaviorFactory
hr = CoMarshalInterThreadInterfaceInStream(IID_IElementBehaviorFactory, pEBFactory, &pStm);
The return value hr is 0x80004002, why?
|
|
|
|
|
0x80004002 has the symbolic name E_NOINTERFACE .
IID_IElementBehaviorFactory : {3050F429-98B5-11CF-BB82-00AA00BDCE0B}
On the face of it the return value of E_NOINTERFACE seems not to make any sense. If the search of the IID in the registry however there is no proxy/stub registered; I'd guess that's the reason.
Steve
|
|
|
|
|
The default value of [HKEY_CLASSES_ROOT/Interface/{3050F429-98B5-11CF-BB82-00AA00BDCE0B}/ProxyStubClsid32] is {B8DA6310-E19B-11D0-933C-00A0C90DCAA9}.
{B8DA6310-E19B-11D0-933C-00A0C90DCAA9} is the class id of actxprxy.dll.
I think that actxprxy.dll is the proxy/stub for IElementBehaviorFactory, but I don't know why CoMarshalInterThreadInterfaceInStream call fail for IElementBehaviorFactory.
|
|
|
|
|
jinhaibo wrote: The default value of [HKEY_CLASSES_ROOT/Interface/{3050F429-98B5-11CF-BB82-00AA00BDCE0B}/ProxyStubClsid32] is {B8DA6310-E19B-11D0-933C-00A0C90DCAA9}.
My system doesn't have this key. Yours does?
Steve
|
|
|
|
|
|
The environment is Visual Studio 2005 and my project was created via extensibility -> shared add-in.
How can I debug efficiently?
At present, I have to SETUP the add-in and start outlook manually each time I want to see the differences I have made to the program ...
|
|
|
|
|
A poor man's hack would be to insert __asm int 3 somewhere in the code. That will trigger windows into invoking a debugger. You will get a dialog asking you what to do: debug or quit. Choose debug, and use the running instance of VS.NET to debug. It's not pretty, but it works.
As for starting and quiting outlook: you'll have to learn to live with it. Outlook will lock your add-in dll while it's loaded, making it impossible to link the dll while it's running.
--
Not Y3K Compliant
|
|
|
|
|
Using DebugBreak is the slightly more portable version. It does mean that the debugger stops inside the DebugBreak function rather than in the calling function, so you need to do a Step Out when the debugger stops.
|
|
|
|
|
I am trying to use the settings.designer.cs file for a value that needs to be put into the app.config file.
My config(auto-generated by VS2005) file now looks like this:-
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Settings1" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</sectionGroup>
</configSections>
<applicationSettings>
<General.Settings1>
<setting name="DatabasePath" serializeAs="String">
<value>C:\Web\App_Data\Messages.mdb;</value>
</setting>
</General.Settings1>
</applicationSettings>
</configuration>
In the C# code i am trying to access this property by this code:
Settings1 set = Settings1.Default;
string str = set.DatabasePath;
return str;
The above line of code returns null.can anyone explain what am i missing here?
|
|
|
|
|
hi Shilpa,
how to access a COM component developed in vc++6.0 from ASP.net?
what r the issues need to be considered in this case??
Thanks in advance.
Prashanth.v
|
|
|
|
|
hi experts,
I'm quite new to the topic of COM and Automation and I have a few basic problems and questions:
I modified my existing MFC application to a multithreaded Automation server with the help of a tutorial i found on http://www.codeproject.com/com/mfc_autom.asp and made it via coinitializeex running as multithreaded, the application is a .exe
and lateron call COleTemplateServer::RegisterAll(),
but when I try to get an active instance via hr=GetActiveObject(clsid) I get as result: 0x800401e3 operation unavailable
and if i try to create a new instance via
hr=::CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER, IID_IApplication1, (void**)&m_IApplication))
it returns the active instance instead of creating a new one
I also use another project with automation and there getactiveobject and cocreateinstance works fine
I think as COleTemplateServer::RegisterAll() returns TRUE it should correctly register my objects with the ROT (which if not, could be the reason for getactiveobject returning an error) or am I wrong?
So has anyone an idea how I become it working to getactiveobject() returning the active object and cocreateinstance() creating a new one
with best regards Stefan Buchner
|
|
|
|
|
Hi guys,
This activex control has optionals parameters for GetData method:
this.axWinsock1.GetData(ref object data,object type,object maxlen)
i tried these:
object rec= string.Empty;
object type = 0;
object maxlen = 0;
this.winsock.GetData(ref rec, type, maxlen);
or
object rec= string.Empty;
object type = string.Empty;
object maxlen = string.Empty;
this.winsock.GetData(ref rec, type, maxlen);
but all i get is "Unsupported variant types" error message, do you know how to call this getdata method in c#? i know if you call it in vb.net you dont need to pas optional parameteres.
Please help
|
|
|
|
|
Don't use this control in C#. Instead, use the System.Net.Sockets.Socket class, or the TcpClient , UdpClient , TcpListener classes which are a little more friendly to use.
The data you get from the socket will be in raw bytes. You will need to use one of the System.Text.Encoding classes to turn text from the byte-oriented wire format into a string . As a starting point, try Encoding.Default .
|
|
|
|