|
Yeah , Thanks for the reply. I didnt add the RPCRT4.lib file before.
Now I am able to compile it.
Regards,
Sunil Kumar
|
|
|
|
|
i want to improve my question...
how to make application installer from mfc and opengl.
because i use opengl on my mfc....
please anyone...
|
|
|
|
|
Hello,
I have a dialog through which users of my application can get various reports. They select a date from a calender, and click the dialog's OK button. Then, a new frame is spawned with the report. So far, so good. However, because OnOK() is called, the newly spawned frame is immediately placed behind the main frame(window). This is obviously undesirable. How can I close the dialog, but still have the new frame spawn in front of existing main frame? I've tried doing things like calling EndDialog(0), or OnCancel, which would have been acceptable solutions, had they worked
What Should I do?
Thanks,
Sternocera
|
|
|
|
|
HKEY hKey;
CString path;
hKey = HKEY_LOCAL_MACHINE;
err = ERROR_SUCCESS;
m_list.InsertItem(0, "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\109C30587D582624882DD8B8A2B7808B");
path = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\S-1-5-18\\Products\\109C30587D582624882DD8B8A2B7808B";
err = RegOpenKeyEx(hKey, path, NULL, KEY_ALL_ACCESS, &hKey);
if (err == ERROR_SUCCESS)
{
m_list.SetItemText(0, 1, "Found");
ErrorExit("RegOpenKey0");
}
else
{
m_list.SetItemText(0, 1, "Not Found"); <--- this is the one i keep getting
ErrorExit("RegOpenKey1");
}
RegCloseKey(hKey);
that is the code and it keeps returning error 2 system cant find file but i know the path is good i copied the key from regedit i am on vista 64 bit if it makes a differance ill take any help i can get
|
|
|
|
|
locoone wrote: that is the code and it keeps returning error 2 system cant find file...
If the function fails, the return value is a nonzero error code defined in Winerror.h .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
that part i know the part i cant figure out is why it cant find it i was in regedit and used the copy key name to get the key path so i know its right out of 24 keys it finds 12 and cant find 12
modified on Saturday, August 9, 2008 11:28 PM
|
|
|
|
|
Do you get different results if you use KEY_QUERY_VALUE instead of KEY_ALL_ACCESS?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Unicode? If I recall correctly it's possible to have keys that regedit can't display correctly.
Thus, if you copy and paste you're not copying the entire key. I'd write a quick and dirty iteration
over the root key dumping the raw bytes in each key name to make sure you have the entire key.
|
|
|
|
|
I wrote the following header file. Actually, what I posted is only a subset of
the header file:
#include <assert.h>
using namespace std;
template class {T> class Polynomial {
public:
Polynomial <T>() : order(-1), coeff( 0 )
{
}
Polynomial <T> ( int order, ... );
T eval( T xValue );
Polynomial & Integrate();
void printIt( ostream &out );
friend ostream & operator << ( ostream &out, Polynomial<T> &poly );
private:
int order;
T *coeff; // Note the lower order terms of the polynomail go first. That
// is for the polynomial x^10 - 5 coeff[0] = -5, coeff[10] = 1
// and all the other values of coeff are 0.
};
typedef Polynomial<double> DoublePolynomial;
Now in the file, poly.cpp, I define the member functions for this class. I also
instantiated the class with the statement:
template class Polynomial<double>;
However, this does not instantiate the operator << . Therefore, if in the main
program I write something like:
cout << poly1 << endl;
where poly1 is of type Polynomail<double> I get an error from the linker. I believe that this
is due to the fact that I did not instantiate the operator << which is a friend of the class.
I am hoping that somebody can tell me how to do this.
Thanks
Bob
|
|
|
|
|
I've found this C++ Faq[^] helpfull on template linkage errors. I must admit that I usually put all the declarations in the header file myself to avoid the problems. Putting the declaration for operator << in the header file resolves the linker error.
I'm a bit puzzled why you bothered with the friend operator << at all, since you have a public printIt function, which presumably is called by the operator <<. The friend keyword allows the function access to the internals (private and protected) parts of the class, with a printIt method you don't need this.
You could get the same effect by putting a stand alone template function in the header instead, e.g.
template<class T>
ostream & operator << ( ostream &out, Polynomial<T> &poly )
{
poly.printIt(out);
return out;
}
Graham
Librarians rule, Ook!
|
|
|
|
|
Graham,
I want to thank you for your response. It has solved my problem. I am not a big fan of using
the operator << to print the results. I feel that this is best done by a member function. Therefore,
I wrote the function printIt. Therefore the operator << just needs to call printIt. I am also not
a big fan of using the keyword friend. I feel that giving non-member functions access to private data
of a class is not a good idea.
Bob
|
|
|
|
|
What are the limits of the drawing area in GDI?
I am using MoveTo(x, y), LineTo(x, y) GDI functions to draw multiple line. LineTo fails (returns FALSE) when the y is more than 1073741951 units.
GetLastError() return error code 534 - "Arithmetic result exceeded 32 bit"
So friends, any advice?
Thanks in advanced
Sandip
|
|
|
|
|
Calculations are probably done with 32-bit integers,
so you'll need to keep your coordinates scaled
to prevent the overflow. Pinning down an exact limit
would be difficult unless you know the actual calculations
being done by the system.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Both GDI and GDI+ are limited to 1073741951 pixel extents on both vertical and horizontal axis.
Best Wishes,
-David Delaune
|
|
|
|
|
Hello everyone,
I am shamed to ask this question because I can not figure out after some experiment. I think for reference variable, once it is binded, the target can not be changed.
But why in my following sample, pi can be binded to a and later binded to b without any issues?
int main()
{
int a = 10;
int b = 20;
int& pi = a;
pi = b;
return 0;
}
thanks in advance,
George
|
|
|
|
|
I don't know what you mean by "binded".
All you are doing is assigning a value to a variable...
You are free to assign any value to a non-const variable,
as many times as you want to.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark!
Cool.
regards,
George
|
|
|
|
|
Heh don't thank me - my reply made no sense.
Jijo and Nemanja have it right
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Good man, thanks Mark! Participation is also appreciated.
regards,
George
|
|
|
|
|
George_George wrote: int& pi = a;
In this statement you're initializing your reference variable. Now pi refers to variable a .
George_George wrote: pi = b;
In this statement you're assigning a value to your reference variable which will updates the value of variable a . Don't get confused - This is not re-initialization, Its just assignment.
George_George wrote: I think for reference variable, once it is binded, the target can not be changed.
Yes. Thats right. You cannot re-initialize a reference.
<modified with respect to Mark's comment>
Once reference is initialized and binded to one variable, you cannot re-initialize it or re-bind it to point another variable. But in your case, the statement pi = b; is just assignment. Thats why its legal.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
modified on Sunday, August 10, 2008 1:33 AM
|
|
|
|
|
Jijo raj wrote: Yes. Thats right. You cannot re-initialize a reference.
What do you mean by that?
*edit* I see - you were illustrating the difference between<br />
initialization and assignment, right?
Thanks,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote:
*edit* I see - you were illustrating the difference between
initialization and assignment, right?
Yes Mark.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Cool, thanks Jijo!
regards,
George
|
|
|
|
|
Binding? the use of reference variable is that it can be made to point to anything. Imagine it like a minutes pointer in a wall Clock. It can be rotated any degree to point to I,II,III,IV . here a,b is just like the I, II. You can turn your reference onto anything. No binding happens, but "referencing".
|
|
|
|
|