|
It works !.
Thanks Amir.
Dear Amir,I have some expert in C# and now I migrate to mfc for some interesting and some works !.
Can I ask you guide me to some books or another resource to help me learn mfc better( and quick)?
Best Regardssepel
|
|
|
|
|
Ok Please Don't hesitate to ask any question ,But I could not promise if I could answer them all.
Here is a list of update books you may like to use, How ever mostl of MFC guide books found in the net are old ones but they could be useful too because the bases are the same:
http://msdn.microsoft.com/en-us/visualc/dd721903.aspx[^]
By the way for those who are new to MFC, How Do I? Video Series[^] would be interesting.
|
|
|
|
|
So Helpful.
Thanks again.sepel
|
|
|
|
|
Can I design application like no debugger gets the information from it.
|
|
|
|
|
1- build in RELEASE more
2- don't waste time on that issue because if your application is worthy enough, crackers/hackers will break it.
other than that, can you explain what you want, or what information you do not want people to see ?Watched code never compiles.
|
|
|
|
|
I'm working a _little bit_ with Visual C++ (Visual Studio 2005) but it is not a language I'm familiar with! I have a funtion that needs to take a char* parameter (non unicode) but inside that function I need to work with the data passed in as LPCSTR. I have found quite a few options to convert from LPCSTR to char* but not the other way around.
I have:
myfunction (char* param1)
{
LPCSTR p1;
}
How do I get the value of param1 into p1?
Thanks in advance
Best regards,Arnor Baldvinsson
|
|
|
|
|
I believe that LPCSTR is just const char *, so there is no conversion necessary. Just try:
LPCSTR p1 = param1;
Now, since p1 is a pointer to const, what it points to can not be changed through it.
Going the other way is an issue because what is being pointed to is presumably const, so you should not point a pointer-to-non-const to it. That would break the do not alter rule. So conversion isn't really the issue, but rather making an alterable copy of the original.
Now, if unicode was involved on one side but not the other, ... but that's not your question. Please do not read this signature.
|
|
|
|
|
Thank you Avi for a very quick response. I think I have this under control now
Best regards,
|
|
|
|
|
Hi,
How could I change the CMFCPropertyGridCtrl Property Column or Value column width?
a sample code would be more useful
|
|
|
|
|
How do you do a extern type declaration for this. At link time I get unresolved external symbol "public: static void__cdecl etc. etc.
I'm trying to expand my use of C++ to envelop static functions inside of classes as a way to help organize the code a bit better.
|
|
|
|
|
this worked for me:
class A
{
public:
static void g(int)
{
int i = 0;
}
};
typedef void (*fp)(int);
int _tmain(int argc, _TCHAR* argv[])
{
fp p = A::g;
p(1);
return 0;
}
|
|
|
|
|
class MyClass
{
static INT m_i;
};
__declspec(selectany) INT MyClass::m_i;
or
INT MyClass::m_i;
cheers,
ARWhen the wise person points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Static member functions usage:
MyClass.h:
class MyClass
{
public:
static int fcn( int param );
static int inlineFcn( int param) )
{
};
};
MyClass.cpp:
#include "Myclass.h"
int MyClass::fcn( int param )
{
}
Client.cpp:
#include "Myclass.h"
void clientFcn( int a, int b )
{
int c = MyClass::fcn( a );
int d = MyClass::inlineFcn( b );
}
It sounds to me that another approach might be more suitable for your purposes. I'll post that next.Please do not read this signature.
|
|
|
|
|
Alan Kurlansky wrote: a way to help organize the code a bit better
It sounds to me like you want the organization, but what you are doing is not truly about classes and object orientation. There is another facility in C++, namespaces, that may be more appropriate for your current use. It organizes things in groups and helps avoid naming conflicts, but does not raise the "object" expectations of someone reading your code.
In some ways using namespaces looks a lot like what I posted for static member functions.
This is how you might use namespaces:
Group.h:
namespace Group
{
int fcn( int param );
inline int inlineFcn( int param) )
{
};
}
Group.cpp:
#include "Group.h"
namespace Group
{
int fcn( int param )
{
}
}
Client.cpp:
#include "Group.h"
void clientFcn( int a, int b )
{
int c = Group::fcn( a );
int d = Group::inlineFcn( b );
}
AlternateClient.cpp:
#include "Group.h"
using namespace Group;
void altClientFcn( int a, int b )
{
int c = fcn( a );
int d = inlineFcn( b );
} Please do not read this signature.
|
|
|
|
|
Yes, organization is what I'm looking to do in this case. This looks good. I'll give this a try. Thanks
|
|
|
|
|
Good luck. I hope it works well for you.
I will add a note about style. My example showed indenting a level inside the namespace definitions, just like you would do for any other pair of {}'s. There are style guidelines that recommend not doing so for namespaces. I'm undecided about this myself.Please do not read this signature.
|
|
|
|
|
Thanks. This looks good. I'll give it a try.
|
|
|
|
|
I was reading http://www.cplusplus.com/doc/tutorial/pointers/
I understood most of what they were saying, so I chose to write my own code and comment what I have done to remember it in the future, but then its starts getting confusing near "Pointers and arrays" can anyone point out some simpler code for me to understand, so far this is the last thing I created::
#include "stdafx.h"
#include < conio.h >
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int fI = 3, sI = 2, tI = 1;
int * p1, * p2, * p3;
p1 = &fI;
cout << p1 << ": ";
*p1 = fI;
cout << *p1 << endl;
p2 = &sI;
cout << p2 << ": ";
*p2 = sI;
cout << *p2 << endl;
p3 = &tI;
cout << p3 << ": ";
*p3 = tI;
cout << *p3 << endl;
_getch();
return 0;
}
|
|
|
|
|
|
Herboren wrote: ...can anyone point out some simpler code for me to understand...
See here."One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Hi,
Does anyone know what settings I have to change in vc++, for it to allow for the use of the "Decimal" data type as opposed to float or double?
Thanks
|
|
|
|
|
C++ doesn't have a "Decimal" data type.
there are plenty of decimal classes out there on the net, though. google...[^]
|
|
|
|
|
There is no such setting - decimal floating points are not supported natively by C++ compilers.
Having said that, there are library solutions. Intel® Decimal Floating-Point Math Library[^] deserves taking a look at.
|
|
|
|
|
I was interested in checking this out but I keep hitting a brick wall when I try to download it. Did you get this to download from the intel website? What is the trick to getting it to do anything after you accept the license agreement?
*Update*
Never mind, I figured it out.
thanksmodified on Thursday, March 18, 2010 9:09 AM
|
|
|
|
|
DECIMAL is a struct defined in Wtypes.h, the (commented out) simple definition is:
typedef struct tagDEC
{
USHORT wReserved;
BYTE scale;
BYTE sign;
ULONG Hi32;
ULONGLONG Lo64;
} DECIMAL;
So it can represent a signed 96 bits integer with fixed decimal point.
OleAuto.h provides methods to transfer values from C++ numeric types to/from decimal structs such as WINOLEAUTAPI VarR8FromDec( const DECIMAL *pdecIn, DOUBLE *pdblOut); (converts a DECIMAL to DOUBLE) and WINOLEAUTAPI VarDecFromR8(DOUBLE dblIn, DECIMAL *pdecOut); (converts a DOUBLE to DECIMAL);
To use it include Wtypes.h and OleAuto.h, for arithmetic on DECIMAL use the VarDecXXX() functions described at http://msdn.microsoft.com/en-us/library/ms221612.aspx[^].
cheers,
ARWhen the wise person points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|