Hi there, i am having a few problems with a program. I am just a rookie programmer and there are some things i dont understand, if you could help me, in simple terms it would be great :D
Firstly i have a compile error with a custom function:
error C2197: 'int (__cdecl *)(void)' : too many arguments for call
I am not sure how to rectify it all, and i am even more unsure they code will write the resource to the open com port...
void SendREDBoot (HANDLE com, HWND hWnd, int WriteCOMData())
Outside the function the code compiles, its just tidier this way i think. However, the resource is not sent. I think i need to include MAKEINTRESOURCE somehow?
Now, WriteCOMData() is a separate function. What i really think i need to do it give that function a handle and point to it, instead of redefining it in another function...or maybe that is total rubbish :(
Any help with making correct custom functions and defining them would be of great help :)
Thanks
gbrooks3
July 18th, 2006, 07:05 PM
Hi, Well i still cant compile the function, but in "open code" this does send the bin file i want to the comport:
Unfortunatley there seems to be some kind of memory flaw in the code. Becuase the 42kb CID00_EF_P3G.bin wont send unless i cut it in half for example. I am not experienced enough with debugging so can someone guide me on how to increase the buffer size etc? :)
The bin file i want to send is to a device connected to a comport...however, throughout the sending of the file, the device should reply with a few bytes of data. At this point sending of the bin file should be paused and i need to send a 3 byte reply...then carry on with sending the rest of the bin file. This happens a number of times so i guess i must have to loop my Read function somehow?
Many thanks for the help :)
best.
philkr
July 19th, 2006, 05:22 AM
Concerning your compile problem: I assume you want to pass a function pointer as the third argument. In this case the right syntax is like this:
void SendREDBoot (HANDLE com, HWND hWnd, int (*WriteCOMData)(HANDLE,LPBYTE,DWORD,DWORD))
{
// ...
}
gbrooks3
July 19th, 2006, 09:49 AM
@philkr
Thats perfect, i understand the concept aswell which is even better :D Thanks :)
umm...i dont suppose you had a look at my two questions though? did you? I think its just a case of alocating a bigger buffer size, but i just dont know how.
Thanks for the help.
philkr
July 19th, 2006, 11:16 AM
umm...i dont suppose you had a look at my two questions though? did you? I think its just a case of alocating a bigger buffer size, but i just dont know how.
I can't tell without seeing the code of the function which writes to the com port.
gbrooks3
July 19th, 2006, 01:49 PM
Yes of course...sorry.
Write function:
int WriteCOMData(HANDLE f, unsigned char *lpBuffer, int nBufferSize, int dwMilliseconds)
(I dont mean to take advantage of your good will but i also have a problem when reading (ReadCOMBytes) after writing the bin files. The prgram just exits and no bytes are read. :(
Anyway, any help you can give will be great, i just want to learn from you guys :)
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.