|
im wondering how i map these i tried OnChar and OnKeyUp and OnKeyDown
but non of them do what i tell them to do instead it just moved the selected button on the tool bar i have here is the code i have for all 3 messages
switch(nChar)
{
case VK_UP:
curr_room.y -= 1;
break;
case VK_DOWN:
case VK_LEFT:
case VK_RIGHT:
break;
}
as you can see its imcomplete the but VK_UP doesnt even work how i want it
can someone tell me the proper way to get these keys to do work for me
thanks
|
|
|
|
|
I'm not sure to understand, could you specify these point?
* What do you want to do?
* In which class are you trying to catch the key input?
* Do you call the base class after catching the messages?
Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Dwight D. Eisenhower
|
|
|
|
|
i have a grid of images and only one can be selected so i want to move the selection box around with the arrow keys
im catching the key input in the main dialog
i tried both ways and neither worked
thanks
|
|
|
|
|
Have you tried to override PreTranslateMessage?
BOOL CMyDialog::PreTranslateMessage(MSG *pMSG)
{
if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_UP){
return TRUE;
}
return CDialog::PreTranslateMessage(pMSG);
}
Every gun that is made, every warship launched, every rocket fired, signifies in the final sense a theft from those who hunger and are not fed, those who are cold and are not clothed - Dwight D. Eisenhower
|
|
|
|
|
Hi,
how to detect 9.bit. I use ::ClearError() but it doesn't work correct ( I must detect particular BYTE where is 9.bit set to 1.
thanx
Martin
|
|
|
|
|
Most PCs don't support 9-bit communication, and I don't believe Windows does either. You can get a pseudo-9-bit operation by enabling constant parity (mark or space), and then the "ninth bit" is the parity bit - you can tell what it was by detecting whether or not parity errors occurred for a particular byte.
Hope this helps,
Ryan "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"
|
|
|
|
|
MSDN shows you can configure the DCB "Device Context Block" for anything from 5 to 8 bits. This must be a limitation MS put have in the IOCTL level for device drivers. When reading chars in fast, detecting a parity error for a byte is not possible.
My question (I know I am supposed to be answering) is who/what is sending 9 bits, and with what kind of UART?
Conrad - conradb@adroit.co.za
Always do badly to start off, that way when you get the hang of it suddenly, everyone is surprised.
|
|
|
|
|
conrad Braam wrote:
This must be a limitation MS put have in the IOCTL level for device drivers
Probably not. It's almost definitely a hardware limitation.
conrad Braam wrote:
My question is who/what is sending 9 bits, and with what kind of UART?
Most embedded microcontroller UARTs support 9-bit transmission, where the ninth bit is used as either an address bit or a start-of-packet bit.
Ryan "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"
|
|
|
|
|
can someone please! once and for all clean up the CR+LF vs. LF confusion?
Should text files contain CRLF, or just LF'?s and when there are only LF's? which file api's do what conversions?
"Dor säggsische Dialeggt eechnet sich wie keeen onderor für den Ausdrugg zäärdlischor Gefiehle."
sighist | Agile Programming | doxygen
|
|
|
|
|
CRLF
CR = Carriage Return
LF = Line feed
some old printers did CR automatically after LF , some not. And that's where all that started AFAIK.
In windows the texts usually uses CRLF and only VC (and other so designed utilities) are able to display texts with LF only (notepad not for example).
But linux guys tries to save this byte (CR ) therefore for linux the 'native' is to do only LF .
Conversion API - hmm replace?
Designing application - take the LF as the controlling sequence and ignore the CR before LF , this will allow your app to open both styles of texts. You have only to take a special care while saving.
|
|
|
|
|
There's no 'correct' way. Text files on Windows generally have the CRLF, whilst on Unix and Mac it has LF. I say generally because its not a requirement and you can mix and match, provided your application knows how to handle it. If you want to produce a text file that you can open in Notepad then you should go the CRLF way.
Opening a file in 'text mode' should do the conversion for you. I also think it will expand a \n into a \r\n combination, when writing (using the stdio functions anyway).
|
|
|
|
|
Generally, these are the standards:- DOS/Windows = CRLF
- Unix = LF only
- Mac = CR only (not LF only)
There are no apis to do automatic conversions, but you can use simple string search/replace's to do it.
Hope this helps,
Ryan "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"
|
|
|
|
|
Hi Guys,
I am new to MFC. I want to detect which icons are selected or not on desktop. Any body can help me?
Thanks
Tipu
|
|
|
|
|
I have a bit of a problem.
I have a string of characters, let's say for example, "0A74"
I want to take two of the characters at a time (i can do that much) and convert them to their ascii equivalent.
so, basically, if i were to input "0A74" i would like to have "\nt" as my output. are there any built-in base conversion functions i can use to do this?
I still need to do processing on the resulting string (that is, "\nt") so streams won't really be very efficient for me... any way to do this striclty with built-in functions and variables?
|
|
|
|
|
strtoul() is your friend here.
CString Convert(CString input)
{
CString output;
char *dummy = NULL;
int pos = 0;
int len = input.GetLength();
while (pos < len)
{
Output += (char)strtoul(input.Mid(pos, 2), &dummy, 16);
pos += 2;
}
return output;
}
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Wasn't aware that function existed -- you're a Godsend. thanks.
|
|
|
|
|
|
Hi Ravi,
Nope, interesting though. Can't think of where I'd use it though.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi everyone,
I want to be notified when a file is created in a folder. I use FindFirstChangeNotification(....) and listen for the FILE_NOTIFY_CHANGE_FILE_NAME event. However, it fires this event for rename and delete also. How can I know that a file has been newly created.
Thanks,
Xargon
Without struggle, there is no progress
|
|
|
|
|
Ok,
I found out the ReadDirectorzChangesW(...) function and it seems to be exactly what I am looking for on platforms >= WinNT. Any idea of something that might work on Win98 platforms.
Thanks,
Pankaj
|
|
|
|
|
It's definately possible and quite easy with FindFirstChangeNotification/FindNextChangeNotification.
Chris Richardson
|
|
|
|
|
Hi, I am new to c++ and I was put in a tough computer programming class and was absent the first two days and I would really appreciate it if somebody could help me:My E-mail address is squee211@yahoo.com Could you please E-mail me the code needed to run these programs. Thank you. If you need anything at all in return I would be more than happy to do it.
Here are the questions:
Run a program that will ask the user for a floating point number. It should then display the result of dividing that number by two in this format:
Example: Enter a number: 24.6
24.6 divided by two is 12.3
Run a program that will ask the user for three integers. It should then display the sum of the integers in this format:
Example: Enter an integer: 8
Enter another integer: 2
Enter another integer: 3
8+2+3=13
Run a program that will ask the user for two floating point numbers. The second number asked for should be the percentage the user wants to find of the first number. It shouls then display the result of finding the percentage in this format:
Example: Enter a number: 25
What percent of 25 would you like to find? 3
3% of 25 is 0.75
Run a program that will ask the user for a number of eggs. It should then display how many dozens exist and how many eggs are left over in this format:
Example: Enter a number of eggs: 45
45 eggs are 3 dozen eggs with 9 eggs left over.
Run a program that will ask the user for three numbers. It should then display the average of the numbers in this format:
Example: Enter a number: 3
Enter another number: 5
Enter another number: 8
The average of the three numbers is 5.333333
Run a program that will ask the user for a number of items. It should then display how many containers must be used to hold the given number of items. Assume each container holds 25items. The answer should be displayed in this format:
Example: Enter a number: 52
52 items requires the use of 3 containers.
Run a program that will ask the user for an amount in cents ($1.23=123 cents)
It should then display the number of quarters, dimes, nickels, and pennies equal to the amount.
|
|
|
|
|
Go and find all these tasks. Eliminate the first word in each task. Replace the eliminated word with "Design, implement and test, all by yourself, ...".
Perform these tasks. When ready, somebody here might be willing to fulfill your request and run these programs.
Bernd
|
|
|
|
|
I'll help you out with one of these programs, but you really should go to class if you expect to learn this. And I didn't check to see if this compiles.
Run a program that will ask the user for a number of eggs. It should then display how many dozens exist and how many eggs are left over in this format:
Example: Enter a number of eggs: 45
45 eggs are 3 dozen eggs with 9 eggs left over.
<code>
#include <iostream>
using namespace std;
int main()
{
int Eggs;
cout << "Enter a number of eggs: ";
cin >> Eggs;
cout << Eggs << " eggs are " << Eggs / 12 << " dozen eggs with "
<< Eggs % 12 << " eggs left over.\n";
return 1;
}
</code>
Douglas A. Wright
dawrigh3@kent.edu
|
|
|
|
|
"/r" is not an escape, but '\r' is.
|
|
|
|