|
can someone tell me is there any code/program for erfc (complementary error function) in any of the Visual c++ header..especially the mathematical ones.
or any coding using this function..for my reference
thanx...
|
|
|
|
|
Hey people, I'm developing an application that gets SMS's from a GSM modem and uploads them to a DB. To do this i'm using a CInternetSession object. The app compiles OK but I get a Debug Assertation Error!. I think it has something to do with the internet session object because if I comment out anything to to with the CInternetSession then i don't get the debug error. Infact, simply the 'CInternetSession InternetSession;' declaration at the beginning causes the error alone.
Here's the code. sorry about the spaghetti style code - i'm a bit of a newbie to C++
<br />
#include <stdio.h><br />
#include <afxinet.h><br />
#include "Serial.h"<br />
<br />
#define EVER ;;<br />
<br />
static DWORD listenThread_id;<br />
static DWORD WINAPI listenThread(LPVOID ref);<br />
<br />
<br />
char * command = "AT+CMGR=3\n";<br />
char * delcommand = "AT+CMGD=1\n";<br />
<br />
int count = 0;<br />
<br />
bool appRunning;<br />
bool sendComm, delComm, sendToDB = false;<br />
<br />
CString st;<br />
CInternetSession InternetSession;<br />
<br />
void main()<br />
{<br />
appRunning = true;<br />
<br />
printf("Application Started. Press q to Quit. \n\n");<br />
<br />
printf("Please enter a command. \n\n");<br />
<br />
printf("Press r to read\n\n");<br />
<br />
if (CreateThread(NULL, 0, listenThread, NULL, 0, &listenThread_id) == NULL)<br />
{<br />
exit(-1);<br />
}<br />
<br />
while (appRunning)<br />
{<br />
char inChar = getchar();<br />
<br />
if (inChar == 'q')<br />
appRunning = false;<br />
if (inChar == 'r')<br />
sendComm = true;<br />
if (inChar == 's')<br />
sendToDB = true;<br />
if (inChar == 'd')<br />
delComm = true;<br />
}<br />
}<br />
<br />
static DWORD WINAPI listenThread(LPVOID ref)<br />
{<br />
CSerial Serial;<br />
int port=1, baud=115200;<br />
char lpBuffer[100];<br />
<br />
if (Serial.Open(port, baud))<br />
{<br />
for (EVER)<br />
{<br />
if (sendComm)<br />
{<br />
int commLength = strlen(command);<br />
Serial.SendData(command, commLength);<br />
sendComm=false;<br />
}<br />
<br />
if (delComm)<br />
{<br />
int commLength = strlen(delcommand);<br />
Serial.SendData(delcommand, commLength);<br />
delComm=false;<br />
}<br />
<br />
while (Serial.ReadDataWaiting() > 0)<br />
{<br />
int nBytesRead = Serial.ReadData(lpBuffer, 100);<br />
for (int i=0; i<nBytesRead; i++)<br />
{<br />
printf("%c", lpBuffer[i]);<br />
st += lpBuffer[i];<br />
<br />
int newMsg = st.Find("+CMTI: \"SM\",");<br />
<br />
if (newMsg != -1)
{<br />
count++;<br />
if (count == 2 && lpBuffer[i] != '1')
{<br />
switch(lpBuffer[i])<br />
{<br />
case '2': command = "AT+CMGR=2\n"; delcommand = "AT+CMGD=2\n";<br />
break;<br />
case '3': command = "AT+CMGR=3\n"; delcommand = "AT+CMGD=3\n";<br />
break;<br />
case '4': command = "AT+CMGR=4\n"; delcommand = "AT+CMGD=4\n";<br />
break;<br />
case '5': command = "AT+CMGR=5\n"; delcommand = "AT+CMGD=5\n";<br />
break;<br />
case '6': command = "AT+CMGR=6\n"; delcommand = "AT+CMGD=6\n";<br />
break;<br />
case '7': command = "AT+CMGR=7\n"; delcommand = "AT+CMGD=7\n";<br />
break;<br />
case '8': command = "AT+CMGR=8\n"; delcommand = "AT+CMGD=8\n";<br />
break;<br />
case '9': command = "AT+CMGR=9\n"; delcommand = "AT+CMGD=9\n";<br />
break;<br />
default: command = "";<br />
break;<br />
}<br />
sendComm = true;
st.Empty();<br />
}<br />
if (count == 3 && lpBuffer[i-1] == '1' && lpBuffer[i] == '0')
{<br />
command = "AT+CMGR=10\n"; delcommand = "AT+CMGD=10\n";<br />
sendComm = true;
st.Empty();<br />
}<br />
if (count == 3 && lpBuffer[i-1] == '1' && lpBuffer[i] != '0')
{<br />
command = "AT+CMGR=1\n"; delcommand = "AT+CMGD=1\n";<br />
sendComm = true;
st.Empty();<br />
}<br />
}<br />
<br />
if (st.Find("RING") != -1)<br />
{<br />
st.Empty();<br />
}<br />
<br />
if (lpBuffer[i-1] == 'O' && lpBuffer[i] == 'K' && st.GetLength() > 20)
{<br />
sendToDB = true;<br />
}<br />
}<br />
}<br />
<br />
if (sendToDB)<br />
{<br />
CString s_url = "http://localhost/motm/logvote.php?";<br />
CString s_var = "mess=";<br />
<br />
CString s_urlMessage = s_url + s_var + st;<br />
<br />
char * urlMessage = s_urlMessage.GetBuffer(s_urlMessage.GetLength());<br />
<br />
if(InternetSession.OpenURL(urlMessage))<br />
{<br />
printf("\nSent\n");<br />
st.Empty();
delComm = true;
count = 0;<br />
}<br />
sendToDB = false;<br />
<br />
delete urlMessage;<br />
}<br />
}<br />
}<br />
else<br />
<br />
appRunning = false;<br />
<br />
return 0;<br />
}<br />
<br />
|
|
|
|
|
biggsy14 wrote:
...I get a Debug Assertation Error!.
When the assertion fires, it tells you the line number and file of the offending statement. That should give you a big hint.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Thanks David,
I looked at that and it refers to line 31 of some MFC file. When i press retry on the debug assertation window it refers to getAfxAppName() at line 31 of that file with a yellow arrow in the call stack window. Also in the call stack window is a green arrow referring to line 22 of the code that i posted which is the 'CInternetSession InternetSession;' declaration, and refers to a $E4() method. There is also a window that comes up showing an 'Unhandled Exception' which i'm guessing is what the $E4() is. Any ideas on what to do with this exception?
|
|
|
|
|
biggsy14 wrote:
I looked at that and it refers to line 31 of some MFC file.
It would help to also know the name of the file.
Are you using Visual Studio v6 or .Net?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi,
Just initialize the CInternetSession Variable with a name.
For example, CInternetSession x("MY APPLICATION");
That should solve your problem.
Regards,
Mahadevan.
|
|
|
|
|
Thanks Mahadevan, that seemed to sort it. Much appreciated!
|
|
|
|
|
Hi,
Attempting to use PlaySound and sndPlaySound on a Win CE PocketPC. The API call returns to say it is a happy chappy and all is well, but I certainly don't get the specified .wav file played ! The file name is correct etc etc
Any idea's?
Interestingly, when I try and play .wav file from Windows explorer they don't sound either.... probably a clue there..!
Thanks
Loz
|
|
|
|
|
Hai Frens,
I need a help regarding MFC.
weather Forms can b inserted in the SDI.
I need to know How to insert with out using App Wizard.
I had an application where in all r programmed by my own With out using app wizard. Which is an SDI application. Now i am in need to insert few controls in that, i Hope With out forms Controls Can not b inserted.
So, Kindly Help me to insert Forms in SDI.
Bye
|
|
|
|
|
AppWizard is used once to create the initial project. After that, you can manually add classes to the project via ClassWizard. To add controls to the dialog template(s), select the ResourceView tab in the Workspace window, expand the Dialog item and double-click on the dialog resource you want to add controls to. Make sense?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi
Does anyone know how to get the list of USB devices connected in machine through c++
thanx in advance
|
|
|
|
|
We use sdiGetClassDevs, which takes the GUID for various USB devices, and then SdiEnumDeviceInterfaces on that to get each one. Then SdiGetDeviceInterfaceDetail will give more info. There are other functions in the same area that might be interesting to you.
Unfortunatly our compiler is too old to support the calling conventions used the actuall functions, so we have some wrappers. (there are historical reasons why we don't have a better compiler) You will need to figure out what the windows names for those functions are from those names. As I recall a search MSDN for those names will turn something up.
|
|
|
|
|
Do any of these WMI classes help:
Win32_USBController
Win32_USBControllerDevice
Win32_USBHub
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I have one dialog base application that is standalone now i need to add the automation functionality in it,
so that can access the methods and properties from other application
can u suggest any idea
i tried to add it through class wizard but it shows unable to create .old file
i derived it from CCmdtarget
pls help me for this
thanx
|
|
|
|
|
As always, programs change. My application started as a stand alone app. In the latest change, the request was made to ad COM support with my app becoming the server. The client can open my dialog boxes. It took some time, but it is up and running. The displaying of dialog boxes and most of the error messages get sent to the new client.
The problem is now: On DDV_ the validation does a display of a messagebox using AfxMessageBox() this goes directly to the active childframe of my app. The other error messages were replaced by ::MessageBox() where I can specify the window handle.
How must I tackle this sneeky little problem? Any advice appreciated.
Greetings,
NtwoO //C++ Newbee
beware of the dark side of -f
|
|
|
|
|
AfxMessageBox() calls the virtual function CWinApp::DoMessageBox().
Override it and call ::MessageBox with the parameters you want.
--
www.henrik-schmid.de
|
|
|
|
|
Hi,
I've writting a program which drives an imaging system through visual c++.
I would like to display some datas in a real-time graph.
Maybe someone could help me to find the code tu use.
Thanks a lot,
W.
|
|
|
|
|
This is a little vague. By real time graph do you mean oscilloscope?
Perhaps searching for such on this site would help.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
You can draw your "graph-field" (rectangles, lines, ...) and upon the field a polyline which represents the values.
update the polyline at intervals. (redraw the field and the polyline)
check out drawing tutorials etc...
good luck!
(if only you where a year earlier, then I still had example code, sorry)
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Hi!
I have a MDI application where my 'Open WindoList' don't appear under my menuchoice 'Windows' any more.
Do anyone have a clue what I might have done to stop this option to work?
Best regards,
Bertil Morefält
MSc Bertil Morefält
|
|
|
|
|
Please help me binding a edit box data into a combobox , Where i need to call the data from one field in the table recordset as a dropdown
|
|
|
|
|
See here and here.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
HI,
I want to drag n drop the file
that is i drag the audio file , when i place it on my application window area , my application starts playing it.
how i detect that file is now draged and on my application area , and how can get its path et to plat it,
any sample or help
thanx
Regards.
|
|
|
|
|
zahid_ash wrote:
how i detect that file is now draged and on my application area...
You need to handle the WM_DROPFILES message, after you've registered the application as a dropped-files recipient using DragAcceptFiles() .
zahid_ash wrote:
...and how can get its path et to plat it
Try DragQueryFile() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
thanx ...
but its giving some problm here.
can u send me some sample .
thanx again
Regards.
|
|
|
|