|
Try something like this:
char input[MAX_PATH];
do {
cout << "Enter the text " << endl;
gets(input);
if (strlen(input) != 0) {
}
} while (strlen(input) != 0);
Gary R. Wheeler
|
|
|
|
|
You may have problems mixing cin /cout and gets /printf . For console hacks, I use gets /printf .
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I created a Win32 Console Application with MFC support. Everything was working fine until I decided to add ADOX. I have the code for access database interaction in a separate static library from the console application itself. I can build the library fine, but when I try to link it in with the console app, I get several linker errors that look something like this:
\PATH_TO_VC98\comutil.h(562) : error C2668 : 'memcpy' : ambiguous call to overloaded function
From what I understand, when you get this kind of error, it is from a naming collision of some sort. The only problem is that I haven't written my own 'memcpy'. I can only assume that the compiler sees two different versions on the system somewhere. The really strange part about the whole things is that the application builds fine when I am using the exact same code on a button handler in a GUI. I do have the Platform SDK installed (not sure if that matters). Anyone heard of this kind of thing? Please help!!!
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
In a listbox I want to handle the on LButtonDown so that I can quickly select items in a listbox. The default is the curent selection is only updated on LButtonUp. Any ideas?
|
|
|
|
|
I'm so use to a lot of quirks coming from ClassWizard, I'm beginning to wonder whether it's normal.
For example, I instructed ClassWizard to add a new class for me, chose "New" and continued to fill in the class name and its derived class name (etc.). Then I click OK and CW produced a message saying it couldn't open the file I had just asked it to add. I clicked OK again and it came back with a message about how it found remants of the class I had just asked it to add (that it earlier said it couldn't).
I checked the workspace, checked Explorer and even brought the newly created file into the Source Editor and made modifications to it (etc.), compiled and linked the program. Everything went well, 0 errors; 0 warnings.
Still, CW did not have the new class included in its list.
I deleted the ".ncb", the ".opt" (and some other files), compiled and linked the program again, and still the new class was not included in CW.
Finally, I deleted the ".clw" file, compiled and linked the program again, but this time CW asked if I wanted to create a new CW file. I clicked OK, and behold! the new CW file this time included the new class I had a few moments ago created.
Is this just another one of CW quirks that I'll have to live with, or did I do something wrong it didn't like?
Thanks.
William
|
|
|
|
|
do you have any anti-virus apps running? i've seen this kind of thing with Norton. it makes life exciting.
-c
Green's Law of Debate:
Anything is possible if you don't know what you're talking about.
|
|
|
|
|
Yes, I do have anti-virus software running continuously!
My machine is heavily equiped with anti-virus software, including Norton's enterprise edition.
Thanks for the tip.    I appreciate it.
William
|
|
|
|
|
According to MSDN, TransparentBlit is not supported in 95 (or i mis-read it ).
Anyone know of a way to support this under 95? ie updates, dll etc
Thanks
Robert Cannell
|
|
|
|
|
Not that I am aware of, you will need to implement your own version. As far as I can remember though, there is a sample implementation in MSDN that shows how you can implement this function for windows 95 and Windows NT 4.0.
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thanks, I will have a look.
|
|
|
|
|
Hi,
I'm new using CWinThread, what I'm doing is to show a progress bar window, mean while the GUI of the main window is being updated.
All goes fine, but... when I have to finish the CWinThread I do it in this way:
pThread->m_pMainWnd->PostMessage(WM_CLOSE,0,0);
pThread->PostThreadMessage(WM_QUIT, 0, 0);
WaitForSingleObject(pThread->m_hThread, INFINITE);
To have this working, I have to set in the InitInstance of the CWinThread class, this flag to false:
m_bAutoDelete = FALSE;
Do you know why ?, Or what I'm doing wrong ?
Thanks in advance, Greetings
Braulio
|
|
|
|
|
Hola Braulio,
m_bAutoDelete=TRUE instructs the CWindThread object to delete itself upon exiting; that means that all member data of the thread (including m_hTread ) gets deleted, so it would be wrong to refer to it in a call to WaitForSingleObject . Having m_bAutoDelete==FALSE , the object remains in memory after the thread exits for you to inspect its data as you please. Remember that in this case you have the responsibility of disposing of the thread when no longer needed with delete pThread .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hola Joaquin !!, Qué tal ?
Yes, you are right, thanks for the info. Mmmm... I've seen there is not very clear info and samples about CWinThread in MSDN or here in Codeproject, I'm thinking about making a new article, with the Progress Bar Dialog stuff ( in a CWinThread), do you think it's a good idea ? Is there some article or thing about CWinthread that is interesting ?.
Gracias de nuevo Joaquin !, Un saludo
Braulio
|
|
|
|
|
There's a couple of articles in the threads section of CP dealing with worker and UI threads; I haven't looked at them in detail, so maybe you've got something new to add Besides, the progress bar stuff can be useful, and publishing in CP is a lot of fun. Regards.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello,
I need convert an unsigned data type to a char *. How can I do this??
The problem is originated in ...
for(int counter=0; counter<house.length(); counter++)="" {
="" <i="">get_the_unsigned_from (house.room( counter );
convert_the_unsigned_to_char*;
append_(_char*_(_counter-1_)_,_char_*_(_counter_)
}
I'll appreciate your help!
Sp
|
|
|
|
|
well - you can simply go for a cast... or try stripping the sign bit.
--
John Clayton
|
|
|
|
|
|
Hi Everyone
I am trying to find out how I can hook 'onidle' from within an AddIn module for VC6. I know (using AfxGetApp()) that I can get to the CWnd* instance for MSDEV, but how on earth do I tell this CWnd* guy that I'd like to be called back when OnIdle() is being called?
Ideally, I would like to do :
AfxGetApp()->TellMeAllAboutOnIdleEvents(my_callback_interface);
(of course, this method don't exist!)
This could all be explained by my MFC naievity as well. Is it something to do with CCommandTarget perhaps? Well, while I continue to flex my eyes at the included MFC docs I shall hope for a reply.
Any help is massively appreciated! Thank you.
--
John Clayton
|
|
|
|
|
Hi.
I want to debug code that manages printing. However, I do not own a printer or have access to one. Is it possible to get print preview to emulate a printer? I just need the program to show an sample of what the print would looks like.
Thanks,
Kuphryn
|
|
|
|
|
Install a printer driver that manages PostScript (most, actually). Then, when printing, set the check box that reads "Print fo a file", rename the resulting output to .ps and use any utility (Ghostview, for instance) to see the results.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
I previously wrote a Visual C++ app to perform digital I/O functions on a Windows9x machine. I/O timing was controlled using delay loops and watching the I/O signals on a logic analyzer. I know this is a kluge way of doing I/O timing, but I haven't been able to find any information on a nanosecond resolution timer (besides FILETIME) for a Windows based system. I've tried QueryPerformanceFrequency/Counter, but alas, not enough resolution.
All was well until my in-house app started being installed on other PC's with Win2K and XP. So now I'm back to square one. Is it a hopeless cause trying to find a nanosecond resolution timer for Windows OS's? I've done GPS timing resolution before, but that requires a GPS receiver which is overkill for what we're trying to do.
Please help!
Nifer
|
|
|
|
|
The best you can get it a 100ns resolution. Search for the "multimedia timer" in MSDN.
|
|
|
|
|
Now, I wanna ask 2 questions about CDC::DrawText(...).
As you know, besides supplying the text to be drawn, you also gotta tell the function the bounding rectangle to draw the text in.
1) If we specify the bounding rectangle to be far much more larger than the text(for e.g : CRect(10,10,600,600) to hold just the word "Xeon", in small fonts), DrawText(...) will auto-shrink and auto-size the bounding rectangle to fit the size of the text, right?
2) Is this behaviour the same on all versions of Windows? MSDN doesn't say too much about this at all.
Please and thanks a lot!
......
|
|
|
|
|
1. DT_CALCRECT will make the rect fit the size of the text drawn without any actual drawing. If you don't specify this switch, I think DrawText leaves the rect untouched.
2. Unless otherwise noted, functions tend to behave the same across OSs. I don't see any reason to think this is different for DrawText . Have you detected any anomaly?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|