|
Whats wrong whit this code?:
PSID pSid = NULL;
SID_NAME_USE sNameUse = SidTypeUser ;
TCHAR RefDomain = NULL;
DWORD RefDomCtn = 256;
DWORD SidCtn = 256;
LookupAccountName(NULL,lpszSystemInfo , pSid ,&SidCtn , (LPSTR)RefDomain ,&RefDomCtn , &sNameUse );
I've got unhandled error:
0xC0000005: Access violation writing location 0x00000000.
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
TCHAR RefDomain = NULL ;
Hah what's wrong with the above stmt ??
its a single char variable initialized to NULL(0).
When this is accessed in the function, where it is happily casted
to a LPSTR, the function tries to access the memory location at '0'.
So now what do think is wrong with the code ??
|
|
|
|
|
Thanks for your reply.Sorry,Can you tell me what should I write now?
Mazy
"The more I search, the more my need
For you,
The more I bless, the more I bleed
For you."The Outlaw Torn-Metallica
|
|
|
|
|
Just specify the acct name and the buffer sizes that should be enough.
It will automatically test the local machine and the Domain and
trusted Domains.
|
|
|
|
|
Hi all!
I have 2 dimensional array but whenever i make a loop to travers it and output the result, it display some weird number such as -858933448 ans so on
Here is my function call:
pDoc->A.getLadder(ladder);
for(row = 0; row <4; row++)
{
CString team = pDoc->A.getTeam(ladder[row][TEAM]);
int played = ladder[row][PLAYED];
int won = ladder[row][WON];
int draw= ladder[row][DRAW];
int lost = ladder[row][LOST];
int f0r = ladder[row][FOR];
int against = ladder[row][AGN];
int points= ladder[row][POINTS];
CString tempString;
tempString.Format("%s = %d = %d = %d = %d == %d == %d == %d",
team, played, won, draw, lost, f0r, against, points);
lineArray.push_back(tempString);
tempString = " ";
}
thanks!
|
|
|
|
|
Show the code for A.getLadder
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
here is the code for getLadder
void Group::getLadder(int ladder[4][8])
{
Sort();
for(int i = 0; i < 4; i++)
for (int j = 0; j < 8; j++)
ladder[i][j] = aILadder[i][j];
}
and here is the sort function that is placed within the class but is declared as private.
void Group::Sort()
{
const int TEAM = 0;
const int PLAYED = 1;
const int WON = 2;
const int DRAW = 3;
const int LOST = 4;
const int FOR = 5;
const int AGN = 6;
const int POINTS = 7;
int row, col;
for( row = 0; row < 4; row++)
{
for (col = 0; col < 4 ; col++)
{
if( row != col)
{
aILadder[row][TEAM] = row;
if(result[row][col] > result[col][row] && result[row][col] != -1)
{
aILadder[row][PLAYED] +=1;
aILadder[row][WON] += 1;
aILadder[row][FOR] += result[row][col];
aILadder[row][AGN] += result[col][row];
aILadder[row][POINTS] += 3;
}
else
if(result[row][col] == result[col][row] && result[row][col] != -1)
{
aILadder[row][PLAYED]+=1;
aILadder[row][DRAW]+=1;
aILadder[row][FOR] += result[row][col];
aILadder[row][AGN] += result[col][row];
aILadder[row][POINTS]+=1;
}
else
if(result[row][col] < result[col][row] && result[row][col] != -1)
{
aILadder[row][PLAYED]+=1;
aILadder[row][LOST]+=1;
aILadder[row][FOR] += result[row][col];
aILadder[row][AGN] += result[col][row];
}
}
}
}
int tempArr[1][8];
int j, target;
for(row = 1; row < 4; row++)
{
j = row;
target = aILadder[row][POINTS];
while(j > 0 && target > aILadder[j-1][POINTS])
{
for(int i = 0; i < 8; i++)
{
tempArr[0][i] = aILadder[j-1][i];
aILadder[j-1][i] = aILadder[j][i];
aILadder[j][i] = tempArr[0][i];
}
j--;
}
}
}
Thanks
|
|
|
|
|
Obviously there is a problem with the stmt
pDoc->A.getLadder(ladder);
I think that the pointer being returned is not correct.
What is the decl of getLadder ?? Is it accepting a
pointer to a pointer (**p??).
Also if a pointer is being returned I think that you
should use the pointer notion for retrieving the
elements
So if you want to have [i][j]
*(p + i*nSize + j)
where nSize is the size of the array's first index.
PS: Its been long since I have worked with this kind of
pointers to arrays (So just off the top of my head i remembered that
arrays are contigious locations and formulated the above code).
Please correct me if it is wrong
|
|
|
|
|
Hi,
I want to show all the directory (directory structure)
in the Tree View
How can i do that
Sameer
|
|
|
|
|
CTreeCtrl::Expand
Use the root node as the HTREEITEM and TVE_EXPAND as the 2nd arg
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Hi,
I'am sory, but i guess u misunderstood my problem.
Actually i want to display a tree view in which all
the directories of the Drive are listed
Sameer
|
|
|
|
|
Sameer Maggon wrote:
Actually i want to display a tree view in which all
the directories of the Drive are listed
Sorry
What you need is SHBrowseForFolder
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
look at the foll,. article at Codeguru
http://www.codeguru.com/treeview/CDirTreeCtrl.shtml
|
|
|
|
|
Hi,
I saw that Control, but that control is too heavy.
I just want to Display the Directories and not the
Files etc.
Actually i just want to give a user, selection of a
Directory.
Please help
Sameer
|
|
|
|
|
You can limit the tree to one level.
Best regards,
Alexandru Savescu
|
|
|
|
|
Sameer Maggon wrote:
Actually i just want to give a user, selection of a
Directory.
Already told you. Use SHBrowseForFolder
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Use the foll. code
CString GetUserDirectory()
{
CString strPath ;
char szDisplayName[_MAX_PATH] ;
char *szPath = NULL ;
char *szTitle = _T(" Please Locate Directory : ") ;
BROWSEINFO bi = {0} ;
bi.pszDisplayName = &szDisplayName[0] ;
bi.lpszTitle = szTitle ;
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_RETURNFSANCESTORS ;
bi.hwndOwner = NULL ;
LPITEMIDLIST pidl = SHBrowseForFolder(&bi) ;
if( pidl == NULL )
return strPath ;
if( !SHGetPathFromIDList(pidl,szPath) )
{
AfxMessageBox(" The Path is Invalid ! ") ;
return strPath ;
}
IMalloc *pMalloc = NULL ;
HRESULT hr = SHGetMalloc(&pMalloc) ;
if( !SUCCEEDED(hr) )
return strPath ;
pMalloc->Free( (void*)pidl ) ;
pMalloc->Release() ;
strPath = szPath ;
return strPath ;
}
<pre>
|
|
|
|
|
Thanx for the code, but i had already written the application using MSDN.. Thanx a lot again for the help.
Regards
Sameer
|
|
|
|
|
Do I have to CoInitialize() and Uninitialize()
???
|
|
|
|
|
Thanx a lot Nish.
This solves my problem
|
|
|
|
|
See this article.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi,
All
I have a Server running which listens on a particular port and
according to the XML sent to it, it sends a JPG file (a binary stream).
Now this XML would be sent by my ASP page. I know i can do
this using ActiveX component.
Please suggest me (no code, just algo types) how to go about
it
Thanx
Sameer
|
|
|
|
|
Hi, How do I determine when the user has finished entering text in an edit box. In other words, how do I know he has pressed the enter key and has completed typing in the text.
Rui
|
|
|
|
|
Write a handler for EN_KILLFOCUS
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Sorry, I should have expressed myself better.
I know about Killfocus, but this requires that the user clicks elsewhere so that the focus on the edit box may be lost. Is there no other way?
Is there a way to call an event when the Enter key is pressed?
I tried using OnKeyDown, but am not sure how it works as I got no action from this event.
Rui
|
|
|
|