|
Thanks..... now i got it.
|
|
|
|
|
hi i have written the following code to receive data from mobile using bluetooth through serial communication.
but it is not working
<code>
#include <stdio.h>
#include <conio.h>
#include <windows.h>
#include "stdafx.h"
#include "bluetoothConnection.h"
bool BluetoothConnection::openPort(char *portNum)
{
if (portNum != NULL)
{
hcomm = CreateFile((LPCWSTR)portNum, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, NULL, 0);
if (hcomm == INVALID_HANDLE_VALUE)
{
return false;
}
else
{
return true;
}
}
else
{
return false;
}
}
bool BluetoothConnection::initPort()
{
dcb.fOutxCtsFlow = false;
dcb.fOutxDsrFlow = false;
dcb.fDtrControl = DTR_CONTROL_DISABLE;
dcb.fOutX = false;
dcb.fInX = false;
dcb.fRtsControl = RTS_CONTROL_DISABLE;
//time settings
timeouts.ReadIntervalTimeout = 20;
timeouts.ReadTotalTimeoutMultiplier = 10;
timeouts.ReadTotalTimeoutConstant = 100;
if (!SetCommTimeouts(hcomm, &timeouts))
{
return false;
}
else
{
return true;
}
}
void BluetoothConnection::ReadPort()
{
memset(chRead, '\x91', 250);
Sleep(1000L);
ReadFile(hcomm, chRead, 250, &dwRead, NULL);
}
void BluetoothConnection::display()
{
printf("%s\n", chRead);
}
int main()
{
BluetoothConnection *bth1 = new BluetoothConnection();
if (bth1 != NULL)
{
if (bth1->openPort("COM4"))
{
if (bth1->initPort())
{
bth1->ReadPort();
printf("the data from com4 is ....\n");
bth1->display();
}
else
{
printf("fail in init\n");
}
}
else
{
printf("unable to connect\n");
}
}
else
{
printf("unable to connect failed in initial state\n");
}
Sleep(1000L);
return 0;
}
</code>
its failing in CreateFile function coz its returns 0xffffff..
can this code be used for bluetooth coz i found such code for serial port comm and infrared.
is there any configurations between mobile and pc before running this application if there please provide me the steps..
|
|
|
|
|
First, are you sure the COM4 port exist ? Are you developping for winCE ? If yes, then if I remember well, you have to append a ':' after the port name (thus "COM4:"). Not sure anymore, try it and tell me if it works.
|
|
|
|
|
iam not using for windows CE its PC to mobile VC++ 2005 and appending of : has not solved, plz give me some soln..
|
|
|
|
|
Does this port exist at least ? Did you try to open it with hyperterminal ?
|
|
|
|
|
no i am a begginer and i used AT command to test a while long back but now i dont remember it plz.. which is the command to type in and check for the status... and one thing when i open hyperterminal and select com4 and try to type some thing then my mobile disconnects the bluetooth connection...
|
|
|
|
|
Hello everyone,
In ATL wizard to create a coclass, under COM category there is an item named "Type", for example, if we assign the short name under C++ category to "aaaa", the value of "Type" is "aaaa Class".
My question is, what is the function of the so-called "Type" and how will client or COM server use this value?
thanks in advance,
George
|
|
|
|
|
Hi all,
I m using a static text.
i want it shows like a link and open a dilog box on its click event.
please tell me how can i do this.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
See here[^]
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Here hyper link is persen i just want only simple link
where on click on static text the dialog box is open
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
By following any one of the hundreds of examples that exist out there for this problem.
Or you could just sub-class the static and give it new behaviours so that (a) it's underlined, (b) has a different cursor (c) has a different colour (d) changes colour once visited (e) performs the desired action upon WM_LBUTTONUP, so long as it was under the mouse when the WM_LBUTTONDOWN message came in.
Remember, google is your friend. (Also, I believe Chris has written an article & class for this)
Results
|
|
|
|
|
If possible please explain me with example.
thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
buddy dig the code anshuman provided to you!, instead of opening webbrowser you couldn't open dialog box from there
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
I just dont want to use web browser , i want to use link with in my application.
so i want open a dilog box.
is this possible.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
I haven't gone through the code for the link that I provided you. but the article writer must have used ShellExecute or something like that to help the user navigate to a URL on which he/she clicks. You can replace this code with creation/showing of a dialog
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi All
How can i read and write in .txt file in VC++(MFC)?Plz help me
singh
|
|
|
|
|
Hi,
You can use CFile, like this you open the file..
char* pszFileName = "c:\\test\\myfile.dat";
CFile myFile;
CFileException fileException;
if ( !myFile.Open( pszFileName, CFile::modeCreate |
CFile::modeReadWrite, &fileException ) )
like this you can read and write..
char szBuffer[256];
UINT nActual = 0;
CFile myFile;
myFile.Write( szBuffer, sizeof( szBuffer ) );
myFile.Seek( 0, CFile::begin );
nActual = myFile.Read( szBuffer, sizeof( szBuffer ) );
Like this you close the file..
myFile.Close();
The price of anything is the amount of life you exchange for it.
Thanks and Regards.
SANTHOSH V
|
|
|
|
|
CStdioFile::ReadString
CStdioFile::WriteString
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
i try both example but nothing is write in file..File is open but data is not write there?
Plz help me
singh
|
|
|
|
|
|
Hi
I more problem when new is came then old line is delete.But i don't want to delete old line..Plz help me
|
|
|
|
|
cpvc++ wrote: Plz help me
F*CK, you don't reply to my questions, and still you're asking for help ?!!!
|
|
|
|
|
Hey what question Man?I am asking first time..
|
|
|
|
|
|
Mr. toxcct
I am not Mr. polop which is start this thread.I am different user and it's post help me and i want some more help me..Sorry for missunderstanding any way my code is here..Pla help me
CStdioFile file;
if (file.Open("\\log.txt", CFile::modeCreate|CFile::modeWrite ))
{
file.WriteString(logfile);
file.WriteString("\n");
}
file.Close();
logfile is CString type which have some information..
Now i am able to write in file but old line is delete when new line write.
Plz help me
|
|
|
|