|
Hi,
I'd like to know,,.
1) when I create my Dialog from CDialog class, why my Dialog does not have Destrucotr?
I want to free some heap memory I used in program,,, when I write writ memory clear code?
2) class CMyView
{
//from somewhre(such as thread) can
FuncA() {A();}
//from somewhre(such as thread) can send Window Message via (SendMessage())
FuncB(WPAAM w, LPARAM l) { A();}
A(){ print("A() called"); }
}
I'd like to know How they are diffrent?
when from calling function and calling via SendMessage()?
Have a day.
|
|
|
|
|
rambojanggoon wrote: why my Dialog does not have Destrucotr?
Did you code one?
rambojanggoon wrote: How they are diffrent?
when from calling function and calling via SendMessage()?
They are not different, you call the same function in both case.MVP 2010 - are they mad?
|
|
|
|
|
I am wondering why the second and third declarations below generate errors:
const double** const example1 = new const double*[5];
const double** const example2 = new double*[5];
const double** const example3(new const double*[5]);
void SomeFunction(const double* const * const);
SomeFunction(example3); Why is the compiler interpreting example3 as a function pointer? Why can't a 'double**' be implicitly cast to a 'const double** const'? Thanks,Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
The C2059 error is a compiler problem. It sees const double** const example3( and thinks it's a function declaration - and you can't have the new keyword in a function declaration. g++ compiles that declaration with no problem.
As for the rest…that's the rules of C++. If you really want to do it, you'll have to use an explicit cast.Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
CodeProject MVP for 2010 - who'd'a thunk it!
|
|
|
|
|
Hi Everyone,
I am Creating one application with the VC++(MFC).
I am using windows XP-32 and VS 2008.
I am trying to connect to the phone Nokia 6610 with the serial COM Port.
I want to set the At Commands on this phone.
I want to get he event when any new msg come on the phone.
I am using boost library to connect the phone.
When I am using
boost::asio::io_service io_service;
boost::asio::ip::tcp::resolver resolver(io_service);
boost::asio::ip::tcp::resolver::query query("localhost", "20");
boost::asio::ip::tcp::resolver::iterator iterator = resolver.resolve(query);
boost::asio::ip::tcp::socket mSocket(io_service);
boost::asio::ip::tcp::endpoint endpoint(boost::asio::ip::address::from_string("1.2.3.4"), 12345);
mSocket.connect(*iterator);
I am getting the error Exeption at the connect method.
Please help me Or give me some hint Or get the link of the examples of such examples.With Regards,
Mitul Golakiya.
E-Mail : mitulgolakiya@yahoo.com
|
|
|
|
|
To resolve this problem you would better asc library vendor/author.Here is nice tutorial how to connect with serial ports in MFC based on simple win32 wrapper.Life is a stage and we are all actors!
modified on Saturday, February 6, 2010 5:14 PM
|
|
|
|
|
Mitul Golakiya wrote: I am getting the error Exeption at the connect method.
Well if you don't tell us what the Exception is, we cannot guess!MVP 2010 - are they mad?
|
|
|
|
|
Hi,
Below is the code for which i get different outputs when compiled in vc6 and vs2008.
Why is it happening? Any comments will be helpful.
double x2 = 4294967036;
int i = 0;
i=(int)x2;
CString str;
str.Format(_T("%d == %d"),i,INT_MAX);
AfxMessageBox(str);
Output in vc6: -260 == 2147483647
Output in VS2008: -2147483648 == 2147483647
I can see that as the value is greater than max limit, its trying to display the max value. But I guess the typecasting is not exactly working in VS2008. How to make the typecasting work?Priya Sundar
|
|
|
|
|
Priya_Sundar wrote: But I guess the typecasting is not exactly working in VS2008.
It looks as though VS6 is the one that is not working. If you have a signed integer with a value of 231, every time you increment it, the value will get smaller until it reaches -231.
Priya_Sundar wrote: How to make the typecasting work?
What are you trying to do?"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
|
|
|
|
|
Basically I have huge old code with the way vc6 works. We then migrated it to vs2008. So the same old code seems to produce different results.
So we are looking for some solution.Priya Sundar
|
|
|
|
|
|
|
I'm getting this message when I build my project -
Linking...<br />
MyThread.obj : error LNK2001: unresolved external symbol "public: void __thiscall CMyThread::MyMessageHandler(unsigned int,long)" (?MyMessageHandler@CMyThread@@QAEXIJ@Z)<br />
E:\Stuff\Manmohan\Visual C++\IPM\Debug\IPM.exe : fatal error LNK1120: 1 unresolved externals
My code is here :-
.
.
.
#define WM_MYMESSAGE (WM_USER+1)
---------------------------------------------
#pragma once
class CMyThread : public CWinThread
{
DECLARE_DYNCREATE(CMyThread)
public:
CMyThread();
virtual ~CMyThread();
public:
afx_msg void MyMessageHandler(WPARAM, LPARAM);
virtual BOOL InitInstance();
virtual int ExitInstance();
protected:
DECLARE_MESSAGE_MAP()
};
-----------------------------------------
.
.
.
afx_msg void MyMessageHandler(WPARAM, LPARAM)
{
}
BEGIN_MESSAGE_MAP(CMyThread, CWinThread)
ON_THREAD_MESSAGE(WM_MYMESSAGE, MyMessageHandler)
END_MESSAGE_MAP()
My project is MFC dialog based.Future Lies in Present.
Manmohan Bishnoi
|
|
|
|
|
Your method implementation doesn't have the class name -
afx_msg void CMyThread::MyMessageHandler(WPARAM, LPARAM)
{
} L u n a t i c F r i n g e
|
|
|
|
|
Bull's Eye
LunaticFringe wrote: afx_msg void CMyThread::MyMessageHandler(WPARAM, LPARAM)
{
}
I think I need to get my basics CLEARED AGAIN Future Lies in Present.
Manmohan Bishnoi
|
|
|
|
|
Manmohan29 wrote: I think I need to get my basics CLEARED AGAIN
L u n a t i c F r i n g e
|
|
|
|
|
Perhaps you can try to delete the directory named "Debug" inside the directory named [your project]
and build your project again.
|
|
|
|
|
Yes.need add ::
|
|
|
|
|
help.. because it can be the most boring thing to do. i really don't know anything to help it other than my curiosity. yes curiosity helps but i need to
- grasp what the code does.. fast!
- without breaking my head. (is this a joke? i'm asking myself)
- get it done only with a cup of coffee.. lol (joke? yes/no? hmm)
|
|
|
|
|
JoeMan wrote: grasp what the code does
Read it and re-read it. Compile it and step through it with the debugger to see how things work.
There is only one way to make progress: practice, practice, practice.MVP 2010 - are they mad?
|
|
|
|
|
debugger...
never thought of it
thanks a lot
|
|
|
|
|
JoeMan wrote: debugger...
never thought of it
L u n a t i c F r i n g e
|
|
|
|
|
If I've got a piece of 'foreign' code I really have to understand, I usually make a copy of it and refactor it to my coding style and naming conventions. Doing this carefully, and stepping through the result in the debugger, usually gives me enough understanding to either use the code or rewrite it.
|
|
|
|
|
A good first step that's worked for me is to comment the code.
First a header for each method that explains what the method does. Next comments on the variables of the class, explaining what they do and how they're used. It also helps to comment unclear blocks of code once you figure out what they do, so you don't have to solve the same problem again later.
|
|
|
|
|
I sent the LVM_SETITEMPOSITION msg to the desktop icons' ListView, and the specified item changed the position, but I press 'F5' for refurbishing the desktop, its position had restore, why, why, i'm mad.
|
|
|
|