Click here to Skip to main content
16,020,741 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: creating a linked list Pin
David Crow26-Jun-09 7:51
David Crow26-Jun-09 7:51 
Questionset the parameter of CRichEditCtrl ::SetWindowText() Pin
MrKBA11-Jun-09 5:18
MrKBA11-Jun-09 5:18 
AnswerRe: set the parameter of CRichEditCtrl ::SetWindowText() Pin
Stephen Hewitt11-Jun-09 5:58
Stephen Hewitt11-Jun-09 5:58 
GeneralRe: set the parameter of CRichEditCtrl ::SetWindowText() Pin
MrKBA11-Jun-09 6:01
MrKBA11-Jun-09 6:01 
GeneralRe: set the parameter of CRichEditCtrl ::SetWindowText() Pin
Michael Schubert11-Jun-09 6:12
Michael Schubert11-Jun-09 6:12 
GeneralRe: set the parameter of CRichEditCtrl ::SetWindowText() Pin
MrKBA11-Jun-09 6:40
MrKBA11-Jun-09 6:40 
GeneralRe: set the parameter of CRichEditCtrl ::SetWindowText() Pin
Michael Schubert11-Jun-09 20:50
Michael Schubert11-Jun-09 20:50 
Questioncan you find the problem?? Pin
August Brower11-Jun-09 5:10
August Brower11-Jun-09 5:10 
I am creating a program for a children's ATM for the local kids museum, and I'm having problems sending data to the machine (over RS232). I am using a .dll supplied by the manufacturer that is used to interface the dispenser with a computer. I think the problem is in sending the hex characters to the machine. I open the port fine (according to the generated log file), but then I send and don't recieve the ACK. I'm pretty sure that it is just not sending for some reason. here is the pertinent part of the code. thanks for any help

#include "stdafx.h"
#include




typedef struct
{
unsigned int uiPort; //communication port
unsigned char ucDataBits; //Data bit
unsigned char ucParity; //Parity bit
unsigned char ucStopBits; //Stop bit
unsigned long dwBaudRate; //Baud Rate
HWND hwnd; //Parent window handle
unsigned char ucCommandType; //command type(1: ezCDM-1000 )
}SETINFO;



typedef unsigned int (*EZLINKOPEN)(SETINFO* setInfo);
typedef unsigned int (*EZLINKCLOSE)(void);
typedef unsigned int (*EZLINKPATH)(PCHAR pcMessage);
typedef unsigned int (*EZLINKSEND)(DWORD dwCmdExcuteTime, PUCHAR pcMessage, UINT uiCmdSize);
typedef unsigned int (*EZLINKRCV)(PUCHAR pcMessage, UINT *piRspSize);



int _tmain(int argc, _TCHAR* argv[])
{
//Loading dll------------------------------------------------------------------------------------------


HINSTANCE hdll = NULL;
hdll = LoadLibrary(TEXT("ezlink")); //load the dll


if (hdll == NULL)
{
printf("Didn't load dll\n"); //tell me if it failed
}

//Mapping the dll's functions--------------------------------------------------------------------------------

EZLINKOPEN ezLinkOpen;
EZLINKCLOSE ezLinkClose;
EZLINKPATH ezLinkPath;
EZLINKSEND ezLinkSend;
EZLINKRCV ezLinkRcv;



ezLinkOpen = (EZLINKOPEN)GetProcAddress(hdll,"ezLinkOpen");
ezLinkClose = (EZLINKCLOSE)GetProcAddress(hdll,"ezLinkClose");
ezLinkPath = (EZLINKPATH)GetProcAddress(hdll,"ezLinkPath");
ezLinkSend = (EZLINKSEND)GetProcAddress(hdll,"ezLinkSend");
ezLinkRcv = (EZLINKRCV)GetProcAddress(hdll,"ezLinkRcv");


//handle the error
if(!ezLinkOpen) //end program if dll mapping fails fails
{
FreeLibrary(hdll);
printf("Failed to map open function!\n");
return -1;
}

else //otherwise, lets send some commands
{
unsigned int result;


//Setting the log path--------------------------------------------------------------------------------------------
char message[] = "C:\\Documents and Settings\\august brower\\My Documents\\Visual Studio 2008\\Projects\\cash machine";
result = ezLinkPath((PCHAR) &message);
printf("Result of Path: '%i'\n", result);

//Opening the port---------------------------------------------------------------------------------------------------
SETINFO pSetInfo;

pSetInfo.uiPort =3;
pSetInfo.ucDataBits = 8;
pSetInfo.ucParity = 2;
pSetInfo.ucStopBits = 0;
pSetInfo.dwBaudRate = 9600;
pSetInfo.hwnd = GetActiveWindow();
pSetInfo.ucCommandType = 1;

result = ezLinkOpen(&pSetInfo);
printf("Result of Open: '%i'\n", result);

unsigned char response[20] ;

UINT *rspSize;
rspSize = (PUINT)malloc(sizeof(UINT));


//Sending commands
unsigned char command[6] = {0x01,0x30,0x02,0x50,0x03,0x60};
unsigned char command9[1] = {0x06};
unsigned char command1[12] = {0x01,0x30,0x02,0x4B,0x42,0x32,0x42,0x32,0x42,0x32,0x03,0x0B};
unsigned char command2[7] = {0x01,0x30,0x02,0x42,0x21,0x03,0x53};

PUCHAR cassette; //check cassette
PUCHAR ack; //acknowledge
PUCHAR bill; //set bill dimensions
PUCHAR dispense; //dispense 1 bill


cassette = command;
ack = command9;
bill= command1;
dispense=command2;

//--get cassette info-------------------------------------------------
result = ezLinkSend(4000,cassette;message,6);
printf("Result of Send: '%i'\n", result);

result = ezLinkRcv(response,rspSize);
printf("Result of Receive: '%i'\n", result);

result = ezLinkRcv(response,rspSize);
printf("Result of Receive: '%i'\n", result);

result = ezLinkSend(4000,ack,1);
printf("Result of Send: '%i'\n", result);
AnswerRe: can you find the problem?? Pin
CPallini11-Jun-09 6:58
mveCPallini11-Jun-09 6:58 
AnswerRe: can you find the problem?? Pin
chirag_chauhan11-Jun-09 19:08
chirag_chauhan11-Jun-09 19:08 
QuestionHow to debug a DLL () running on the remote server using Visual studio 2005 Pin
ptr_Electron11-Jun-09 3:15
ptr_Electron11-Jun-09 3:15 
AnswerRe: How to debug a DLL () running on the remote server using Visual studio 2005 Pin
led mike11-Jun-09 4:32
led mike11-Jun-09 4:32 
AnswerRe: How to debug a DLL () running on the remote server using Visual studio 2005 Pin
chirag_chauhan11-Jun-09 19:16
chirag_chauhan11-Jun-09 19:16 
GeneralRe: How to debug a DLL () running on the remote server using Visual studio 2005 Pin
ptr_Electron11-Jun-09 22:35
ptr_Electron11-Jun-09 22:35 
GeneralRe: How to debug a DLL () running on the remote server using Visual studio 2005 Pin
chirag_chauhan11-Jun-09 23:14
chirag_chauhan11-Jun-09 23:14 
QuestionQuitting an application Pin
Gagnon Claude11-Jun-09 2:18
Gagnon Claude11-Jun-09 2:18 
AnswerRe: Quitting an application Pin
Rajesh R Subramanian11-Jun-09 2:54
professionalRajesh R Subramanian11-Jun-09 2:54 
GeneralRe: Quitting an application Pin
chirag_chauhan11-Jun-09 19:27
chirag_chauhan11-Jun-09 19:27 
GeneralRe: Quitting an application Pin
Rajesh R Subramanian11-Jun-09 21:32
professionalRajesh R Subramanian11-Jun-09 21:32 
GeneralRe: Quitting an application Pin
chirag_chauhan11-Jun-09 23:20
chirag_chauhan11-Jun-09 23:20 
Questionsave bmp in grayscale formt Pin
Member 604218211-Jun-09 2:07
Member 604218211-Jun-09 2:07 
QuestionRe: save bmp in grayscale formt Pin
CPallini11-Jun-09 3:27
mveCPallini11-Jun-09 3:27 
AnswerRe: save bmp in grayscale formt Pin
Member 604218217-Jun-09 23:24
Member 604218217-Jun-09 23:24 
AnswerRe: save bmp in grayscale formt Pin
Chris Losinger11-Jun-09 4:00
professionalChris Losinger11-Jun-09 4:00 
Questionmodule name Pin
ali kanju11-Jun-09 1:17
ali kanju11-Jun-09 1:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.