|
Hi guys,
I've been messing around with the Hello World example program and what I'm wanting is that when the user goes to the "about" screen the main window is closed or made invisible. Sorry if it such a vague qeustion, I've only been on VC++ for 5 hours now and I'm a bit strapped for cash for books at the moment Any help would be great
Thanks for your time
Aaron
|
|
|
|
|
Check ShowWindow(() ,use SW_HIDE
for it.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
In the "About" handler (where the about dialog is created and shown with DoModal issue a ShowWindow(SW_HIDE) before producing the about dialog and ShowWindow(SW_SHOW) after
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
when you say 'main window' do you mean the whole application, or a dialog which says 'Hello World'.. if you are displaying a dialog using DoModal() then it will have focus and not allow you to go to help/about until you close the box that has focus.. please elaborate on exactly what you want closed or made invisible.
-dz
|
|
|
|
|
But he can hide the window before the DoModal and show it when DoModal returns
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
THANKS GUYS!!!!
Aaron
|
|
|
|
|
I swear MS taking out the class wizard was like a big 'F-U' to me.
Can someone please tell me if there is an automated way to add an event to a new toolbar button? i tried double clicking it in hopes that would help.. but of course not, i tried right clicking it hoping for add event handler.. no such luck either.. im so ticked.. is there no way to add an event handler to a toolbar button without manually writing out the event handler?!
.. i know i must be missing something.. microsoft has to know how lazy i am .. there is no lightning bolt to click on to add the handler for the toolbar.. please someone help, i would much appreciate it.
-dz
|
|
|
|
|
several times I tried to get a Handle to a window or dialog and i received this error code with GetLastError. M
|
|
|
|
|
try
errno = GetLastError();
Otherwise you are getting the address of the GetLastError function.
One other thing to realize is that not all calls set last error. Your 183 may be an artifact from a previous error.
|
|
|
|
|
Say I have a string:
string MyString;
And I want to remove all punctuation characters from it say, !@#$%^&*(,.?) etc . . .
what is the best way to do this?
NewString = MyString.replace("!@# . . .", "")
Any Thoughts,
Tim
---------------------------------------
Tim Booher
|
|
|
|
|
Replace() is the thing you want,but I think you have to use it for each punctuation characters sepratly.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
This is just a simple sample of how you could do it with C-strings.
This code doesn't work for DBCS. But it would be easy to modify for that. (I am being lazy)
void RemoveChars (LPTSTR pszSource, LPCTSTR pszCharacters)
{
LPTSTR pszIn = pszSource;
LPTSTR pszOut = pszSource;
TCHAR c;
while ((c = *pszIn++) != 0)
{
if (_tcschr (pszCharacters, c) == NULL)
*pszOut++ = c;
}
*pszOut = 0;
}
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Wow Tim.
Good solid pointer usage...
I am impressed.
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
When you get to be an old fart like me, you learn a lot of tricks.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Sorry, but this makes no sense to me, like what datatype is LPTSTR? is this STL stuff or microsoft stuff?
I implemented something like:
void wordcounter::CleanUpWord()
{
string::iterator i = remove_if( word.begin(), word.end(), ispunct ); // compact the string
word.erase(i,word.end()); // trims the characters identified from the string
transform( word.begin(), word.end(), word.begin(), tolower ); // convert all to lower
}
What do y'all think of this?
Tim
---------------------------------------
Tim Booher
|
|
|
|
|
LPTSTR is basically a "char *" in ANSI/MBCS mode and "wchar_t *" in UNICODE mode.
My code is basically exactly the same thing remove_if does. At the end of my loop, "pszOut" would be the same as your "i". My terminating the string with a 0 does what your erase does.
Mine is for C style strings and yours is for STL strings. Since your version doesn't do a lot of extra string copies they both perform very well. The only thing in the C string version is that you could roll the tolower into the loop.
This STL version looks good IMHO.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Just for an FYI, here is how your routine would look for C strings.
void CleanUpWord (char *pszWord)
{
char *pszIn = pszWord;
char *pszOut = pszWord;
char c;
while ((c = *pszIn++) != 0)
{
if (!ispunct (c))
*pszOut++ = tolower (c);
}
*pszOut++;
}
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Sorry,I misunderstood your question,you have to use Remove() .This is from MSDN:
CString str("This is a test.");
int n = str.Remove('t');
ASSERT(n == 2);
ASSERT(str == "This is a es.");
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
CString strTest("What the *@(%!?");
CString Holder = "-?`~!@#$%";
for (int i = 0; i < strTest.GetSize(); i++)
if(Holder.Find(strTest.GetAt(i))!=-1))
{
AfxMessageBox("Found bad character");
}
:P im a newbie so flame away if there is an easier way.. oh ya.. i stole this code from someone somewhere at somepoint..
-dz
|
|
|
|
|
If you're using std::string s, this should do (warning, I haven't tested it so some off-by-one errors might have been overlooked.)
string remove(const string& src,const string& chars)
{
string dst;
for(string::size_type off=0,off2=0;(off=src.find_first_of(chars,off2))!=string::npos; ){
off2=src.find_first_not_of(src,off);
dst+=src.substr(off,off2==string::npos?string::npos:off2-off);
}
return dst;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Arg.. can someone tell me the best choice for a grid? i see all these fancy grids in the articles which have pictures and stuff.. but all i want is a grid which lists rows of items with 3 or 4 columns from which i can figure out what line is selected, and set whether you can have multiple selections or not.. basicly i just need a listbox almost, except i want columns.. any suggestions? im trying to use the MSFlexGrid, but i'm having problems putting them into .NET (see previous post from today).
thanks for any suggestions
-dz
|
|
|
|
|
|
CListCtrl is pretty easy, not to fancy, supports multiple selections (i think) and columns.
Perhaps this is what your looking for.
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
wow, i really apreciate you pointing that out.. i was wondering why all these grid controls were so fancy.. i dont need an editable grid, just a listing.. didn't know list box allowed columns when its in 'report' mode.. thanks for the help!
-dz
|
|
|
|
|
Hi,
Is it possible to have dynamic array in VC++??? I mean....can i have the following code:
cout << "Input array size ";
cin >> size;
int arrayvalue[size];
Thanks!
|
|
|
|