|
JeffProsise - MSPress - Programming Windows 95 with MFC
DaleRodgerson - MSPress - Inside COM
Those two teach the very roots of everything else.
Also a very valuable archive, free online : MSJ 1991-1998[^].
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
|
I'm amazed that no-one has suggested you buy the Bible - 'The C++ Programming Language' by Bjrne Stroustrup. Every C++ programmer should own it, and also his 'Design and Evolution of C++'
Beyond that, you should own the Langer & Kreft book on iostreams, a good STL reference, such as 'Generic Programming and the STL', and you may benefit from subscibing to the C Users Journal, despite a recent drop in quality it still has lots of good info on standard C++.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
I get the error
General error: Unable to read from file buffer occurred. Native Error Msg is: State:S1000,Native ,Origin:[Microsoft][ODBC Cursor Library]
from using a CRecordset derived class. Trouble is, I don't know which Open call is causing it because I have tried to comment the code in several places and it hangs up at different points each time.
I can see the CTTC* files in C:\TEMP directory and I have plenty of space there.
Does anyone have any idea? I looked up Microsoft Knowledge Base and they don't have anything for this error.
Thanks a lot in advance for any responses.
ashish
|
|
|
|
|
Hi All,
Does anyone know a better way of detecting an inactive system other than Global Mouse and Keyboard hooks. It would be nice if I could tell how long it has been since the user has performed any sort of user input to their system.
I do not like the GLobal hooks solution.
Thanks
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!
|
|
|
|
|
If you're on Win2k or better, you could maybe use GetLastInputInfo() . Or maybe install your own screensaver. Hooks do seem to be the most popular way though...
Shog9
------
Crazy lady with the shiny shoes, where are you?
Kick your feet and calm the space that makes you hollow
Live, Insomnia And The Hole In The Universe
|
|
|
|
|
Thanks, that's pretty much what I need.
(I guess I can live with hooks on Windows 98.)
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!
|
|
|
|
|
I'm working on a project on C++ of numeric calculus. I need to incorporate to a complete project that is written on ansi C ... Naturally, after compilation, the C functions are presenting big errors.
Is it possible to incorporate, in any way, to my C++ project, other projects written on ansi C?
Thanks in advance !
|
|
|
|
|
Yes, and it is very easy. The VC++ headers have this in many of the files. Just add this little section :
#ifdef __cplusplus
extern "C" {
#endif
// your C prototypes go here
#ifdef __cplusplus
}
#endif
The Ten Commandments For C Programmers
|
|
|
|
|
I'm trying to make a map like this:
CMap<cstring,cstring&,buddyinfo,buddyinfo&> *BuddyList;
with BuddyInfo being a struct. But, I get this error when I try compiling:
error C2440: 'type cast' : cannot convert from 'CString' to 'DWORD_PTR'
The error is in the second-to-last line in the following code from afxtempl.h:
template<class arg_key="">
AFX_INLINE UINT AFXAPI HashKey(ARG_KEY key)
{
// default identity hash - works for most primitive values
return (DWORD)(((DWORD_PTR)key)>>4);
}
What am I doing wrong? Thanks!
|
|
|
|
|
IGx89 wrote:
What am I doing wrong? Thanks!
First, your template arguments are not visible because you typed < instead of <, which you can enter using the buttons below this window if you prefer.
Second, why are you using CMap instead of std::map ?
Apart from that, I cannot comment, because I use *real* containers, not the rubbish that comes with MFC. If you have some reason for using them, then I wish you luck in finding an answer, but making your template arguments visible may help people in replying.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Christian Graus wrote:
because I use *real* containers
wow. i hope i never have to ask you a question, sir.
-c
bit, n:
A unit of measure applied to color. Twenty-four-bit color refers to expensive $3 color as opposed to the cheaper 25 cent, or two-bit, color that use to be available a few years ago.
|
|
|
|
|
I know. CG has become an elitist.
|
|
|
|
|
I don't know what you mean. My comment may have come across badly, but I only replied to explain the missing template parameters in the question, and I needed to explain that I couldn't help further, and wanted to recommend STL.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Christian Graus wrote:
and I needed to explain that I couldn't help further, and wanted to recommend STL.
I agree that the STL is what any good programmer would use, but they way you responded to his post made you seem like you were looking down on him for not using the STL.
I would say that Templates should be understood before one can call themselves a C++ programmer, and i really don't get why so many people have problems with using templates. I use templates instead of function overloading, and for many of my classes as well...so I do agree with you 100%.
|
|
|
|
|
Christian Graus wrote:
Second, why are you using CMap instead of std::map ?
Apart from that, I cannot comment, because I use *real* containers, not the rubbish that comes with MFC. If you have some reason for using them
So you figure I should change all my MFC-based containers to std ones? Gah.. the churn!!!
|
|
|
|
|
No, I would not recommend that. It's a waste of time to change working code. But I'd strongly recommend you learning how they work and using them in future. Have you used STL before ? I imagined you hadn't if you were using MFC containers, which are really a pale imitation.
I have some articles here on STL if you don't have any experience with them.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Well, we use something to STL similar at work (I think it's our own stuff based on STL), so i've exposed to it.
But..I tried using STL for something I was doing at home, and i found the syntax difficult, and i didn't really understand the complier errors I was getting, etc (the stuff at work wraps it all nicely for me). Mostly, the MFC stuff was easier to use, even though I knew it to be a worse implementation.
I'll have to spend some more time looking around / readin up on STL for future programs.
Thanks!
|
|
|
|
|
Yes, the compiler errors are a problem with STL, it can take a while to work out what is wrong. STL does NOT need wrappers though, it's just a case of learning the syntax so that when there is an error, you can work it out without trying to decipher the compilers errors.
Good luck !!!
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
I'm using CMap because my MFC book talked about it, and it's a lot easier to understand than std::map, at least from looking at the examples.
|
|
|
|
|
Fair enough. I used MFC containers for a while, and was only vaguely aware of vector. But I'd recommend you read my STL articles here on CP. The stl is not hard at all, the syntax is just unfamiliar - MFC containers follow MFC naming conventions which make them look more familiar, but in fact map and CMap work pretty much the same way. map is more powerful because of the way it interacts with other containers and algorithms.
You really owe it to yourself to look more closely at stl - as I said, it is far superior to the MFC alternative, which Microsoft only provided as a stopgap, expecting people to take up STL as soon as it became available in VC.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
try this:
template<>
inline UINT AFXAPI HashKey(CString& key)
{
return HashKey((LPCTSTR)key);
}
this will define a function that can convert your CString to a DWORD. just drop it in the header file where you define your map.
-c
bit, n:
A unit of measure applied to color. Twenty-four-bit color refers to expensive $3 color as opposed to the cheaper 25 cent, or two-bit, color that use to be available a few years ago.
|
|
|
|
|
Thanks, that worked perfectly!
FYI, the arguments are <CString,CString&,BuddyInfo,BuddyInfo&>
|
|
|
|
|
Why don't you use CMapStringToPtr or CMapStringToOb instead of fully generic CMap?
Tomasz Sowinski -- http://www.shooltz.com
*** Si fractum non sit, noli id reficere. ***
|
|
|
|
|
My service is running on a computer i want to getsome information that are
is the computer in logoff state or not ?
if computer is in a logoff state
i want to login,if i have username,password and domain how to login programatically?
how many software are installed in a computer ?
i also want to get installed software list names?
is there any api available for this purpose?
r00d0034@yahoo.com
|
|
|
|
|