Solved

How do i convert char * to DWORD_PTR or DWORD

Posted on 2006-11-01
5
1,430 Views
Last Modified: 2008-01-09
hi,

How do i convert char * to DWORD_PTR or DWORD
0
Comment
Question by:jyotishb
  • 2
5 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 17855994
Like

char* pc = "42";

DWORD* pdw = (DWORD*) pc;
DWORD dw = (DWORD) pc;

However, without knowing what you are exactly trying to accomplish, use that with caution.
0
 

Author Comment

by:jyotishb
ID: 17856008
well,
i m trying to use this method

void CALLBACK waveInProc(
  HWAVEIN hwi,      
  UINT uMsg,        
  DWORD_PTR dwInstance,  
  DWORD_PTR dwParam1,    
  DWORD_PTR dwParam2    
);



and i need to pass a char * to the instance varialve dwInstance

what would be the best way to do it..



0
 
LVL 86

Accepted Solution

by:
jkr earned 250 total points
ID: 17856034
The way as outlined above. Since that has to be speified whe calling 'waveInOpen()', use it like

waveInOpen( phwi,uDeviceID,&wfx,dwCallback,(DWORD) "test,fdwOpen);

and get it back in the callback as

void CALLBACK my_waveInProc(
  HWAVEIN hwi,      
  UINT uMsg,        
  DWORD_PTR dwInstance,  
  DWORD_PTR dwParam1,    
  DWORD_PTR dwParam2    
)
{
  char* psz = (char*) dwInstance;
}

0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question