|
termal wrote: siemens me -> try to connect over RS232
I suggest you opt for this one because it's the simplest interface to "establish a connection" through.
Read here[^] for guidance on how to do that.
Note that you have to know what COM port your device is connected to.
But what happens when you've established the connection?
Then you're supposed to start communicating with the device. What protocol should you use? Do you know the protocol the device expects on that port?
Usually, as I said in my previous post, it's possible to send AT commands using the device as a modem. But the command set may be extended by vendor specific commands that are supposed to be used when "reading from the address book", if this functionality is supported at all through this interface.
You can have a look at this list of AT commands for Motorola phones here[^], but you'll notice that there are a lot of question marks which means that a lot of unknowns.
My point is that you have to know a lot about your device in order to start communicating with it, such as HW interface (RS232) and protocols supported. Protocols may even be nested, i.e. one protocol is wrapped inside another.
You have to know all this before having a chance of doing something right and get answers from the device that actually makes sense.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
termal wrote: i want to try to read data from mobile phone, but i never do something like this! It should be a simple project for beginners...
Are you sure this is something you want to try and tackle? Ambition is one thing, but by being a beginner, you're going to run into so many roadblocks.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi Experts,
I m working on a project which have two application which uses
one common DLL.and I wanted to share one common variable.But its not worked.
So I decided to use Windows Registry.
So can anyone tell me simple steps in C++ for.
1.Creating new Registry key
2.Setting its value as per requirement
3.Read the updated values when need.
4.Close registry ( i dont know when to use it..if my application is ruunig)
Plz help me..
Waitng for ur great solution.
regards,
Vijay
|
|
|
|
|
|
Thnax Saurabh,
THanx for replying dud..
but I cant open this site.(RESTRICTED ACCESS).
so If u know
plz tel me.
or
suggest any other option,
Regards,
Vijay
|
|
|
|
|
You are restricted from using MSDN? How is a developer supposed to get anything done without access to a toolbox? Do you have MSDN on CD/DVD?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Member 3220373 wrote: I m working on a project which have two application which uses
one common DLL.and I wanted to share one common variable.But its not worked.
In fact, you can make it working, see [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
i want to display icon/bitmap and some text in front of that icon or bitmap in a list box. how can i do this?
for ex
BITMAP1 "SOMETEXT"
BITMAP2 "SOMETEXT"
thanks in advance.
|
|
|
|
|
There's the List-View [^] control for that.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I am new to XML. I need a sample application that would create an XML , add elements to XML,delete elements from XML, Parse the XML using VC++6.0
Thanks
|
|
|
|
|
See, for instance [^], or [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi, I found this code on the MSDN website for detecting UPnP devices asynchronously but the problem is it only detects devices that are present on the network when the program starts. It doesn't detect devices that have been added later or removed. Please help!!
http://msdn.microsoft.com/en-us/library/aa382290(VS.85).aspx[^]
|
|
|
|
|
This program display an AVI file and its bitmqps file, but for specially file not for all size,for exemple it's for AVI file wich has a width= 48 and lenght=80
so the size is 48x80x3= 117Ko, so if we change the size it can't work.
please how to change this program for read all size for AVI file?
// Get pointers to the info structure & the bits
pointer = (BYTE *) prifffile ; the pointer here is static I think we must change into dynamic for read all size
//sstring[0] = * (pointer+4095);
pointer = pointer + 4096+11; // here we can change the color of bitmap background
hdc = BeginPaint (hwnd, &ps) ;
//draw a frame
for(i=0;i<48;i++)
for(j=0;j<80;j++)
if((0.299*(*(pointer+2+i*80*3+j*3))+0.587*(*(pointer+1+i*80*3+j*3))+0.114*(*(pointer +i*80*3+j*3)))<100)
SetPixel(hdc,j+50,i+50,RGB(255,0,0));
//draw 5 frames parally
for(m=0;m<5;m++){// this is a movie
for(i=0;i<48;i++)
for(j=0;j<80;j++)
SetPixel(hdc,j+100*m+50,i+150,RGB(*(pointer+2 + j*3 +(48-i)*80*3),
*(pointer+1 + j*3 +(48-i)*80*3),
*(pointer + j*3 +(48-i)*80*3)));
pointer = pointer + 11520*m+8*m;
}
pointer = (BYTE *) prifffile ; //let the pointer to pointer the begining again
pointer = pointer + 4096+11; //let the pointer to point at the bitmap data
//draw several frames to make a animation as movie
for(n=0;n<5;n++){ // repeat 5 times
for(m=0;m<5;m++){// this is a movie
for(i=0;i<48;i++)
for(j=0;j<80;j++)
SetPixel(hdc,j+50,i+250,RGB(*(pointer+2 + j*3 +(48-i)*80*3),
*(pointer+1 + j*3 +(48-i)*80*3),
*(pointer + j*3 +(48-i)*80*3)));
pointer = pointer + 11520*m+8*m;
Sleep(300); // set a time interval to make the movie natural
}
pointer = (BYTE *) prifffile ; //let the pointer to pointer the begining again
pointer = pointer + 4096+11; //let the pointer to point at the bitmap data
} // repeat 10 times
EndPaint (hwnd, &ps) ;
// show a dialogbox to tell you that the testing ends
MessageBox(hwnd,TEXT("displaying ends/ÑÝʾ½áÊø"),sstring,0);
return 0 ;
================================================================================================================================================
||Program||
-------
/*----------------------------------------------
SHOWDIB1.C -- Shows a DIB in the client area
(c) Charles Petzold, 1998
----------------------------------------------*/
#include <windows.h>
#include <aviriff.h>
#include <iostream.h>
#include "dibfile.h"
#include "resource.h"
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
TCHAR szAppName[] = TEXT ("ShowDib1") ;
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
HACCEL hAccel ;
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = szAppName ;
wndclass.lpszClassName = szAppName ;
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, TEXT ("This program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
hwnd = CreateWindow (szAppName, TEXT ("display an avi picture and an avi movie"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL) ;
ShowWindow (hwnd, iCmdShow) ;
UpdateWindow (hwnd) ;
hAccel = LoadAccelerators (hInstance, szAppName) ;
while (GetMessage (&msg, NULL, 0, 0))
{
if (!TranslateAccelerator (hwnd, hAccel, &msg))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
}
return msg.wParam ;
}
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
////////////////////////////////////
static BITMAPINFO * pbmi ;
static BYTE * pBits ;
////////////////////////////////////
static RIFFLIST * prifffile ;
static AVIMAINHEADER * pavimh;
static AVISTREAMHEADER * pavish ;
static BYTE * pointer ;
/////////////////////////////////////////////////////////////////////
static int cxClient, cyClient, cxDib, cyDib ;
static TCHAR szFileName [MAX_PATH], szTitleName [MAX_PATH] ;
BOOL bSuccess ;
HDC hdc ;
PAINTSTRUCT ps ;
int i,j,m,n;
//////////////////////////////////////////////////////////////////////
// RIFF is the first 4 letters of a riff file. avi file is a riff file
static TCHAR sstring[] = {'R','I','F','F','\0'};
//////////////////////////////////////////////////////////////////////
switch (message)
{
case WM_CREATE:
DibFileInitialize (hwnd) ;
return 0 ;
case WM_SIZE:
cxClient = LOWORD (lParam) ;
cyClient = HIWORD (lParam) ;
return 0 ;
case WM_INITMENUPOPUP:
EnableMenuItem ((HMENU) wParam, IDM_FILE_SAVE,
prifffile ? MF_ENABLED : MF_GRAYED) ;
return 0 ;
case WM_COMMAND:
switch (LOWORD (wParam))
{
case IDM_FILE_OPEN:
// Show the File Open dialog box
if (!DibFileOpenDlg (hwnd, szFileName, szTitleName))
return 0 ;
// If there's an existing DIB, free the memory
MessageBox(hwnd,szFileName,TEXT("The name of the file you have opened is"),0);
if (prifffile)
{
free (prifffile) ;
prifffile = NULL ;
}
// Load the entire DIB into memory
SetCursor (LoadCursor (NULL, IDC_WAIT)) ;
ShowCursor (TRUE) ;
prifffile = DibLoadImage(szFileName) ;
ShowCursor (FALSE) ;
SetCursor (LoadCursor (NULL, IDC_ARROW)) ;
// Invalidate the client area for later update
InvalidateRect (hwnd, NULL, TRUE) ;
if (prifffile == NULL)
{
MessageBox (hwnd, TEXT ("Cannot load AVI file"),
szAppName, 0) ;
return 0 ;
}
/* ------------------------------------------------------------------------------ */
// Get pointers to the info structure & the bits
pointer = (BYTE *) prifffile ;
//sstring[0] = * (pointer+4095);
pointer = pointer + 4096; // here we can change the color of bitmap background
hdc = BeginPaint (hwnd, &ps) ;
//draw a frame
//»Ò»Ö¡
for(i=0;i<48;i++)
for(j=0;j<80;j++)
if((0.299*(*(pointer+2+i*80*3+j*3))+0.587*(*(pointer+1+i*80*3+j*3))+0.114*(*(pointer +i*80*3+j*3)))<100)
SetPixel(hdc,j+50,i+50,RGB(255,0,0));
//draw 5 frames parally
for(m=0;m<5;m++){// this is a movie
for(i=0;i<48;i++) //»Ò»Ö¡
for(j=0;j<80;j++)
SetPixel(hdc,j+100*m+50,i+150,RGB(*(pointer+2 + j*3 +(48-i)*80*3),
*(pointer+1 + j*3 +(48-i)*80*3),
*(pointer + j*3 +(48-i)*80*3)));
pointer = pointer + 11520*m+8*m;
}
pointer = (BYTE *) prifffile ; //let the pointer to pointer the begining again
pointer = pointer + 4096+11; //let the pointer to point at the bitmap data
//draw several frames to make a animation as movie
for(n=0;n<5;n++){ // repeat 10 times
for(m=0;m<5;m++){// this is a movie
for(i=0;i<48;i++)
for(j=0;j<80;j++)
SetPixel(hdc,j+50,i+250,RGB(*(pointer+2 + j*3 +(48-i)*80*3),
*(pointer+1 + j*3 +(48-i)*80*3),
*(pointer + j*3 +(48-i)*80*3)));
pointer = pointer + 11520*m+8*m;
Sleep(300); // set a time interval to make the movie natural
}
pointer = (BYTE *) prifffile ; //let the pointer to pointer the begining again
pointer = pointer + 4096+11; //let the pointer to point at the bitmap data
} // repeat 10 times
EndPaint (hwnd, &ps) ;
// show a dialogbox to tell you that the testing ends
MessageBox(hwnd,TEXT("displaying ends/ÑÝʾ½áÊø"),sstring,0);
return 0 ;
case IDM_FILE_SAVE:
// Show the File Save dialog box
if (!DibFileSaveDlg (hwnd, szFileName, szTitleName))
return 0 ;
// Save the DIB to memory
SetCursor (LoadCursor (NULL, IDC_WAIT)) ;
ShowCursor (TRUE) ;
bSuccess = DibSaveImage (szFileName, prifffile) ;
ShowCursor (FALSE) ;
SetCursor (LoadCursor (NULL, IDC_ARROW)) ;
if (!bSuccess)
MessageBox (hwnd, TEXT ("Cannot save AVI file"),
szAppName, 0) ;
return 0 ;
}
break ;
case WM_PAINT:
hdc = BeginPaint (hwnd, &ps) ;
/*if (pbmi)
SetDIBitsToDevice (hdc,
50, // xDst
100, // yDst
cxDib, // cxSrc
cyDib, // cySrc
0, // xSrc
0, // ySrc
0, // first scan line
cyDib, // number of scan lines
pBits,
pbmi,
DIB_RGB_COLORS) ; */
EndPaint (hwnd, &ps) ;
return 0 ;
case WM_DESTROY:
/*if (pointer)
free (pointer);
if (prifffile)
free (prifffile);
if (pavish)
free (pavish);
if (pbmi)
free (pbmi) ;
if (pavimh)
free (pavimh) ;
if(pBits)
free (pBits);
*/
PostQuitMessage (0) ;
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}
|
|
|
|
|
Hi,
I try to use SetDllDirectory call, but fail to compile.
Platform = WinXP SP2 ; VS2005 SP1
#define _WIN32_WINNT 0x0502
#include "windows.h"
<...>
SetDllDirectory(NULL);
results in error C3861: 'SetDllDirectory': identifier not found
When I literally copy the defs from winbase.h like this :
#include "windows.h" // ( for SetDllDirectory call )
WINBASEAPI
BOOL
WINAPI
SetDllDirectoryA(
__in_opt LPCSTR lpPathName
);
#define SetDllDirectory SetDllDirectoryA
it compiles ok, but results in an unresolved external
error LNK2019: unresolved external symbol "__declspec(dllimport) int __stdcall SetDllDirectoryA(char const *)"
However, I do add kernel32.lib to the linker input.
How should I use this api then ?
Thanks in advance
Linde
|
|
|
|
|
Possibly you need an updated Platform SDK .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
No, I don't think so. The libs in the VC directory are more recent than the ones I find in the latest SDK update ( = from 2004 ! )
|
|
|
|
|
Resolved
--------
I changed the order of the numerous #include lines : I put the #include "windows.h" as the first, and now it works.
|
|
|
|
|
how can i display icons or bimaps on status bar on a dialog based application?eg winzip
|
|
|
|
|
|
how can i add and display status bar for a dialog based application?
thanks in advance
|
|
|
|
|
|
Hello,
I am working on an mfc chat application in which i want to incorporate chatting in multiple languages.
I am able to type arabic and chinese and other languages in the text box but it is not able to dislay it in CRichEditCtrl.
Please tell me whats the reason.
Thanks In Advance.
|
|
|
|
|
Try getting the raw text from the richedit control - and look through to see what font it being used. I'd suspect that the rich edit control is using a font that can't display your characters...
Have a look at http://www.codeproject.com/KB/edit/rulerricheditctrl.aspx[^], a good article using the rich edit control, and try typing using different fonts - it may help with your problem.
Iain.
|
|
|
|
|
Dear All,
I have a problem to convert a byte array to a image in vc++.
Is it possible in vc++ to convert a byte array in to a image.
Please help to solve this problem.
|
|
|
|
|
What data structure are you using for image?
-Saurabh
|
|
|
|
|