Sunday, October 05, 2008

เริ่มกลับมาเขียน pocket pc ด้ว Native ก็เลยต้องย้อนอดีตกันหน่อย

ด้วยความที่ Requirement บังคับต้องเป็น Native เ่ท่านั้น..

ถ้าเป็นเพลาอื่นคงปฏิเสธไปเพราะเรียนรู่ .Net มาจะแย่ยังจะให้กลับไปทำ Native อีก

แต่เวลานี้คงช่วยไม่ได้ เออ เอากะมึงไอ้เต้ จะเอาก็ต้องเอา มาลองระลึกความหลังกันดู

แต่เริ่มเลยนะ รู้จัก ATL, MFC และ Win32 มากแค่ไหน (สำหรับศิษย์รัก Sun ขาประจำ Java อย่างผมคงร้องอี๋ เพราะไม่เคยจะสนใจ) ก็มาลองอ่านดู เอามาจากนี่ http://www2.cs.science.cmu.ac.th/useminar/2544/pocketgame/technique.htm

เอามาเก็บอย่างนี้เพราะกลัววันนึง source จะหายไป ไม่ตั้งใจทำซ้ำเผยแพร่แต่อย่างใด หวังว่าไม่ผิดนะครับ

สิ่งที่ควรรู้ก่อนเริ่มพัฒนาโปรแกรมบน Pocket PC

1. Windows CE

Windows CE เป็นระบบปฏิบัติการที่จัดการการโต้ตอบกันระหว่างซอฟแวร์การประยุกต์ใช้งาน ฮาร์ดแวร์ การที่เป็นผู้ใช้งานนั้นไม่มีความจำเป็นต้องรู้ว่าระบบปฏิบัติการทำงานอย่างไร แต่อาจเป็นประโยชน์ในการที่รู้ถึงผลกระทบต่อผู้ใช้ดังนี้ Windows CE

  • เป็นส่วนหนึ่งของ Win32 API ทำให้ง่ายสำหรับนักพัฒนาซอฟแวร์ที่จะเขียนโปรแกรมโดยใช้เครื่องมือที่คุ้นเคย จึงทำให้กระบวนการการพัฒนาซอฟแวร์รวดเร็วขึ้น
  • เป็น Portable และสามารถใช้งานบนตัวประมวลผลแตกต่างกันได้หลากหลาย ซึ่งก็หมายถึงว่าสามารถที่จะเลือกใช้ตัวประมวลผลจากผู้ผลิตได้หลากหลาย ให้ใช้เทคโนโลยีล่าสุดที่ราคาต่ำ
  • เป็นระบบปฏิบัติการแบบ Real Time จึงทำให้ระบบปฏิบัติการทำงานเร็วขึ้น
  • Modular Design หมายถึงว่าสามารถใช้ กับอุปกรณ์ได้กว้างขวางเช่นใช้กับตัวอุปกรณ์ปลายทาง , ใช้กับเครื่องเล่นเกมส์ ปัมม์น้ำเป็นต้น

2. GDI (Graphics Device Interface)

คือส่วนการควบคุมการแสดงข้อความและกราฟฟิก GDI จัดหาหลาย ๆ function และ โครงสร้างเพื่อนำ กราฟฟิกมาแสดงในอุปกรณ์ต่าง ๆ เช่น จอภาพ, ปริ้นเตอร์ และใน devices อื่น ๆ

หน้าที่ของ GDI สามารถวาดเส้นตรง line,curves ,closed figures , ข้อความ และ bitmapped image นอกจากนี้ยังสามารถใส่สีให้กับสิ่งที่เราวาดหรือสิ่งที่เราสร้างขึ้น

GDI มี 3 อุปกรณ์ในการวาดรูปที่สามารถสร้างกราฟฟิกดังนี้

    • ปากกาเพื่อวาด line & curves
    • Brushes เพื่อเพิ่มภายในของรูปร่างปิด
    • Fonts เพื่อเขียนข้อความ

Graphical user interface (GUI)

GUI เป็นวิธีการใช้งานของผู้ใช้คอมพิวเตอร์ที่เลือกแฟ้ม โปรแกรม หรือคำสั่ง โดยชี้ไปยังรูปภาพแทนสิ่งเหล่านั้นบนจอภาพแทนการป้อนคำสั่งยาวๆ ยุ่งยากที่เครื่องหมายรับคำสั่ง

โปรแกรมระบบงานที่ทำงานในวินโดวส์นั้นใช้ชุดของเมนูแบบดึงลง กรอบสนทนาและกราฟิกแบบอื่นๆ เช่น แถบเลื่อนและไอคอน เป็นต้น วิธีการโต้ตอบที่ตรงกันหมดนี้ทำให้ผู้ใช้ได้ประโยชน์ เพราะเมื่อเรียนรู้การใช้งานจากโปรแกรมหนึ่งก็นำไปใช้ได้กับทุกโปรแกรมที่ทำงนอยู่ในภาวะแบบเดียวกันนี้

การใช้งานแบบกราฟิกนี้มีขึ้นที่ศูนย์ วิจัย Palo Alto ของบริษัท XeRox (PARC) ในช่วงยุค 70 แต่โชคไม่ดี ในขณะนั้นฮาร์ดแวร์ที่ต้องการให้ใช้งานแบบนี้พัฒนาด้วยเทคนิคที่สูงและทำให้ ราคาแพงเกินกว่าที่ผู้ใช้ส่วนมากจะมีใช้ได้ ในปี 1979, Steve Jobs แห่งบริษัทแอปเปิลคอมพิวเตอร์ได้มาเยี่ยม PARC และได้เห็นความสำคัญในการทำงานของผู้ใช้จึงได้นำไปพัฒนาขึ้นใช้กับ คอมพิวเตอร์รุ่นแอปเปิลลิซาซึ่งไม่ประสบความสำเร็จและในที่สุดไปใช้กับ คอมพิวเตอร์ชุดแมคอินทอช จากนั้นมาวิธีการใช้งานแบบกราฟิกนี้ก็ได้ผสานเข้ากับการทำงานของคอมพิวเตอร์ จากพีซีไปจนถึงระบบยูนิกซ์อันใหญ่โต, แมคอินทอชซิสเต็ม 7, ไมโครซอฟต์วินโดวส์, วินโดวส์ 95, วินโดวส์เอ็นที และโอเอส/ทู ทั้งหมดนี้ใช้ GUI พร้อมกับเมาส์ แทร็กบอลหรืออุปกรณ์ที่ใช้ชี้ตำแหน่งแบบอื่นๆ

kernel

เป็นรากฐานที่สำคัญที่สุดของระบบปฏิบัติการเคอร์เนลจะฝังอยู่ในหน่วยความจำตลอดเวลา ผู้ใช้จะไม่สามารถมองเห็น ทำหน้าที่จัดการหน่วยความจำในระบบ ระบบแฟ้ม และการทำงานกับดิสก์

จากตัวอย่างจะเห็นได้ว่า การคำนวณส่วนต่างๆทำได้เร็ว แต่การคำนวณ sky ทำได้ช้ามาก และการคำนวณโดยรวมนั้นถือว่าอยู่ในระดับปานกลาง

3. GX (Game API)

ใช้สำหรับติดต่อกับ device (อุปกรณ์ input / output ต่างๆ) ข้อเสียคือไม่สามารถเข้าถึงข้อมูลได้โดยตรง

จากตัวอย่างจะเห็นได้ว่า การคำนวณส่วนต่างๆทำได้เร็ว แต่การคำนวณโดยรวมนั้นถือว่าอยู่ในระดับช้ามากๆ

4. DSA (direct Screen Access)

ลักษณะการทำงานจะทำการดึงข้อมูลต่างๆที่เกี่ยวกับหน้าจอ เช่น scan line (เส้นแต่ละเส้นบนหน้าจอ)จาก VRAM และสามารถเข้าถึงข้อมูลเหล่านั้นได้โดยตรง ข้อดีคือ สามารถทำงานได้รวดเร็วขึ้น

จากตัวอย่างจะเห็นได้ว่า การคำนวณส่วนต่างๆทำได้ช้า แต่การคำนวณโดยรวมนั้นถือว่าอยู่ในระดับที่เร็วมาก

การเลือกใช้ทั้ง 3 ตัวนี้ขึ้นอยู่กับลักษณะของ CPU ว่าจะเหมาะดัวไหน

ตารางแสดงการเปรียบเทียบการใช้ Visual Basic กับ Visual C++ ในการพัฒนาโปรแกรมบน PocketPC

Feature

Visual C++

Visual Basic

ต้องการโปรแกรม run time ติดตั้งใน PocketPC ด้วย ต้องการถ้าคุณใช้ ATL (Active Template Library) หรือ MFC(Microsoft Foundation Classes) ต้องการเสมอ
ทดสอบผลโปรแกรมด้วย Emulator ได้ ได้
ทดสอบโปรแกรมบน H/PCs ได้ ได้
ทดสอบโปรแกรมบน Palm-size PC ได้ ไม่ได้ในอุปกรณ์ที่เป็น เวอร์ชั่น 1.0
ทดสอบโปรแกรมบน Pocket PC ได้ ได้
โปรแกรมที่ได้ไม่ผูกกับตัวประมาลผล (Processor) ไม่ใช่ (ยกเว้นถ้าใช้ CEF - Common Executable Format) ใช่
Debugging support บน desktop emulation ใช่ ใช่
Debugging support บนอุปกรณ์ Windows? CE ใช่ ใช่ (เฉพาะ H/PCs) และ Pocket PC
Development of COM components (COM server or ActiveX? Controls) ได้ ไม่ได้
Hosting ActiveX controls ได้ (แต่ยากในการพัฒนา) ได้ (แต่ยากในการพัฒนา)
การพัฒนา drivers ได้ ไม่ได้
การพัฒนา ActiveSync? Filter ได้ ไม่ได้
ความสามารถในการพัฒนาโปรแกรมได้อย่างรวดเร็ว ไม่ได้ ได้
ความอิสระในการพัฒนาโปรแกรม มาก จำกัด
สนับสนุน embedded devices ใช่ สนับสนุนตั้งแต่ Windows CE 2.11
สนับสนุน remote services ใช่ ใช่ (ใช้ Winsock control)
สนับสนุน Pocket PC enhancements ใช่ ใช่
สามารถใช้l Pocket PC API อย่างเต็มที่ ใช่ ไม่ (เฉพาะ ActiveX controls ที่เขียนด้วย C++)
ความง่ายในการเข้าถึงข้อมูลด้วย ADOCE (Active Data Objects for Windows CE ไม่ (สามารถทำได้แต่ยากในการพัฒนา) ง่าย

23 comments:

  1. Can you tell us more about this? I'd like to find out some additional information.

    Feel free to visit my page; https://wiki.informatikdidaktik.de/index.php?title=Benutzer_Diskussion:FletcherF
    Also see my webpage - What You Could Do As A Substitute For Filing For Bankruptcy - Hukuk Wiki

    ReplyDelete
  2. I was curious if you ever thought of changing the page layout of
    your blog? Its very well written; I love what youve got
    to say. But maybe you could a little more in the way of content so people could connect with it better.
    Youve got an awful lot of text for only having one or two pictures.
    Maybe you could space it out better?

    My web-site; best reseller hosting uk
    Also see my web page > business web hosting

    ReplyDelete
  3. I really like your blog.. very nice colors & theme. Did you create this website yourself or did you hire
    someone to do it for you? Plz answer back as I'm looking to create my own blog and would like to find out where u got this from. cheers

    Also visit my webpage: private krankenversicherung rente

    ReplyDelete
  4. It's actually a nice and helpful piece of information. I'm happy
    that you just shared this helpful information with us.
    Please stay us informed like this. Thanks for sharing.


    My website ... very bad credit home loan

    ReplyDelete
  5. hey there and thank you for your info – I have definitely picked up something new from right here.
    I did however expertise some technical issues using this website,
    as I experienced to reload the site a lot of times previous to I could get it to load properly.
    I had been wondering if your web hosting is OK?
    Not that I am complaining, but sluggish loading instances
    times will very frequently affect your placement in google and could damage your high quality score if ads and
    marketing with Adwords. Well I am adding this RSS to my e-mail
    and can look out for much more of your respective
    exciting content. Make sure you update this again very soon.


    my blog post; import export business opportunities
    My page: hot new business trends

    ReplyDelete
  6. My brother recommended I might like this web
    site. He was totally right. This post actually made my
    day. You can not imagine simply how much time I had spent for this information!

    Thanks!

    Feel free to surf to my web-site: hawaii big island vacation

    ReplyDelete
  7. Fine way of describing, and good post to take data on the topic of my presentation focus, which i am going to convey in school.


    Also visit my website verträge ohne schufa

    ReplyDelete
  8. I must thank you for the efforts you have put in penning this blog.
    I am hoping to view the same high-grade blog posts from you in the future
    as well. In truth, your creative writing abilities
    has encouraged me to get my very own website now ;)

    Here is my webpage earn money with clickbank

    ReplyDelete
  9. I was very pleased to find this website.
    I need to to thank you for your time for this fantastic read!
    ! I definitely enjoyed every little bit of
    it and i also have you saved as a favorite
    to see new things in your site.

    Also visit my web-site; fred perry online outlet

    ReplyDelete
  10. Great post. I was checking continuously this blog and I am
    impressed! Extremely helpful information particularly the last part :) I care
    for such info a lot. I was looking for this particular information for a very long time.
    Thank you and good luck.

    Feel free to visit my web blog: student loan consolidation Best

    ReplyDelete
  11. Hi to every , for the reason that I am really
    eager of reading this web site's post to be updated daily. It includes nice material.

    Here is my web site :: seo australia

    ReplyDelete
  12. I'm extremely pleased to discover this page. I want to to thank you for ones time due to this fantastic read!! I definitely enjoyed every little bit of it and I have you book-marked to see new information on your blog.

    my web-site; Best Reseller Hosting Plans 2012

    ReplyDelete
  13. Howdy would you mind letting me know which hosting company you're utilizing? I've loaded your
    blog in 3 different browsers and I must say this blog loads a
    lot quicker then most. Can you suggest a good hosting provider at a reasonable price?
    Many thanks, I appreciate it!

    Feel free to surf to my site; low credit home loans

    ReplyDelete
  14. Good post. I absolutely love this site. Stick with it!



    Stop by my page home mortgage loans

    ReplyDelete
  15. Wow, this piece of writing is nice, my sister is analyzing
    these kinds of things, therefore I am going
    to convey her.

    Check out my webpage krankenversicherung gesetzlich vergleich

    ReplyDelete
  16. Hi to every one, the contents existing at this web page are actually awesome for people experience, well, keep up the good work fellows.


    my site: largest affiliate programs

    ReplyDelete
  17. I know this web page offers quality based articles and extra
    data, is there any other web page which gives such data in quality?



    Look into my weblog: all inclusive packages

    ReplyDelete
  18. Hey! I could have sworn I've been to this website before but after checking through some of the post I realized it's new to me.

    Anyhow, I'm definitely happy I found it and I'll be
    bookmarking and checking back frequently!

    Also visit my blog bad credit help

    ReplyDelete
  19. Pretty! This has been an extremely wonderful article.
    Thanks for supplying this info.

    My site: private krankenversicherung gehalt

    ReplyDelete
  20. I don't know whether it's just me or if everybody else encountering issues with your site.
    It appears like some of the written text within your posts are
    running off the screen. Can somebody else please provide
    feedback and let me know if this is happening to them too?

    This could be a issue with my internet browser because
    I've had this happen before. Kudos

    Have a look at my weblog :: refinance home mortgage with bad credit

    ReplyDelete
  21. I have been exploring for a bit for any high-quality articles or weblog posts on this sort
    of house . Exploring in Yahoo I finally stumbled upon this
    website. Studying this info So i am happy to convey that I've a very just right uncanny feeling I found out exactly what I needed. I such a lot indisputably will make sure to do not fail to remember this web site and give it a look regularly.

    Feel free to visit my site; günstige online kredite

    ReplyDelete
  22. Your ѕtуlе iѕ uniquе сompared to
    other рееps I have reaԁ stuff frοm.

    Τhank уοu fοг postіng when you've got the opportunity, Guess I'll juѕt book mark this pаge.


    Here is mу wеbsitе - long term money loans

    ReplyDelete
  23. This design is wicked! You certainly know how to keep a reader amused.
    Between your wit and your videos, I was almost moved to
    start my own blog (well, almost...HaHa!) Excellent job.
    I really enjoyed what you had to say, and more than that,
    how you presented it. Too cool!

    My site; guenstig-urlaubmachen.com

    ReplyDelete