Hello,
this question might appear simple to you but I am wondering why this piece of code does not work - HANDLE gps_handle;
-
gps_handle = GPSOpenDevice(NULL,NULL,NULL,0);
-
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
5 2033
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.
Hello. Thanks for your reply. I thought "(LPCWSTR)gps_handle" already was the way to convert the HANDLE to a string.
What exactly is the difference between "(LPCWSTR)gps_handle" and the method you described?
(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.
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. - int number1;
-
number1 = 2486;
-
string = number2;
-
number2 = number1;
-
-
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
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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 -...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
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....
|
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...
| |