473,326 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Simple text output on Windows Mobile

Hello,

this question might appear simple to you but I am wondering why this piece of code does not work

Expand|Select|Wrap|Line Numbers
  1. HANDLE gps_handle;
  2. gps_handle = GPSOpenDevice(NULL,NULL,NULL,0);
  3. ExtTextOut(hdc, NULL, NULL, ETO_CLIPPED, NULL, (LPCWSTR)gps_handle, strlen((const char *)gps_handle), NULL );
The only thing I am trying is to see what the value of gps_handle is. Isn't that possible? There are no errors when debugging the code.

Thanks tomtomtom
Nov 3 '07 #1
5 2033
weaknessforcats
9,208 Expert Mod 8TB
A HANDLE is not a string. It is a typedef of a PVOID. That is, a void*.

Just convert your HANDLE to C-string before calling ExtTextOut.
Nov 3 '07 #2
Hello. Thanks for your reply. I thought "(LPCWSTR)gps_handle" already was the way to convert the HANDLE to a string.
Nov 3 '07 #3
What exactly is the difference between "(LPCWSTR)gps_handle" and the method you described?
Nov 4 '07 #4
weaknessforcats
9,208 Expert Mod 8TB
(LPCWSTR)gps_handle is a typecast.

It takes your gps_handle and makes a copy of it identified as a pointer to a constant wide character string. That would be an array of wide characters terminated by a wide null. But it ain't a pointer to a string. gps_handle is a HANDLE that contains an address to somthing. HANDLE is another name for PVOID. PVOID just says "an address".

Should gps_handle actually point to a constant wide character string, then you might be able to display the string by using Unicode functions.

However, GPSOpenDevice() returns a HANDLE to the GPS Intermediate Driver. which I suspect is the address of the thing. The function returns NULL if there was no connection made. Nowhere in here do I see a string.

If you are trying to display the address inside the HANDLE, then you have to convert the HANDLE to a string and then display the string.
Nov 4 '07 #5
Hi,

I know you are really trying to explain this to me very clearly. I think I got most of it in theory but still I can't get a type conversion working. I have even tried only to Output an Integer with ExtTextOut but I don't know how to convert or cast it correctly.

Expand|Select|Wrap|Line Numbers
  1. int number1;
  2. number1 = 2486;
  3. string = number2;
  4. number2 = number1;
  5.  
  6. ExtTextOut(hdc, NULL, NULL, ETO_CLIPPED, NULL, (LPWSTR)number2, 4, NULL);
Sorry, I know this might all be totally wrong. You were right about the Handle. I really wanted to display its address - just for debugging puposes.

Thanks tom
Nov 6 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Frances | last post by:
at work we switched to UTF-16 encoding and now when I open html files in HomeSite the code is all messed up, and if I turn on "enable non-ANSI file encoding" code looks fine when I open files but I...
0
by: Nick White [MSFT] | last post by:
Hello fellow Microsoft Windows Mobile and Embedded enthusiasts: I invite you to peruse the list below of upcoming technical chats and Webcasts offered by the Windows Mobile and Embedded Devices...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
4
by: bob lambert | last post by:
Help I am trying to deploy to another pc a vb.net std 2002 windows form application. I am confused. I created a project - windows form I built form, compiled and debugged. I created a...
2
by: iwdu15 | last post by:
hey, i was wondering if 1) anyone could tell me whats wrong with my code, i did a little fixing to the msdn version fo this, or 2) how to make a simple program that will connect and listen for...
1
by: www.web20developers.com | last post by:
http://www.web20developers.com http://www.web20developers.com/index.php?option=com_content&task=view... Ajallerix : AJAX, simple, fast Web image gallery demo ; at Novell AJAX -...
0
by: Hugh Janus | last post by:
This is driving me crazy! It should be so simple! Can anyone tell me what is going wrong? All I am doing is adding a single button to a form but it fails :-( I am using VB.NET 2005 to create...
0
by: =?Utf-8?B?Q2hhcmxlcw==?= | last post by:
Like many people, I normally use Yahoo! Mail via the web and like to keep all my emails stored on the Yahoo! server. However sometimes I can’t get access to a PC/the web and I download my emails...
1
by: =?Utf-8?B?UmV4RWFzdA==?= | last post by:
Hi, I am making my first Windows Mobile app, a simple countdown timer for my Windows Mobile 6.1 Pocket PC (in C#). The alarm works fine in general. However, if I've let my Pocket PC sit idle for...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.