|
Yes, you might end up discovering your service needs to be configured to run as a particular user - a user with some privileges on your local machine or on your domain - so that the service will have network rights or access to certain files. Just because some process runs as a service does not necessarily imply it has free reign of your machine or the LAN.
|
|
|
|
|
Adding a try catch block does not provide any assistance since no exception is thrown when i try to create a Connection object. The following is an extract of my code.
try
{
HRESULT hRes = m_Conn.CreateInstance(__uuidof(Connection));
if (m_Conn)
{
m_Conn->ConnectionString = strConn;
}
else
{
m_sErrorMsg = "Cannot create connection";
return FALSE;
}
}
catch( _com_error &e)
{
// get info from _com_error
m_sErrorMsg.Empty();
m_sErrorMsg.Format("%s : %s", (char *)e.Source(), (char *)e.Description ());
return FALSE;
}
Currently the service runs using the 'Local System' account. I have tried changing it to my user account, but it still doesn't work. The Connection object is null.
Any help is greatly appreciated.
Thanks.
|
|
|
|
|
chamilkab wrote:
Any help is greatly appreciated.
Perhaps you do it else where, but have you made the call to CoInitialize(NULL)?
Also, what is your HRESULT returning?
-------------------------------
DEBUGGING : Removing the needles from the haystack.
-- modified at 7:37 Monday 12th September, 2005
|
|
|
|
|
Hi!
I called ::CoInitialize before trying to create the connection. But still it didn't work when i ran the application as a service. However it works fine when running as a normal application.
However i found out later that since this is a Service Application you have to call ::Coinitialize from the ServiceMain Function.
Thanks for the help
|
|
|
|
|
chamilkab wrote:
However i found out later that since this is a Service Application you have to call ::Coinitialize from the ServiceMain Function.
Glad to hear you finally got it working. Good knowledge to know, I will have to remember that.
-------------------------------
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
Can somebody help me in developing a software for a different language, other than English under WinXP English. Such that, buttons of messageboxes should have caption and text in that language. Any help wud be appreciated.
Best Regards,
|
|
|
|
|
Write some string resources in what ever language you want,
then use them to set the caption (window text) of your controls
SkyWalker
|
|
|
|
|
|
How to create wizard based programs in vc++
Plz Give simple code to understand.
In my system there is no Property Sheet Active X Control.
Praveen Chowdam Kumar
|
|
|
|
|
|
Hello!
This will sound like a simple problem, but unfortunately I wasn't able to do it up to now: just resize a window at runtime.
I have a dialog with a few controls. I now want to reposition one control 10 pixels to the left and make it 10 pixels bigger (i.e. just extend it to the left).
How do I do this?
I tried all combinations of GetWindowRect, ScreenToClient, ClientToScreen, SetWindowPos and MoveWindow that come to my mind, but the control is always positioned incorrectly. Help!!
Best regards
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Let's say, your control is a CEdit (but it can be whatever )
<br />
CRect R;<br />
CEdit *pE = (CEdit *)GetDlgItem(IDC_EDIT_1);<br />
pE->GetWindowRect(&R);<br />
ScreenToClient(&R);<br />
R.left += 10;<br />
R.right += 10;<br />
R.top += 10;<br />
R.bottom += 10;<br />
pE->MoveWindow(&R);<br />
This will move the control 10 pixels to the right and downwards.
SkyWalker
|
|
|
|
|
Ah, this works, many thanks!!
The problem with my attempts was that I called the ScreenToClient function of the window to be moved (pE->ScreenToClient ) instead of the parent dialog's.
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
|
Those things happen most of the time to me, too
SkyWalker
|
|
|
|
|
I am programing a Socket with SSL,so i m using various header files for encrytion,ssl protocol
#include <wincrypt.h>
#include <wintrust.h>
#include <Schnlsp.h>
(these header files r in stdafx.h)
when i compiling my program is showing errors,eg
c:\program files\microsoft visual studio\vc98\include\schnlsp.h(118) : error C2501: 'ALG_ID' : missing storage-class or type specifiers
when click on the error
typedef struct _SecPkgCred_SupportedAlgs
{
DWORD cSupportedAlgs;
ALG_ID *palgSupportedAlgs;
} SecPkgCred_SupportedAlgs, *PSecPkgCred_SupportedAlgs;
when i check this strucure in msdn i found data type ALG_ID is defined in the Wincrypt.h header file.
when i check wincrypt i found that a macro has to be define
#if(_WIN32_WINNT >= 0x0400)for using wincrypt.h
so i defined #define _WIN32_WINNT 0x0500 in stdafx.h before any header file is defined
now when i again compile the program
D:\sunit\controleon\Working\CSocket\sslsocket.cpp(611) : error C2039: 'dwFlags' : is not a member of '_SCHANNEL_CRED'
c:\program files\microsoft visual studio\vc98\include\schnlsp.h(129) : see declaration of '_SCHANNEL_CRED'
i found the struct _SCHANNEL_CRED in schnlsp.h file
typedef struct _SCHANNEL_CRED
{
DWORD dwVersion;
DWORD cCreds;
PCCERT_CONTEXT *paCred;
HCERTSTORE hRootStore;
DWORD cMappers;
struct _HMAPPER **aphMappers;
DWORD cSupportedAlgs;
ALG_ID *palgSupportedAlgs;
DWORD grbitEnabledProtocols;
DWORD dwMinimumCipherStrength;
DWORD dwMaximumCipherStrength;
DWORD dwSessionLifespan;
} SCHANNEL_CRED, *PSCHANNEL_CRED;
where as in msdn
typedef struct _SCHANNEL_CRED
{
DWORD dwVersion;
DWORD cCreds;
PCCERT_CONTEXT * paCred;
HCERTSTORE hRootStore;
DWORD cMappers;
struct _HMAPPER ** aphMappers;
DWORD cSupportedAlgs;
ALG_ID * palgSupportedAlgs;
DWORD grbitEnabledProtocols;
DWORD dwMinimumCipherStrength;
DWORD dwMaximumCipherStrength;
DWORD dwSessionLifespan;
DWORD dwFlags;
DWORD reserved;
} SCHANNEL_CRED, *PSCHANNEL_CRED;
as in my proram i m using dwFlags
i m not understanding where is the problem.
Thanx for any suggesstion
-- modified at 5:42 Friday 9th September, 2005
|
|
|
|
|
Does anybody have any idea about where the resources are defined for Standard Message Boxes i.e. in which file and its path ? . What I mean to say is that how App knows to show OK string.I mean it can show Cancel string instead of OK. From where it loads those string. This must be in some rc file(Thats my assumption). Any idea. Any help would be appreciated.
Best Regards,
|
|
|
|
|
Ibraheem Khan wrote:
Does anybody have any idea about where the resources are defined for Standard Message Boxes i.e.
As MessageBox api is defined in User32.dll, So law of Common sense it might be in User32.dll only , just kiddin..
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Okay. but when I delete user32.dll from System Folder why does it comes again. From where the windows loads it again. Also if I replace user32.dll with other version(language) of WinXP, it again loads the default one. Any reason . How to cope with it ?
Best Regards,
|
|
|
|
|
Ibraheem Khan wrote:
Also if I replace user32.dll with other version(language) of WinXP, it again loads the default one
I have heard some where Windows Xp provide special protection to soem important DLL like user32,kernel32 etc.. for more information i believe you have to search microsoft website
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
ThatsAlok wrote:
I have heard some where Windows Xp provide special protection to soem important DLL...
Windows 2000 also has this feature. It's called WFP. Comes in handy when some nefarious program steps on those important files.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Just wondering if anyone knows if there are converters to convert from:
MS Visual C++ 6.0 or
MS Visual Studio 2003
project files into UNIX autogen/configure/make files?
|
|
|
|
|
With VC++ v6, you can export to a makefile. Look in the Project menu.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Yes there is the export feature in VC 6.0. However I don't see any export feature in Visual Studio .NET 2003. Hmmm...
|
|
|
|
|
Thanks all,
I need some example of UPnP Nat Traversal ,
search the MSDN and found only WIN XP or above can support this tech,it based on XML style,
Now I want to made it run through winsock mode fucntion instead of system API, and parse the XML answer by my own function.
Does anyone have a simple example about it?
thanks,
Hello,
pleasure to meet you.
|
|
|
|