|
thanks to Gregor I found it here
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&threadm=Pine.HPP.3.96L.990109145728.21674C-100000%40tw900.eng.cam.ac.uk&rnum=5&prev=/groups%3Fq%3DOwner%2B%252Bof%2B%252Ba%2Bprocess%26hl%3Den%26lr%3D%26ie%3DUTF-8%26selm%3DPine.HPP.3.96L.990109145728.21674C-100000%2540tw900.eng.cam.ac.uk%26rnum%3D5
|
|
|
|
|
|
I think OpenProcessToken / GetTokenInformation will do the trick.
|
|
|
|
|
|
It should work - do you query for TokenUser ?
|
|
|
|
|
solon wrote:
It should work - do you query for TokenUser ?
Yup I do :-
DWORD pid = GetCurrentProcessId();
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
HANDLE hToken;
BOOL b = OpenProcessToken( hProcess,TOKEN_ALL_ACCESS, &hToken );
DWORD siz;
b = GetTokenInformation(hToken, TokenOwner , NULL,
NULL , &siz);
PTOKEN_OWNER tokown = (PTOKEN_OWNER) GlobalAlloc(GPTR,siz);
b = GetTokenInformation(hToken, TokenOwner , &tokown,
siz , &siz);
char accname[30];
char DomainName [256];
DWORD cbName = 30;
DWORD cbDomainName = 256;
SID_NAME_USE nUse;
b = LookupAccountSid("\\\\Trivandrum",tokown,accname,&cbName,
DomainName, &cbDomainName,&nUse);
if(b)
MessageBox(0,"suc","",0);
else
{
char buf[512];
sprintf(buf,"%d",GetLastError());
MessageBox(0,buf,"",0);
}
GlobalFree(tokown);
Spot anything wrong?
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
In the GetTokenInformation call you should pass directly tokown ( the third parameter is a TOKEN_OWNER*, not TOKEN_OWNER** - you are corrupting the stack by passing &tokown ). TOKEN_OWNER is a struct, and the SID is the Owner member - use tokown->Owner in the LookupAccountSid call.
|
|
|
|
|
hey, can anyone point me to any good interface tutorials that make apps like winapp possible, and that explain the lower-level details of whys and hows.... Im pretty sure I could hack something together but im sure i wouldnt know the most efficient way of doing this, and id like to know.
id like more knowledge on making my own custom looking windows, and more graphical control than i currently have.
I have alot of experience with file I/o , sockets / internet apps, data manipulation, but not as much in the way of GUI's except the MFC provided abstractions that are available, and i want more abilities than just the standard looking dialogs , SDI's , and MDI's. i can do all the common controls , just dont know enough windows API to get that kind of control to get the custom looking windows...
i have sort of a brain block on the whole gui thing im trying to overcome , so id appreciate the tips / resources anybody can provide.
|
|
|
|
|
check out http://www.amazon.com/exec/obidos/ASIN/157231995X/qid=1040923519/sr=2-3/ref=sr_2_3/104-4316939-3607113 - he expanses much more than you usually needed for GUI programmers.
http://www.amazon.com/exec/obidos/tg/detail/-/0130166294/ref=pd_sim_books_4/104-4316939-3607113?v=glance&s=books - this one is purely MFC, it is pretty good
also try MSDN tutorials like ATLFire and MFCFire.
Depending on your level try just any MFC tutorials, most of them are not deep, but it is a good start.
AlexO
|
|
|
|
|
Hy everybody!
I have a litle doubt...
I maked one Dll with an Dialog and try to use the "&" in the front of the string of my button, but when the window is open, I try to use the Alt+Key (Alt + T for exemple) and it doesn't work...
Does anyone have any idea?
thanks all for the attention!
Florianópolis - Santa Catarina - Brasil
Ricky
|
|
|
|
|
Hy,
I call my dialog with DoModal(), and the Accelerator works... I don't know why...
thanks all..
Ricky
|
|
|
|
|
The message loop of the EXE that is using the DLL needs to call IsDialogMessage() in order for the mnemonic keys (and others, like TAB to move between controls) to work.
--Mike--
If it doesn't move and it should: WD-40. If it moves and it shouldn't: duct tape.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Do you know where I can see some example?
thank's
Ricky
|
|
|
|
|
In the Client part of my Client/Server aplication i get an assertion fail when i call the Read method. The same function works in the Server part. Please help me!!!
|
|
|
|
|
|
Sorry I'm not home now. But i call Read in the dialog class(from an CMySocket object) like nError=m_sSocket.Read(...) and at debugtime it shows debug assertion fail (nError doesn't take any error value)
|
|
|
|
|
Anonymous wrote:
nError=m_sSocket.Read(...)
the value returned from the Read function is the ammount of data read it's not really used as an error code.. it could be (SOCKET_ERROR).. but to catch error codes in read you should do a
m_sSocket.Read(..)
int nError = WSAGetLastError();
Hope this helps.. If not when you get home you could post some of the actual code.. maybe we can see what the issue is.
Rob
|
|
|
|
|
How can i get REAL width of the font ?
I've tried this code but it returns me zero !
LOGFONT logfont;
pFont->GetLogFont(&logfont);
int i = logfont.lfWidth;
// i is always ZERO
What's wrong ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
This means that the default aspect ratio is used, which alas gives you little info. Take a look at GetCharWidth32 , it could be what you need.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
GetTextMetrics might help.
Todd Smith
|
|
|
|
|
Hi,
I want to create an .mdb file using ODBC like :
<br />
CDatabase database;<br />
CString sDriver = "Microsoft Access Driver (*.mdb)"; <br />
CString sSql;<br />
CString strSQL;<br />
<br />
<br />
sSql.Format("DRIVER={%s};DSN='';FIRSTROWHASNAMES=1;READONLY=FALSE;<br />
CREATE_DB=\%s\;DBQ=%s",<br />
sDriver, "F:\\TEMP\\DATABASE.MDB", "DATABASE");<br />
<br />
if( database.OpenEx(sSql,CDatabase::noOdbcDialog) )<br />
{<br />
}<br />
OpenEx function return the following error message :
"File ('inconnu') not found..... Connect string attribut non valid..."
Thank for help
|
|
|
|
|
http://www.appspeed.com/
SkinMagic is a powerful library that changes the visual appearance of windows or dialogs, providing developers with full-featured support for 'application skins', or 'application look and feel'. SkinMagic makes it easy to create programs with visually stunning, fully interactive user interfaces.The interfaces can even be created or edited directly at runtime.
With SkinMagic you could make your program look exactly like it was from another OS, or create your own user WinAmp-like "skinned" interfaces, or just give it a different, distinctive look.
http://www.appspeed.com/
Speed your application develop
|
|
|
|
|
What's is your problem?
Does your app crash?
These forums are here for you when you don't understand something, need advice or if your code doesn't work as you want. So, this kind of question is not a question about a problem, it's advertising!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Please don't advertise products in these forums.
Regards,
Brian Dela
|
|
|
|
|
How to do it for free! Source code included! It's more powerful than a locomotive, and able to leap tall SPAM in a single function call! It's...
GUIGUI!
"Perhaps the truth is less interesting than the facts?" -- Amy Weiss, RIAA's Senior Vice President of Communications. It's the new math! 421 == 156 !
|
|
|
|