|
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.
|
|
|
|
|
The desktop is controlled by Windows, so I assume that when you press F5 it resets itself to its default settings. MVP 2010 - are they mad?
|
|
|
|
|
can i ask, why nothing happen when i call SetTimer function.
#define ID_TIMER1 101
void CSample_API_AppDlg::OnGetImage()
{
SetTimer(ID_TIMER1,500,NULL);
}
void CSample_API_AppDlg::OnTimer(UINT nIDEvent)
{
switch(nIDEvent)
{
case ID_TIMER1:
int width, height;
unsigned char *image = (unsigned char *)malloc(320*240*3);
RR_API rr;
rr.open("c:\\www\\Program File\\RoboRealm\\RoboRealm.exe",6060);
if (!rr.connect("localhost"))
{
printf("RoboRealm does not appear to be running.\nPlease run RoboRealm and try again.");
exit(0);
}
if (hBitmap) DeleteObject(hBitmap);
hBitmap = rr.getBitmap("processed", image, &width, &height, 320*240*3);
imageCtl.SetBitmap(hBitmap);
rr.disconnect();
free(image);
break;
}
CDialog::OnTimer(nIDEvent);
}
|
|
|
|
|
You could start by placing your code between <pre></pre> tags as described in point 7 here[^]. I also notice that you have a printf() and an exit() call within your timer event. Neither of these belong in a Dialog, I suggest you reread the MSDN section on Dialog Box Programming[^].MVP 2010 - are they mad?
|
|
|
|
|
You also need an ON_WM_TIMER() entry in the message map for your dialog.
|
|
|
|