Like Tree11Likes

detecting if touch screen.

This is a discussion on detecting if touch screen. within the Tech Board forums, part of the Community Boards category; detecting if touch screen. how would you detect if the device has a touch screen ? is there a touch ...

  1. #1
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638

    detecting if touch screen.

    detecting if touch screen.

    how would you detect if the device has a touch screen ? is there a touch screen api or sdk ? do all wireless phones have touch screen capabilities ? i understand that it is like programming for meeces .
    is there a standard or is it every device has its own system of routines ?
    <whiteflags> You foolishly believe in people and this feeling must be crushed.

    i have gotta get me a bunch of monsantos gmos == genetically modified orgasms .

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,791
    If there was such a thing as a global standard for everything, life would be easy. But life isn't, so does that imply there does not exist such a thing?
    OK, so enough of the cryptics. Obviously there is no such thing as a standard.
    By "wireless phones," what exactly are you referring to? Mobiles? Not all mobiles have touch screens. Wireless phones connected to the landline? Obviously there are non-touch screen there, too.
    How do we know if it has a touch screen or not? By asking the operating system, obviously. So do the devices all have the same OS? Highly unlikely considering mobiles run, what is it, at least 6 different operating systems, not including non-named ones?
    So start by defining what wireless phones are, then giving specific models, then seeking information about those model(s).
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  3. #3
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    you know i love the cryptic. i was asking if through a lang like c you could poll the smart phone if it had a touch screen no matter what os. or specific routines per os to use to determine if the smart phone has a touch screen. if you make an app would it work for all windows smart phones or if you make an app for mac would it work for all mac os smart phones.

    thank you for the reply.
    <whiteflags> You foolishly believe in people and this feeling must be crushed.

    i have gotta get me a bunch of monsantos gmos == genetically modified orgasms .

  4. #4
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,340
    i was asking if through a lang like c you could poll the smart phone if it had a touch screen no matter what os.
    A lot of "smart phones" don't even support native C.

    Face it, the "smart phone" market is fragmented as ........; if you want to develop for multiple systems you'll need to invest a lot of time and effort or partner with a "port master".

    Soma

  5. #5
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,791
    Last time I checked, Apple phones do not support C (Obj-C is used), Windows Phones do not support C (C# is used), Symbian phones's API is in C++, so C is pretty much out of the question, and Android is written using Java. There's an NDK, but I don't know if C is supported in there. Older phones use Java. So C is pretty much out the window. Though I have heard of a code once, deploy everywhere solution, MooSync or something, I believe it was called. I've never tested it, though.
    Obviously, if you target a range of phones with the same OS, then the changes that there might be such a solution goes way up, though you'd have to consult the doc for the OS you intend to develop for if there's a way to get that information. It really depends on the OS. Forget about trying to query the hardware directly.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  6. #6
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    rats! i had hoped the hardware could be poled directly. i have a partly completed proggie that i had hoped to market to the cell phone crowd. just a novelty program. not even sure it would sell.

    thank you for the information.
    <whiteflags> You foolishly believe in people and this feeling must be crushed.

    i have gotta get me a bunch of monsantos gmos == genetically modified orgasms .

  7. #7
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,791
    Polling hardware is always bad. Don't do it (unless you absolutely have to, obviously).
    The OS exposes APIs for this exact purpose.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  8. #8
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,183
    Code:
    std::cout << "Do you have a touch screen? (1/0) " << std::endl;
    std::cin >> has_touchscreen;

  9. #9
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    In all my experience with touch screens there has never been a clear defined method for querying. Usually you don't have to b/c touch screens are part of the device as in the case of mobile or part of your PC setup in the case of touch screens on PCs. I have worked a lot with touch screens on PCs in an embedded environment and most of the work was done by a driver that the C++ communicated with. There were several limitations such as what COM ports you could use, etc., etc. As well I noticed the touch screens I worked with were not nearly as good or responsive as the ones found in the iPad and other mobile devices. Perhaps this was a factor of manuf. since not many companies are investing in touch screens for the PC...although they are used more than one might think...primarily in commercial applications. Most touch screens on Windows bring the extra data in over a COM port and emulate mouse input and route message through the appropriate WM_ windows messages. I'm sure mobile devices are quite different since they support multiple touches and Windows does not.....yet.
    whiteflags likes this.

  10. #10
    Registered User kryptkat's Avatar
    Join Date
    Dec 2002
    Posts
    638
    Code:
    std::cout << "Do you have a touch screen? (1/0) " << std::endl;
    std::cin >> has_touchscreen;
    ask the user if they have a touch screen. great idea. NOT ! and lets just forget to ask what kind of operating system they have. and if you get and answer from the user how do you know if it is an honest one ? and lets not forget to program for one type or another of operating system in the routine.

    yea i pretty much gave up on this project due to too many different os .

    Code:
    std::cout << "are you telling the truth? (1/0) " << std::endl;
    std::cin >> telling_truth;
    
    std::cout << "what type of operating system do you have ? ( win/mac/and/misc) " << std::endl;
    std::cin >> type_os; 
    
    std::cout << "are you telling the truth? (1/0) " << std::endl;
    std::cin >> telling_truth;
    
    std::cout << "are you sure you are telling the truth? (1/0) " << std::endl;
    std::cin >> sure_telling_truth;
    <whiteflags> You foolishly believe in people and this feeling must be crushed.

    i have gotta get me a bunch of monsantos gmos == genetically modified orgasms .

  11. #11
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,791
    Quote Originally Posted by kryptkat View Post
    ask the user if they have a touch screen. great idea. NOT ! and lets just forget to ask what kind of operating system they have. and if you get and answer from the user how do you know if it is an honest one ? and lets not forget to program for one type or another of operating system in the routine.
    Stop treating users like idiots. If they give an answer, obviously you should treat that as truth. Who the heck (save for hackers maybe) enters wrong information on purpose?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  12. #12
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,743
    Quote Originally Posted by Elysia
    Stop treating users like idiots. If they give an answer, obviously you should treat that as truth. Who the heck (save for hackers maybe) enters wrong information on purpose?
    Programmers. They're people too and sometimes they use their own programs. Sometimes they use them wrong even after coding them wrong, which is why it's a good idea to make as few assumptions about the data (i.e. input) as possible.
    Last edited by whiteflags; 06-22-2012 at 05:11 PM. Reason: misquoted

  13. #13
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    4,340
    and lets not forget to program for one type or another of operating system in the routine
    O_o

    Okay.

    Can you please tell us if you ever release a bit of software for "Android" telephones?

    I only ask because I want to make sure I don't accidentally install anything you code.

    Soma

  14. #14
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,791
    Quote Originally Posted by whiteflags View Post
    Programmers. They're people too and sometimes they use their own programs. Sometimes they use them wrong even after coding them wrong, which is why it's a good idea to make as few assumptions about the data (i.e. input) as possible.
    Obviously you are right, but there is a limit to how extreme you can be. You must parse the input correctly in order to interpret it correctly. That's mostly what treat all input as evil means.
    Otherwise, what good is a question going to do? If you can't trust it, then don't ask it. It would be pointless.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  15. #15
    Registered User whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    7,743
    Indeed, what good is a question where either possible answer is equally likely a lie. I guess we shouldn't treat users like idiots.

    I think I'll like the post that makes the most sense here.

Page 1 of 3 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sharp Color 24Bit LCD Touch Screen... coding question.
    By RobertD in forum C Programming
    Replies: 5
    Last Post: 05-15-2011, 06:09 PM
  2. Detecting Full Screen Mode
    By ldd7812 in forum Windows Programming
    Replies: 2
    Last Post: 05-29-2008, 10:36 PM
  3. Touch Screen Monitor Program
    By EWTexas in forum C++ Programming
    Replies: 12
    Last Post: 09-18-2006, 02:17 PM
  4. DOS, Serial, and Touch Screen
    By jon_nc17 in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 01-08-2003, 03:59 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21