|
I have test the above solution but I still cant find way out, who can solve the problem? Source code provided here would be much appriciated or you can send your code related to this subject to me at tiplip@msn.com, thanks a million
|
|
|
|
|
|
I want to send an recive a CString between COM1 and COM2.How can I use the function ReadFile() and WriteFile()?Can anyone give a example code?thanks very much.;P
YES, I am here.
|
|
|
|
|
Writing is easy but reading is not that simple. Check this website [^] for an example. Also search MSDN for serial communications.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
thank you .but that is too hard to find what my want.
can anyone give me a simple?
YES, I am here.
|
|
|
|
|
Angel Kid wrote:
that is too hard to find what my want
If you read the article that kuphryn gave you, maybe that example won't seem so hard. I agree with you when you say that it is too hard, because I had the same problem when I first saw the example a few years ago, but the thing is that I was unable to find anything more simple. I don't know how comfortable you are with threads because you have to use them. On the other hand just ignore all the stuff that seems complicated to you because you won't need most of it. I wish I could help you with some sample code, but unfortunately I don't have any available. Just take a look at [^] because there are some classes that deal with serial communications.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Look for this article on this site. Read it and implement.
Article name : "CSerialCom - A simple Class for Implementing Serial Communication in Win-9X/2000" by SHIBU K.V
Good luck.
Louis
|
|
|
|
|
Here is a link to MSDN that shows a good design sample from Microsoft.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfiles/html/msdn_serial.asp
Kuphryn
|
|
|
|
|
Hi All,
Anyway know how to process PowerPoint files other than using office automation? I need a threaded service, COM SERVER, etc, etc, that can export the slides from a PowerPoint deck, into individual images, like jpegs. I wrote a simple ASP COM object using the automation APIs, but it seems that its not threaded so multiple requests end up getting queued, just not a very good solution. If anyone knows of anything, please let me know.
Thanks,
Rick
|
|
|
|
|
Either write your own file parser/renderer, or download the OpenOffice[^] source code and extract the PowerPoint stuff. However, it's not that simple - The source is about 180MB compressed...
You might be able to find a commercial solution, but I've been looking for something similar and haven't found anything yet.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
hello @all,
i want to make a two dimensional matrix.
how can i do this? can anybody help me?
thank you very much
sunny
|
|
|
|
|
Do you want a static matrix or a dynamic matrix?
Kuphryn
|
|
|
|
|
thanks for reply.
i want a dynamic matrix!
thank you very much!!!
sunny
|
|
|
|
|
Okay. Here is an example of a two-dimensional array of char using dynamica allocation.
unsigned int nSize = 100;
char *text = new char*[nSize]
for (unsigned int i = 0; i < nSize; ++i)
text[i] = new char[nSize];
...
// Deallocation
Kuphryn
|
|
|
|
|
A chessboard matrix:
unsigned char pChess[8][8];
To access element 5,1 you would do it like this:
unsigned char u = pChess[1][5];
Dynamic matrix creation is a bit more difficult...
-Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
|
|
|
|
|
hello,
thanks for reply!!!!!
but i need a dynamic matrix!
can you help me?
thank you very much!
sunny
|
|
|
|
|
Is there any good way to do this or do I know a workaround of some sort?
|
|
|
|
|
To get the rect of the control or of the text itself?
// Control:
CRect oR;
CWnd *pStatic = GetDlgItem(IDC_THE_STATIC_CTRL);
pStatic->GetWindowRect(&oR);
ScreenToClient(&oR);
// bounding rectangle of static's text contents
CString cText;
GetDlgItemText(IDC_THE_STATIC_CTRL,cText);
CWnd *pStatic = GetDlgItem(IDC_THE_STATIC_CTRL);
pStatic->GetClientRect(&oR);
CDC *pDC = pStatic->GetDC();
pDC->DrawText(cText,&oR,DT_CALCRECT|DT_LEFT|DT_SINGLELINE|DT_TOP);
pStatic->ReleaseDC(pDC);
// oR now has the bounding rectangle needed to display the text.
onwards and upwards...
|
|
|
|
|
Wouldn't it be better to just make a memDC so the text itself won't show up on the control (it's already there ofcourse)? Or doesn't it do this anyway?
|
|
|
|
|
With the DT_CALCRECT the drawtext does not go to the screen it just calculates the rect.
John
|
|
|
|
|
Great! Thnx
|
|
|
|
|
One solution is to get the rect of the entire edit windows and then use GetTextExtent() to take add and subtract unit size.
Kuphryn
|
|
|
|
|
Hi. I'm doing a project where I open a COM port with CreateFile() to do some device accessing. I have writing working fine, but now I'm trying to figure out how to read one line of text from the COM port. The function fgets() would be nice, but it's for FILE structures and I have a HANDLE pointer to the open file.
Is their either
a) a function to create a FILE structure from a HANDLE, or
b) an existing function that does what I want?
I have created a function that I thought would read a file, but it crashes in the Kernel on my call to ReadFile(). Besides, I feel stupid writing such a basic function that I think must be already part of the Win API
I post in this forum because I actually am doing this in an MFC program, and I'm open to MFC solutions.
Thanks in advance.
<br />
<br />
LPSTR ReadLine( HANDLE hFile )<br />
{<br />
char c;<br />
LPSTR szBuffer;<br />
unsigned int pos = 0;<br />
BOOL fContinue = true, fCR = false;<br />
LPDWORD lpBytesRead = 0;<br />
<br />
szBuffer = (LPSTR)malloc( 256 );<br />
<br />
if( szBuffer != NULL )<br />
{<br />
while( ReadFile( hFile, &c, 1, lpBytesRead, NULL ) != 0 && fContinue ) {<br />
switch( c )<br />
{<br />
case 0x0A:<br />
fCR = true;<br />
break;<br />
case 0x0D:<br />
if( fCR )<br />
{<br />
fContinue = false;<br />
fCR = false;<br />
}<br />
break;<br />
default:<br />
fCR = false;<br />
szBuffer[pos] = c;<br />
pos ++;<br />
if( pos == sizeof( szBuffer ) ) <br />
fContinue = false;<br />
}<br />
}<br />
<br />
szBuffer[pos] = 0;<br />
}<br />
<br />
return szBuffer;<br />
}
|
|
|
|
|
You may want to look at the function
FILE *_fdopen( int handle, const char *mode );
creates a FILE * from a raw file handle.
onwards and upwards...
|
|
|
|
|
Not working. The example for _fdopen in MSDN uses _open() to open the file that's passed to _fdopen.
_open() returns an int, but CreateFile returns a Windows HANDLE pointer. So, this is the type of function I want, but it's required arguments aren't what I have.
|
|
|
|