|
Try looking here[^], especially on this page[^].
Software Zen: delete this;
|
|
|
|
|
In the registry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DocFolderPaths
lives the paths to all users.
How may I enum them?
How may I find current user?
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
BaldwinMartin wrote:
How may I enum them?
Use RegEnumKey or RegEnumKeyEx
BaldwinMartin wrote:
How may I find current user?
GetUserNameThe GetUserName function retrieves the user name of the current thread. This is the name of the user currently logged onto the system.
or you can search For a set of Netowrk CLasses at CP to get a class Related to User Enumeration/other user related activities,But that work in window2000 and above.
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Thank you very much for the helpful answer.
Thanks,
Again,
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
BaldwinMartin wrote:
Thank you very much for the helpful answer.
Thanks,
Again,
Thanks for that WonderFul Thanks
-----------------------------
"I Think this Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
If you just need the path for the 'My Documents' folder, you can use SHGetFolderPath() [^].
Software Zen: delete this;
|
|
|
|
|
Hi!
Check this link if you want the current user info
http://support.microsoft.com/kb/111544/EN-US/
|
|
|
|
|
Great answer that you! This will help alot.
Thank you,
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
Great and Thank you, I am trying to get to the GUID folder and it's content. As you know the GUID folders are a little tricky to get access to, so this helps quite abit.
Thanks!
"Naked we come and bruised we go."
- James Douglas Morrison
Best Wishes,
ez_way
|
|
|
|
|
How do you design a skin for your program. What I mean is say there is a light bulb on your desktop but it is actually the program I wrote. Hope someone understands.
Thank You
|
|
|
|
|
Actualy yes! I beleive you want to know more about regions. You can use the to shape windows and buttons, etc... . That is you could use a region to shape a window shaped like a light bulb.
I have not done anything like that for a couple of years, so search for regions at CP. There are quite a few aticles on the subject. I just cann't remember the exact ones you need to read.
Good Luck!
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
How do you input large integers using a comma i.e., 2,000?
Thank You
|
|
|
|
|
Take the input as a string, then strip out the comma and then use atoi to convert the string to an integer.
string input;
int number;
cin >> input;
int pos = input.find(',');
while (pos != -1)
{
input.replace(pos, 1, "");
pos = input.find(',');
}
number = atoi(input.c_str());
cout << number << endl;
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Hi, i'm not sure what this is called cause its the first time i ever saw it :P so here's some code to show the situation...i need help correcting any errors or what not to make it compile.
//BSTree class
typedef void (*VisitFunc)( Item & item );
void InOrder( VisitFunc f )
{
//stuff
}
---
//extended BSTree class
void SortTree()
{
InOrder(VisitingSortFunction);
}
void VisitingSortFunction(Item & item)
{
//stuff that i want to be executed in InOrder(
}
//error message i get
'void BSTree::InOrder(VisitFunc)' : cannot convert parameter 1 from 'void (Item &)' to 'VisitFunc'
|
|
|
|
|
just as a test, i put this code into a new console app, and it compiled just fine, after i moved the body of VisitingSortFunction above the body of SortTree (to fix an undeclared identifier issue with VisitingSortFunction).
class Item
{
};
typedef void (*VisitFunc)( Item & item );
void InOrder( VisitFunc f )
{
}
void VisitingSortFunction(Item & item)
{
}
void SortTree()
{
InOrder(VisitingSortFunction);
}
int main(int argc, char* argv[])
{
return 0;
}
Software | Cleek
|
|
|
|
|
Hmm i guess when simplifying my code for this thread i must of eliminated what leads to my problem...Thanks for help.
|
|
|
|
|
Hmm i'm still confussed :P...This simplified code generates the error.
typedef int Item;
typedef void (*VisitFunc)( Item & item );
class BSTree
{
private:
void InOrder( VisitFunc f)
{}
};
class BSTreeExtendedWithSort : public BSTree
{
public:
void SortTree()
{
InOrder(VisitingSortFunction);
}
private:
void VisitingSortFunction(Item & item)
{}
};
int main()
{
return 0;
}
|
|
|
|
|
well, now you're up against the fact that (non-static) C++ member functions aren't quite the same as C functions. you can't really pass them around as function pointers.
this works:
class BSTree
{
public:
void InOrder( VisitFunc f)
{}
};
class BSTreeExtendedWithSort : public BSTree
{
public:
static void VisitingSortFunction(Item & item)
{}
void SortTree()
{
InOrder(VisitingSortFunction);
}
private:
};
but that 'static' raises a whole bunch of class/object issues.
it's usually pretty safe to say that if you find yourself wanting to pass pointers to member functions around, that you need to take a good hard look at your class relationships. instead of passing pointers to funtions, you'll need to consider passing objects that can see the data they need to operate on.
Software | Cleek
|
|
|
|
|
Thx for help compiles good.
|
|
|
|
|
As Chris said, the design isn't the greatest, but to clear up the typedef question, a member function and a global function are not type-compatible unless the member is static , because the member function needs a this object. In your code, if you change the typedef to:
typedef void (*<font color=red>BSTreeExtendedWithSort::</font>VisitFunc)(Item& item); then it will do what you want (well, once you sort out the class name problems that arise).
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ | You Are Dumb
|
|
|
|
|
I have a CString that contains a multiple number of %s substrings. I also have a CStringArray such that array member one should replace the first occurrence of %s, array member two should replace the second occurrence of %s, etc. etc. up to the number of %s'. I probably should be using the FormatV member function, but I can't get my head around the va_arg type at the moment. A pointer or two would be appreciated. Thanks.
Chris Meech
I am Canadian. [heard in a local bar]
Gently arching his fishing rod back he moves the tip forward in a gentle arch releasing the line.... kersplunk [Doug Goulden]
|
|
|
|
|
Just a suggestion, as I am unclear as what you are trying to do, but it seems to me that if all you are trying to do is insert strings into another string, wouldn't it work easier to break up the format string and just use the += operator to concatinate the strings?
As for using variable arguments, I could help you if I had a little more info on what you are trying to do.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
I think what he's saying is:
CString strFormat = _T("One: %s, Two: %s ... Fifty: %s");
CStringArray strValues; (filled with 50 values)
What he wants:
strValues[0] takes the place of the %s that follows One.
strValues[1] takes the place of the %s that follows Two.
etc...
What he's most likely looking for is something simple like...
CString strText;
strText.Format(strFormat, strValues);
as opposed to
strText.Format(strFormat, strValues[0], strValues[1], ... strValues[49]);
I've never actually used an array with Format, so I haven't the foggiest.
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
Thanks for the assist, PJ. Sorry I wasn't too clear. The others were on the right track though and I have things working. The va_ macros are for building a function that receives a variable argument list. In my situation though, it was more that I had a variable number of elements to pass to a function. The odd part is that the variable number wouldn't be known until runtime when the format string is picked up from a database call.
Appreciate the help though.
Chris Meech
I am Canadian. [heard in a local bar]
Gently arching his fishing rod back he moves the tip forward in a gentle arch releasing the line.... kersplunk [Doug Goulden]
|
|
|
|
|
Assuming you don't want to do this:
CString str,fmt;
CStringArray arr;
fmt = _T("%s blah %s blah ... %s blah");
str.Format(fmt,arr[0],arr[1],...,arr[]); I don't think FormatV will do what you want. It's used within functions that have variable numbers of arguments. Any approach like this will also behave badly if there's a mismatch between the number of %s format specifiers and the number array elements.
Something like the following ought to do it:
CString str,fmt;
CStringArray arr;
fmt = _T("%s blah %s blah ... %s blah");
str = fmt;
int offset = str.Find(_T("%s"));
int index = 0;
while ((offset >= 0) && (index < arr.GetSize())) {
str = str.Left(offset) + arr[index++] + str.Mid(offset+2);
offset = str.Find(_T("%s"),(offset+2));
}
Software Zen: delete this;
|
|
|
|