|
Is there a way to get a function name in a macro? Something similar to __FILE__.
Basically I use the class name and function name in debug statements through-out my code and I want a way to automate the insertion of these values. Ideally I want the values at compile time.
Thanks
Mike
|
|
|
|
|
Functor or pointer to function?
Not sure if this is the thing you want.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
What I want is the function name as a string. What I currently use is
DB((_T("ClassName::MethodName Some message")));
What I want to be able to do is get the "ClassName::MethodName" bit without having to type it in each time.
|
|
|
|
|
Hi,
I am trying to change the configuration of the service SQLSERVER AGENT using the API ChangeServiceConfig. In that I am passing a new user name and password as arguments. That API returns successfully and I can change the StartType (AUTOMATIC,DEMAND_START etc) as well. But after that when I try to start the service using the API StartService, it returns the error:"The user doesn't have the permission to log on as a service".
Why is this so? How can I change the configuration successfully through the program? Is ChangeServiceConfig is not the API for this?
When I manually set the User name and password using the properties dialog of that particular service a message appears that this particular user "has been given the right to Log on as a Service" (that is when I click the Apply button on that dialog).After that it is possible to start and stop the service through program. But for the first time it fails. So how can I achieve the functionality which the Apply button (of the properties dialog, provided by windows) is doing??
Plz help,
thnx in advance,
AK.
***
|
|
|
|
|
Look at the PSS article 132958, entitled "HOWTO: Manage User Privileges Programmatically in Windows NT".
Essentially, it's a step-by-step guide to using the LSA (Local Storage Authority) subsystem, from LsaOpenPolicy(), LsaAddAccountRights() etc
In fact, it's exactly what you want, I suspect;
"This sample will grant the privilege SeServiceLogonRight to the account specified on argv[1]. "
Steve S
|
|
|
|
|
Yes, you are absolutely right.
I implemented it successfully.
thnx...
AK.
*******
|
|
|
|
|
As you said I implemented it and its working fine with WindowsNT, Windows2000 os. But it fails in WindowsXP. Again the same error: "Logon as Service right not given".
How to rectify it??
thnx...
AK.
********
|
|
|
|
|
Hi,
I was wrote a service, I want write an application to communicate with this service, I use Socket mechanism but when I start service it generate error.
Have you resolve for this problem?
Please help me.
Thank you .
L.H.Dung
|
|
|
|
|
What errors do you get?
Can your service start without the socket start listening?
Your question is ambiguous.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Anthony_Yio wrote:
Your question is ambiguous.
I wish there was a warning box or something that states that before posting only "I get an error" you should fully explain the error or no one will be able to help. I see this question every day on the forums...
John
|
|
|
|
|
What error? Is it a socket error? Or does the service not start? Did you call GetLastError to get the error code?
John
|
|
|
|
|
I have buld a static library and also a test program to check out the library.
However when I try and build my test program I get the warning:
: defaultlib 'LIBCD' conflicts with use of other libs; use /NODEFAULTLIB:library
I have place the line: /NODEFAULTLIB:WAPI_AIM.lib in the Ignore Specific Library option of the Linker properties, but still get the warning. Note WAPI_AIM.LIB is my libray.
I would like to clear this warning.
Any suggestions?
|
|
|
|
|
Use __AFXWIN_H__ instead of _AFXDLL to determine MFC presence.
its nested in
#ifdef _AFXDLL
#endif
(found somewhere)
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Cant find any reference to _AFXDLL;
only this code below:
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
|
|
|
|
|
Do you have a mixture of static and dll based MFC?
This could lead to the symtoms you are describing.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Yes. I have developed a static library on top of a 3rd party API, which uses DLLs.
The reason for the static library is to remove the single source dependance on a single supplier.
Is this the problem and can it be resolved?
|
|
|
|
|
AFAIK you can nor link the MFC statically and per DLL at the same time.
When your app statically links MFC and also links a library that in turn dynamically links the MFC, you are in trouble. I do not know a way to solve this problem. But that does not mean ther is no way.
What I always did was changing the setting for one or the other.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Did you try /NODEFAULTLIB:LIBCD ?
John
|
|
|
|
|
Under what linker option do I place this setting?
|
|
|
|
|
If you are using VC6 under the link tab (in project settings) if yo go to the input category and put LIBCD in the ignore libraries the compiler will put it in the linker options for you. You will see a line in the Project Options box at the bottom of the dialog that states /nodefaultlib:"LIBCD"
John
|
|
|
|
|
I place the option under Ignore Specific Library and still get the warning.
|
|
|
|
|
I'm sorry if I am wasting your time. In the past that has always worked for me. Try adding a .lib so the entry is LIBCD.LIB. Is there any other libraries listed in the box? If so you must seperate them with a comma.
John
|
|
|
|
|
Just to recap. I am creating a Static Libray which uses calls to a 3rd party API.
I have a test program, Windows Dialog MFC application and has the option set 'Use MFC in a Shared DLL'
in the Ignore Specif Library is set to:
/NODEFAULTLIB:WAPI_AIM.LIB;api_mil.lib
Where api_mil.lib is the 3rd party library and WAPI_AIM.LIB is my static library.
|
|
|
|
|
sweep123 wrote:
the Ignore Specif Library
You are using Visual C++.Net? I use VC6 but also have a copy of Visual Stusio.NET.
I believe that you should put in the Ignore Specific Library box only LIBCD.LIB and nothing else. And you should never put /NODEFAULTLIB: in that box. If you need to ignore other libraries seperate the list with semicolons. If you look at the command line tab you will see excatly what command that visual studio is generating for the /NODEFAULTLIB: parameter.
John
|
|
|
|
|
I am using Visual Studio .Net.
I did place WAPI_AIM.LIB in the Ignore Library Option, but still get the same warning.
|
|
|
|