|
Errrrrrr, nevermind. I seem to have located it.
for (l = 0; l < m_nNumLines; l++);<---
^
I *AM* tired.
|
|
|
|
|
Turn onncompiler warnings and VC will flag that semicolon for you
--Mike--
I'm bored... Episode I bored.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Do you perhaps call OpenClipboard without closing it?
|
|
|
|
|
I have no operation about Clipboard. Just after create CRichEditview , Set it Text and formate the Text, the "Paste " operation invalidate.
|
|
|
|
|
There are some great articles on this site describing how to go about interfacing with a serial port.
However for a device that we are working on, we need to send 1 byte to the uart at a time (the uart on the recieving end) anytime we choose. not a string. Is this possible to do?
I'm not even closed to advanced in C++ as the majority of you guys are on this site. However if you could give me a push in the right direction or even a sight that gives me a ton of documentation on serial port interfacing and C++ function calls i can use, i'd be very greatful.
lead2gold
|
|
|
|
|
Thee have 3 following versions:
1. Write the driver (*.vxd - win98/95/Me; *.sys - W2k/WXP) and ALL problems will be resolved.
2. To use DOS, which one as against windows does not quench the direct reference(reversal) to ports.
3. HANDLE CreateFile(
LPCTSTR lpFileName, // file name
DWORD dwDesiredAccess, // access mode
DWORD dwShareMode, // share mode
LPSECURITY_ATTRIBUTES lpSecurityAttributes, // SD
DWORD dwCreationDisposition, // how to create
DWORD dwFlagsAndAttributes, // file attributes
HANDLE hTemplateFile // handle to template file
);
PS: There is still fourth version - when from a user's mode the functions Native API are invoked
|
|
|
|
|
Your advice is great, but i am totally oblivious to what i must know to write a driver.
I wouldn't even know where to start. If you could look at the reply i gave the other person who replied to my msg, you can see what i actually need to do.
But again thanks anyways! i appriciate you taking the time to reply. I wish i was more intelligent and could just go off and write a driver, but i can't.
lead2gold
|
|
|
|
|
1. The information and tools for writing the driver is in DDK. The book Walter Oney "Programming the MS WDM" will not hinder
also.
2. COM-port/RS232/RS232-C/UART - will be use as convertible terms.
3. What program you write (what device you have) ?
I not up to the end perceive it. And you see this most important in the solution of you problem.
If it is the simple test of device, it is easily to use MS DOS or other OS (even can approach Windows 95 (but is not higher)), which
one allow directly to work with ports.
If you write the severe program (system soft, for example), it is better to use OS QNX, which one is a real-time system !
4. If I correctly have understood, thee will use UART in a duplex operation (receive and transfer), and not just for transfer. Or you
use it in a half-duplex (step transfer then step receive then step transfer ... ) ?
5. As far as your problem was presented to me, normally to decide it using user mode (Win32 API) it is impossible. Because the
principle of operation UART is not concluded in signals on a line - all interface of activity and by her is constructed on processing of
one interrupt and on reading of the register of a condition with the purposes of finding - out of the cause of discontinuing.
PS: If you confidently know C ++ then to write the driver even for windows 2000 you can within a week, because today of driver
easily write on C++, while earlier predominantly on assembler
|
|
|
|
|
um... thanks i think
lead2gold
|
|
|
|
|
lead2gold wrote:
I'm not even closed to advanced in C++ as the majority of you guys are on this site.
Don't worry about that, there are lots of people here who are not 'Advanced' (including myself - far from it in fact), everyone starts somewhere!
lead2gold wrote:
we need to send 1 byte to the uart at a time
I have had to use the Serial port a couple of times and the following article has been very useful to me.
CSerialPort v1.03 - Serial Port Wrapper
By PJ Naughter
http://www.codeproject.com/system/cserialport.asp
The CSerialPort class includes these this function:
DWORD CSerialPort::Write(const void* lpBuf, DWORD dwCount)
It allows you to set the number of bytes you wish to write with dwCount, by seting it to 1 you can write a single byte. I needed to do just that in my application and it worked a treat.
Good luck!
Ali
|
|
|
|
|
Hi! thanks for replying to my post. Your advice is great, but unfortuantly I don't think it will help. The reason is that the unit we are designing ties CTS and RTS to seperate sections.
I want to be able to set CTS high whenever I want (which interacts with the hardware and preforms certain things) and then tie it low if i have to.
I want to be able to just listen on the Ring Indicator line, and if it's toggled high i'll run different code then if it were tied low maybe through irq or signal handling.
You know what i mean? Like TD and RD are reserved for there normally preformed function (transmiting and recieving serial data 1 byte at a time)
But all the other commands I don't want to use (the RS-232 method) I want to control it manually.
All in all, i have to be able to do this using Windows 2000. Is this a hopless cause?
lead2gold
|
|
|
|
|
lead2gold wrote:
Hi! thanks for replying to my post.
No problem.
lead2gold wrote:
I want to be able to set CTS high whenever I want (which interacts with the hardware and preforms certain things) and then tie it low if i have to.
I'm a bit confused here because I think that RTS is an output from the PC and CTS is an input. This is always confusing, but I will assume that you mean RTS, in which case have you noticed that the Serial Class I mentioned has the following functions:
void CSerialPort::ClearRTS()<br />
void CSerialPort::SetRTS()<br />
void CSerialPort::SetDTR()<br />
void CSerialPort::ClearDTR()<br />
Could you use ClearRTS & SetRTS to control the line that you want to? I have used SetDTR and ClearDTR for like this and it has worked well.
Apologies if I have miss-understood you. I know what it is like when you are struggling with this sort of thing, sometimes people don't understand what you need to do and its hard to get help.
You could always try asking your question again in a different way, you never know someone else who is a bit more knowledgeable might spot it and be able to help.
Good Luck ,
Ali
|
|
|
|
|
Naw! you hit the nail right on the head, and thanks for correcting me, i did mean rts. (not cts).
One last thing (since you've been a great help if you don't mind)
is is there away i can listen or lift a signal or irq if information has been sent to the computer?
Can i listen in on the Ring Indicator Line, or the CTS line to see what state there in?
lead2gold
|
|
|
|
|
lead2gold wrote:
since you've been a great help
Thanks , I'm only a novice myself realy but its nice to be able to help someone. However, I fear I may now let you down since your next question is beyond me.
lead2gold wrote:
if you don't mind
Of course not, feel free to ask away - I'll do my best.
lead2gold wrote:
is is there away i can listen or lift a signal or irq if information has been sent to the computer?
I'm not exactly sure what you want to do here but I don't think I have had to do anything similar. In my systems the PC has always been in control of the comms, and initiates transfers.
The only idea I have is to use one of the flow control techniques like CtsDtrFlowControl or DsrRtsFlowControl, (not sure which - depends on which line you need to monitor). When you open the port you can set the method you want like this:-
m_port.Open(m_nCommPort,38400, CSerialPort::NoParity, 8, CSerialPort::OneStopBit,CSerialPort::CtsDtrFlowControl );
Then use WaitEvent to see if the relevent line changes. I'm not even sure if this would work and even if it does it seems like a very clumsy method. I only mention it because that is where I would start to look.
Have you noticed that at the bottom of peoples articles there is room to ask a question? Perhaps you could direct this one to one of the people who have written CSerial classes, or ask again in the VC++ forum.
Good Luck
Ali
|
|
|
|
|
Hi,
I have a dialogue box and somewhere inside it I want a box with a scrollbar that shows text from a .txt file (the text file saved external to the main program). The text file is just a readme.txt that I want my program to display (just as you see at the beginning of many install programs).
I am sure this is fairly simple, but I can't seem to work out how to do it. If anybody could give me any tips, I would be very grateful.
Thanks!
Keith
|
|
|
|
|
Create a multiline editbox in your dialog. Load the contents of the readme.txt into memory, then just set the text of the editbox.
|
|
|
|
|
My friends,
I have a mpeg2 decoder project. Now I have gotten YUV data buffer.Then I want to display them.However, according to above convertion formula,I have only gotten fuzzy image.Why it happens? How should I do?
Thanks.
Danaus
YUV to RGB:
Y= 0.2990R+0.5870G+0.1140B
U=-0.1687R-0.3313G+0.5000B + 128
V= 0.5000R-0.4187G-0.0813B + 128
RGB to YUV:
R= 1.0Y + 1.402 (V-128)
G= 1.0Y - 0.34413(U-128)-0.71414(V-128)
B= 1.0Y + 1.772 (U-128)
lhm
|
|
|
|
|
Hello All,
I'm working on a windows service in XP which displays graphics.
I'd like the service to be able to display graphics ONLY to the current user's desktop.
Right now, when multiple users are logged into the machine through XP "Fast User Switching," the Service displays graphics only to the user that was logged in when the Service was started. No other user can see the graphics.
Does anyone know how to display graphics to a specific logged in user from a Service under XP?
Thanks.
|
|
|
|
|
Have you read this article. I believe it explains all you should need to know.
|
|
|
|
|
I'm working on an (AI) agent for my browser, thats explains why I want it runing in a thread, and I'm accessing a global CStringArray(loaded at start up), why does it crash when I try to access it?
DWORD CBookmarks::BKOrg_ThreadStub(DWORD arg)
{
return ((CBookmarks*)arg)->BKOrg_Thread();
}
DWORD CBookmarks::BKOrg_Thread()
{
::MessageBox(GetSafeHwnd(),"Start","Thread",MB_OK);
::MessageBox(GetSafeHwnd(),m_strStr_Websites[0],"Threads",MB_OK);
// ::MessageBox(GetSafeHwnd(),GetFiles(m_strStr_Websites[0]),"Threads",MB_OK);
::MessageBox(GetSafeHwnd(),"Ended","Thread",MB_OK);
AfxEndThread(0);
return 0;
}
void CBookmarks::StartBKOrg_Thread(void )
{
pThread=AfxBeginThread((AFX_THREADPROC)&BKOrg_ThreadStub,(void*)this);
}
But when the MessageBox with the CString is commented out then it runs fine.
-Steven
By reading this message you are held fully responsible for any of the mispelln's or grammer, issues, found on, codeproject.com.
For those who were wondering, actual (Linux) Penguins were harmed in creating this message.
|
|
|
|
|
CString and CStringArray objects are different when they can be accessed by several threads simoultanously. (the former are thread safe the later not).
In MT apps you have to access CStringArray's by using syncronization objects e.g. CriticalSection's.
Example:
CCriticalSection m_Sync;
In your your cpp:
m_Sync.Lock();
m_Sync.Unlock();
Bunburry
|
|
|
|
|
Geez, I hate to be completely stupid but I have a Win32 app and I'm creating a window with some static text items. I can't remember how to set the background color on my static text to match the window background. I get a white window and text with the blue-grey background.
I tried the WM_CTLCOLORSTATIC callback and return (COLOR_WINDOW +1) but it doesn't change the text background. Do I have to resort to making my own static text class to set the background to the color I want ?
|
|
|
|
|
SetDialogBkColor(backgroundcolor,textcolor); You can use this in the application construction area and it will use these color for your entire application.
|
|
|
|
|
You can also use WM_CTLCOLORSTATIC but you need to return a handle to a brush or else it won't work. So create a brush based on the background color and then return it from WM_CTLCOLORSTATIC.
|
|
|
|
|
When I create a udp socket and then bind to port 0 and set receive timeout to 5 seconds and then call recv it the recv does not wait 5 secs but returns immediately. When I check the error code with WSAGetLastError the error code is WSAECONNRESET. Why is the connections reset ?
I am using UDP and I am not connected .
What I am doing wrong ?
Here are the steps again
1) Create a UDP
2) Bind to 0
3) Send something to a destination address
4) setsockopt SO_RCVTIMEO to 5 secs.
5) try to recv something within 5 secs. But here it returns WSAECONNRESET !!!
What is wrong ?
Orcun Colak
|
|
|
|