|
First of all, you aren't already using the functions that I've provided via my first reply in this thread.
You should find them and copy&paste to your source file before the line void CForm1::OnCommand1().
Then, replace that function with the one below.
void CForm1::OnCommand1()
{
CComVariant retval;
CString exten="ccc_ext";
CString app_path = GetExeName();
CString Icon = GetExeFolder() + "\\book.ico";
retval = Associate_File(".ccc", app_path, exten, "My own extension", Icon);
AfxMessageBox(("Associated the file extension .ccc with this application!"));
}
I didn't want to post whole Associate_File() function that might mess up the board.
So, please find and replace all commented lines below with uncommented ones in Associate_File() function.
lRtn = RegSetValueExA(hKey, "", 0, REG_SZ, (LPBYTE)(LPCTSTR)Identifier, lsize);
lRtn = RegSetValueExA(hKey, "", 0, REG_SZ, (LPBYTE)(LPCTSTR)Description, lsize);
lRtn = RegSetValueExA(hKey, "", 0, REG_SZ, (LPBYTE)(LPCTSTR)Icon, lsize);
commandline = '\"' + Application + "\" \"%1\"";
lRtn = RegSetValueExA(hKey, "", 0, REG_SZ, (LPBYTE)(LPCTSTR)commandline, lsize);
It worked well in my system.
BTW, strings are not UNICODE.
|
|
|
|
|
IT WORKED
Iam reeeeealy thankful to u
i cant really thank u enough
THANK U
|
|
|
|
|
You're welcome.
|
|
|
|
|
lahom wrote: but with no directory shown in the right pane of regedit
Do you mean directory part of the fully qualified pathname?
like "C:\some.exe" or just "some.exe" for the action command.
|
|
|
|
|
Well this code is for vb but do you want to concatenate strings?
|
|
|
|
|
Hi, I'm beginner. I tried run project (http://opensteer.sourceforge.net/[^]). There is a main program and a few ready plugins. I compiled and run *.exe, but when I was switching plugins, traying run the last one (The most and only one important to me) "soccer" I had a message box:
------------
Microsoft Visual C++ Debug Library
Debug Assertion Failed!
Program: E:\opensteer\win32\bin\OpenSterDemo_d.exe
File: c:\progeam files\microsoft visual studio 8\vc\include\vector
Line: 1463
Expression: vector<bool> iterator not dereferencable
For information on how your program can cause an asseration
failure, see the Visual C++ documentation on asserts.
-------------
Could anybody help me ? please....
regards, Daniel.
PS: If something, maybe My english, is not understable I can try write in other way.
thx
|
|
|
|
|
This is not exactly a programming question. You should ask for help in the stree forum[^].
-Saurabh
|
|
|
|
|
I know that OpenSterr has own forum, but here are more people and... very smart
If, however, somebody could tell me something important, i'll be grateful.
Btw. after this msg. when I click IGNORE, I've last msg.:
//after choose IGNORE in msg box, next:
Microsoft Visual C++ Debug Library
Debug Assertion Failed!
Program: E:\opensteer\win32\bin\OpenSterDemo_d.exe
File: c:\progeam files\microsoft visual studio 8\vc\include\vector
Line: 1463
Expression: ("Standard C++ Libraries Out of Range", 0)
For information on how your program can cause an asseration
failure, see the Visual C++ documentation on asserts.
Thx anyway, BR.
Daniel.
|
|
|
|
|
What I need is very simple, copy some file to a directory where the application is.
|
|
|
|
|
|
Do you need to SHFileOperation?
|
|
|
|
|
I have a class that wraps a std::map (never mind why). To make it seamless to use I re-implement a number of the functions found on std::map, like find(), begin(), erase(), insert(), etc, and then just call the underlying map collection.
So I am working on porting this code to the Mac (which means I'm going to be pissing and moaning the rest of the day) and came across this gem:
error: conversion from 'void' to non-scalar type 'std::_Rb_tree_iterator<std::pair><const std::string,="" int=""> >' requested
</const></std::pair>
After digging and silently swearing under my breath I find that the GCC implementation of std::map::erase is different than what you find on Microsoft (note that the code worked on ALL versions of MS C++ from VC6 to VC9). Microsoft's is like this:
iterator erase( iterator i );
GCC's
void erase( iterator i );
So who's right?
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Generally when I have doubts about STL I check SGL STL[^].
In this case MSDN clearly says that return type of map does not conform to the C++ standard link[^].
-Saurabh
|
|
|
|
|
Grrrr why would they (MS) do that? I can see the mistakes in the VC6 version, but why keep promoting it through the other versions of the compiler???
Anyhow thanks for the info!
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
VCF Blog
|
|
|
|
|
Don't know my MS decided to do it this way but once C++0x is officially released MS implementation will be correct and other STL vendors will have to make the correction. In C++0x all containers erase functions should return iterator one past erased iterator n2350[^].
-Saurabh
|
|
|
|
|
because they value functionality and backwar compatibility over standard compliance?
It supposedly makes it more obvious to selectively erase items from a list while iterating through it:
for(it=cont.begin(); it!=cont.end();)
{
if (ToUglyToKiss(*it))
it = cont.erase(it);
else
++it;
}
otherwise:
for(it=cont.begin(); it!=cont.end();)
{
iterator cur = it;
++it;
if (ToUglyToKiss(*cur))
cont.erase(cur);
}
well, not to bad either, but I see how it can make a difference in more complex code.
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP blog: TDD - the Aha! | Linkify!| FoldWithUs! | sighist
|
|
|
|
|
hi all
is there any help to say , what is the best Book Or Reference for Visual c++ .
I'm new in visual c++
thanx very lot
s_mostafa_h
|
|
|
|
|
If one book could take you from beginner to intermediate programmer, (in Visual C++) it would have to be Ivor Horton's "Beginning Visual C++ 6" or there are versions for VC++ 2005 and VC++ 2008.
They are all basically the same except the newer ones add some odd chapters on WinForms and a small dose of .NET for completeness.
First half of the book teaches C++, the second half is about Windows programming. MFC is the dominant class library used.
|
|
|
|
|
I don't think that there is single book which is the final reference of entire VC++ programming stuffs. From my experience, I recommend 4 books, by which you can pass most of the hurdles that a typical windows programmer will encounter.
1) If you are a beginner and want to learn the basics of windows programming then,
- Programming Windows by Charles Petzold - Its a classic.
2) If you want the reference for MFC, then
- Programming MFC by Jeff Prosise.
3) If you want to do some kernel stuff, then.
- Programming Applications for Microsoft Windows by Jeffrey Richter.
4) If you want a reference for debugging, then
- Debugging Applications by John Robbins.
Regards,
Jijo.
________________________________
http://weseetips.com - Daily Visual C++ technical tips.
|
|
|
|
|
thanx ,
now i want to know is there any differ between Visual C++ 6 & VC++ 2005 or ... other version actually.
sometimes this very important to know this .
rgds
s_mostafa_h
|
|
|
|
|
Indeed. They differs a lot.
1) Visual Studio 2005 stays more close to C++ language specifications. Where in VC 6.0 you might miss some language features. For instance try-catch block in body of constructor. I couldn't compile it in my VC 6.0 SP5.
2) But don't under-estimate VC 6.0. I've to admit that VC 6.0 is one of the best IDE that ever build. You see, still its being used by lot of companies for lot of products. Its still popular now.
3) In VC++ 2005 supports .net platform where VC++ 6.0 don't.
Have a look at Wiki[^] about the different versions of Visual C++.
Regards,
Jijo.
________________________________
http://weseetips.com - Visual C++ technical tips.
|
|
|
|
|
And see www.cplusplus.com.
|
|
|
|
|
I'm getting the feeling that when using strtol and I'm interested in the global errno value before and after the call to strtol, I need to reset the global errno to zero (or some nothing value) in order to detect an error.
The documentation only says to check it before and after but if it was already set to ERANGE before the call and it overflows, it will still be ERANGE afterward.
Is it standard practice to reset errno explicitly before using strtol?
|
|
|
|
|
Unless LONG_MAX and LONG_MIN are valid input values, you can check return value first then check errno without being busy with errno before the function call.
<br />
long lVal = strtol(pszNum, &pEndPtr, 10);<br />
if((LONG_MAX == lVal) || (LONG_MIN == lVal))<br />
{<br />
}<br />
Your concern is valid when input value equals either LONG_MAX or LONG_MIN. Because, it returns LONG_MAX or LONG_MIN (defined limits.h) if an overflow (or underflow) condition occurs.
modified on Saturday, April 26, 2008 6:14 PM
|
|
|
|
|
Ozer Karaagac wrote: Unless LONG_MAX and LONG_MIN are valid input values
They are valid inputs and will not cause an error.
Ozer Karaagac wrote: Your concern is valid when input value equals either LONG_MAX or LONG_MIN.
Any string that equates to an integral value larger than these as well.
I guess I'm still unsure whether I can just reset errno before the call to strtol or am I required to read it, reset it, call strtol, check error, restore errno to it's original value?
|
|
|
|
|