troubleshooting Question

A simple problem involving pointers.

Avatar of catma
catma asked on
12 Comments2 Solutions292 ViewsLast Modified:
I am trying to get the name of a window, given the handle. I don't know much C, but I learned Perl before, so variables and basic concepts are not foreign to me. The pointers are a problem though. Can you tell we what is wrong with this code? i only get (null) as the output. im pretty sure this is lousy code too, how would u write it?
how would i get the hex representation of the pointer, like 0xFFFFCCCC?
is the handle supposed to be in decimal or hex? both give me (null)
also, is:
printf("%s", (char *) Pointer);
   the same as:
printf("%s",  Buffer);?


char Buffer;
char * Pointer;
HWND hWnd;
char szWindowHandle;

Pointer = &Buffer;

gets( szWindowHandle );  
hWnd = (HWND) szWindowHandle;

GetWindowText(hWnd, Pointer, 25);

printf("Window name is %s\n ", Buffer);
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 12 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros