|
Having established a serial comms connection to COM 1 to access a modem it is possible to send AT command strings for the modem to interpret. In this way I can instruct a modem to dial a particular number and connect to a receiving modem and application.
Once the connection has been made the modem goes into online mode and so any data then sent to the COM port is then sent over the connection to the receiving modem and application. If I want to end the call from the initiating end, presumably I can just call CloseHandle on the handle created with the initial call to CreateFile and that will end the call.
However, from the receiving end, I would need to return the modem to command mode to issue the ATH command to terminate the call. Orinarily you would issue the escape sequence "+++" to get the modem into command mode. However, if I send "+++" to an open serial port it will just send that data over the connection
How can I get a modem back into command mode? Or am I going about it the wrong way?
I have already tried TAPI, unsuccessfully (see earlier posts), hence my attempt to use serial port comms.
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
The standard sequence is <wait at least 1 sec>+++<wait at least 1 sec>. Maybe that's your problem.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Sorry if I wasn't clear enough in my original post. If you use CreateFile to connect to the COM port and send the string "ATD Phone number" to the modem, anything you send after that, including "+++" gets sent as data. It does not recognise "+++" as the escape sequence.
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Sorry if I wasn't clear enough in my original post.
Maybe it's me who hasn't been clear in the answer What I meant is that you have to include two surrounding safeguard periods of at least 1 second in which you don't send any data to the modem for it to recognize the +++ as a escape sequence. I've successfully used this thing in the past, I'll send you a code snippet tomorrow when I get to work. Another possibility is that you need some previous AT command to instruct the modem to understand the +++ bit, but I don't think so.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I'm curious as to what the answer to this question is too.
I don't know if this will help but the MTTTY sample in MSDN makes a call to EscapeCommFunction(portNo, CLRDTR) which lowers the DTR signal. Then it is followed by restoring comm timeouts via SetCommTimeouts(), calls PurgeComm() and finally closes the handle to the port. I don't know if you're still connected and then are allowed to send the "+++" ATH at the point before closing the handle. The MTTTY sample should work with a modem but I did not see a "dial" command but it should pass on the AT commands too.
HTH
|
|
|
|
|
Thanks for the tip. I'll look into it at work tomorrow.
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Hi,
I work on a project which has this feature. It connects to some devices through MODEM also. It's working well.
The sequence of events happening are:
1. Send '+++'
2. Dial the modem by sending 'ATDT 1234' //1234 is the ph.number
3. wait for response from the other side (receiving MODEM.
4. Once u intrepret this response and it is correct, u r connected successfully.
Note: U can actually try dialing the modem thru' Hyperterminal provided by windows.
Hope this helps u..
thanks,
ravi.
|
|
|
|
|
I have a tree control and I need to associate 50+ varables with each item of the tree. I think someone mentioned a linked list or something but I'm not sure. Any tutorials about how to do this?
-Raffi
|
|
|
|
|
the typical way of doing this is to put a pointer to a data structure in the item data value for each tree item. this "data structure" can be anything you want: a class, an array, a list, a vector, a simple structure, etc.. the trick is to make sure the things you are pointing to remain active as long as the tree is alive, because don't want pointers on the tree pointing at objects that aren't alive any more!.
so, in pseudo-code:
pObject = new SomeObject;
tree.SetItemData(treeItem, (DWORD)pObject);
...
...
...
then, when you have to use the tree's data:
DWORD dwData = tree.GetItemData(treeItem);
SomeObject *pObject = (SomeObject *)dwData;
pObject->DoSomething();
-c
Cheap Oil. It's worth it!
|
|
|
|
|
That looks great, just one question. Would SomeObject be my list or array or whatever I use?
-Raffi
|
|
|
|
|
yes, exactly.
-c
Cheap Oil. It's worth it!
|
|
|
|
|
Hi,
I have a question a bit similar to this one.
I have a tree control that contains different types of items. Since there are three kinds of classes, i cannot use a type casting. First, i need to find the type of the object.
I intend to use something like below :
DWORD selectedItem = (DWORD) m_treeMain.GetItemData(
m_treeMain.GetSelectedItem() );
if( selectedItem.IsKindOf( RUNTIME_CLASS( CBand ) )
// Pop appropriate menu
But i can't use "." operator with selectedItem.
How should i do it?
Thank you.
|
|
|
|
|
tough one...
i would derive all three objects from a common base class.
then cast selectedItem to a pointer to that base class, and try the IsKindOf on that.
-c
To explain Donald Knuth's relevance to computing is like explaining Paul's relevance to the Catholic Church. He isn't God, he isn't the Son of God, but he was sent by God to explain God to the masses. /. #3848917
|
|
|
|
|
|
You need #define _WIN32_IE 0x500
|
|
|
|
|
it says the same + a macro redefinition warning of _WIN32_IE
|
|
|
|
|
Defined it is stdafx.h replace any definition if it already exists
|
|
|
|
|
I'm not sure what you meant, but if i remember correctly, stdafx is used for MFC, and i'm not using MFC.
|
|
|
|
|
You should do this before including windows.h.
You can also change it in the project settings. In C/C++ -> Preprocessor -> Symbol Defines add _WIN32_IE = 0x500
|
|
|
|
|
Just a small FWI: stdafx.h is (usually) used as the header file that creates the pre-compiled header (PCH) file. It has nothing to do with MFC.
The reason it was mentioned to put the #define _WIN32_IE 0x500 (near the top) of the stdafx.h file was so that it was #define d before the inclusion of any win32 header files that might be looking for that symbol.
Lastly, you may need to update your SDK files (Platform SDK) in order to get a header file that has the BIF_USENEWUI value in it. The "stock" files you get in an VC++ 6.0 install will not have it.
Peace!
-=- James.
"Some People Know How To Drive, Others Just Know How To Operate A Car."
(Try Check Favorites Sometime!)
|
|
|
|
|
I can't use ListView_GetItem cause it requires iItem to be filled...
|
|
|
|
|
Try to use ListView_FindItem.
int ListView_FindItem(HWND hwnd, int iStart, const LPLVFINDINFO plvfi);
typedef struct tagLVFINDINFO
{
UINT flags;
LPCTSTR psz;
LPARAM lParam;
POINT pt;
UINT vkDirection;
} LVFINDINFO, FAR* LPFINDINFO;
1. Initialize a LVFINDINFO structure with your lParam value and flags set to
LVFI_PARAM.
2. Then call ListView_FindIntem with iStart = -1.
3. Returned value is what you need to get all other properties.
|
|
|
|
|
|
if your lparam is a ptr to a data structure, may be you can store the hitem in it when you create your listview items
|
|
|
|
|
Do you know how should i add MFC support to ATL project?
When i try to use #include <afxwin.h> in stdafx.h and i declare a CString in a method i get the following:
Linking...
mfcs42d.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in a.obj
mfcs42d.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in a.obj; second definition ignored
Creating library Debug/a.lib and object Debug/a.exp
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
Debug/a.dll : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
I've defined _AFXDLL and _USRDLL in the project settings and still doesn't work.
rechi
|
|
|
|