|
I have a service (written in Visual C++ 6), running under Windows 2003. I need to get the name of the currently logged in user, but most Windows APIs I have found return the username of the *calling thread*, which when run as a system, is always "SYSTEM".
I have tried these APIs so far:
GetUserName
GetUserNameEx
Unfortunately, all of the above return the username "SYSTEM". Any suggestions?
|
|
|
|
|
Hi,
Every application is executed under specific account, if you doubleclick on application icon on your desktop, this application will be executed under your account (if allowed). Using GetUserName/Ex will always return username of the account used to launch your application (associated with your thread).
Considering service, in your case it is Local System account which is used to lauch your service, that's why you get SYSTEM as user name for this account.
If you wish to get name of currently logged on user, you should use
NetWkstaUserGetInfo<br /> function to get info on your local computer, or enumerate users with NetWkstaUserEnum function.
Hope that helps.
Best regards
|
|
|
|
|
Hi Friends,
I am facing couple of problems while compiling the code, and this is the first time I am facing this kind of problem so I don't understand how to resolve this, Please help me out.
The problems are as follows:
1. When I am compiling a code I am getting message saying " The source file XXX and YYY (XXX and YYY are files in different projects) are both configured to produce the output file XXX.obj This project cannot be build.
2.For one project after every change (even after scrolloing the mouse) I am getting message saying " XXX.clw, This file has been modified outside of the source editor. Do you want to relode it?" I am getting this message so many time that I am unable to work.
3. Some times my code is getting compiled and some time it is giving error saying undeclaired member variable even though the variable is declaired. some times same code is getting compiled without any error.
Waiting for the replies from the group.
Thanks in advance...
Thanks & Regards,
-Dinesh.
|
|
|
|
|
Dinu_IP wrote: When I am compiling a code I am getting message saying " The source file XXX and YYY (XXX and YYY are files in different projects) are both
in the file view tab, plz check for the above files and delete the unwanted files from it.
Dinu_IP wrote: 2.For one project after every change (even after scrolloing the mouse) I am getting message saying " XXX.clw
delete the folowing files from the project folder. .clw, .opt, .plg, .aps, .ncb.
This files will be recreated when u compile the program. U can recreate the clw file when u press the ctrl + w ( class wizard )
nave
|
|
|
|
|
I write a program to listed all files in a directory and its subsequent
subdirectories.I use SHBrowseForFolder(),FindFirst(),FindNext() APIs to do this.But this work fine in Windows drive only,not in other drives.Please send me solution To Getme evergrateful.
god
|
|
|
|
|
ayan_00_arup wrote: work fine in Windows drive only
I dont understand what do u mean by windows drive?
nave
|
|
|
|
|
Why its not good for other drives?
|
|
|
|
|
|
I wrote a MFC GUI where I execute plink concole program. When the server is first contacted, I need to accept fingerprint from console prompt. How can I get that confirmation prompt from my GUI application ?
Appreciate any help !!
Gongya Yu
|
|
|
|
|
Hi,
By redirecting console output/input to your application.
You can find out how to do this from several open source project, like: Console[^] from Sourceforge.
Best regards
|
|
|
|
|
thanks!
I did use pipe to redirect output/input to my application. It worked fine. The only thing which does not work is when the server sends fingerprint for the first time connection. My application gets that, but my application just sends return character instead of stopping for input.
|
|
|
|
|
Hi
We are devolopping one project in this project it is required to add the
PNG images to Dialogboxes and other controls.So please kindly any body help us in our project
#sanroop#
|
|
|
|
|
Did you see CImage class ?
|
|
|
|
|
Thanque for your reply can u please send me any example to add png image to dialobbox and other controls.
#sanroop#
|
|
|
|
|
See
#include AtlImage.h
CImage m_Image;
BOOL CAnswerDlg::OnInitDialog()
{
...
m_Image.Load(yourfile);
return TRUE;
}
void CAnswerDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
m_Image.BitBlt(dc.m_hDC,0,0,640,480,0,0);
}
|
|
|
|
|
related article - http://www.codeproject.com/wtl/wtldockingwindows.asp?df=100&forumid=3244&select=1705076&msg=1705076[^]
QUOTE -
Flying tabs are not restored properly And68rei 7:16 21 Oct '04
I played with MDIExSample.exe and discovered one troublesome bug.
1) take one of flying windows and move it outside of main window (e.g. <<1>>)
2) take another one (<<<2>>>) and attach it to first window (<<1>>), so they form tab control in separate window.
3) close the application
4) start it again. After restoring of windows' locations those 2 windows are lying one under another and don't form tab control anymore...
So, restoring works fine if tab control with some windows lies inside main window, and not if outside.
I have encountered the same problem in something that I am working on. I have looked at/compiled(in VS 2003.net) the source code in this article and can confirm that this docking bug occurs in this example. I'm not sure what zerozerofancy is talking about, as with my copy of stdafx.h there is no reference to sstate.h nor dwstate.h and the code in dbstate.h seems to already be "CDockWndMgrEx mgrDockWnds(m_hWnd)"
Anybody know what the cause is and how to fix it?
When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!
|
|
|
|
|
Why not ask it at the article discussion forum itself?
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
I have but seeing as it's a 2 y/o article noone has replied. Or maybe it's because I smell too badly and they don't want to reply for fear of catching something?
When I die I'd like to go peacefully in my sleep like my father, not screaming in terror like his passengers!!!
|
|
|
|
|
Hi,
I am using WMI to get hardware details. WMI defines INT8. At the same time I am using one library that defines INT8, and because of this I am getting redefinition error for INT8. I can not change the code either in WMI or in other library. There could be one way by creating a Dll for all wmi code. But is there any other workaround for the same?
That would be great, if one can help me in getting following details without using WMI:
1. All drives (Fixed as well as removable) and their partitions with size, utilization and driver (description, date, version) details.
2. CPU details : No of CPUs and for each CPU ---> CPU type, CPU alias, Original clock, Real Clock, Effective clock, CPUID manufacturer, CPUID revision.
3. Motherboard details: Motherboard ID, Motherboard Name, BUS type, BUS Width, BIOS type, System BIOS Date, No of memory modules and RAM within them.
Regards!
Paddy
|
|
|
|
|
You dont need to repeate your question
|
|
|
|
|
Sorry for the same.
Regards!
Paddy
|
|
|
|
|
Padmanabh Sharma wrote: WMI defines INT8. At the same time I am using one library that defines INT8, and because of this I am getting redefinition error for INT8. I can not change the code either in WMI or in other library. But is there any other workaround for the same?
Hmmm.
You could write a (thin) wrapper-class for (parts of) WMI (or the other lib), hiding it from the outside.
In that class's .cpp, before including the WMI-stuff, you undef INT8 (it is not typedef 'd I hope) and let WMI define it.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
Hi,
I am using WMI to get hardware details. WMI defines INT8. At the same time I am using one library that defines INT8, and because of this I am getting redefinition error for INT8. I can not change the code either in WMI or in other library. There could be one way by creating a Dll for all wmi code. But is there any other workaround for the same?
That would be great, if one can help me in getting following details without using WMI:
1. All drives (Fixed as well as removable) and their partitions with size, utilization and driver (description, date, version) details.
2. CPU details : No of CPUs and for each CPU ---> CPU type, CPU alias, Original clock, Real Clock, Effective clock, CPUID manufacturer, CPUID revision.
3. Motherboard details: Motherboard ID, Motherboard Name, BUS type, BUS Width, BIOS type, System BIOS Date, No of memory modules and RAM within them.
Regards!
Paddy
Padmanabh Sharma
|
|
|
|
|
|
Hi,
Yes this gives me most of the details but even i m not able to get following details:
1. Motherboard ID.
2. Driver details for all partitions and removable drives.
3. Bus type and Bus width
4. CPU alias
5. Real and Effective clock
Regards!
Paddy
|
|
|
|
|