Jump to content
  • Advertisement
Sign in to follow this  
codingsmallcat

about LPARAM tranfs to char

This topic is 3717 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello everybody . I want to transform LPARAM to char * in this code LRESULT CALLBACK d3d::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch( msg ) { case WM_CHAR: strcpy(mesgg,(LPCTSTR)lParam); break; case WM_KEYDOWN: if( wParam == VK_ESCAPE ) ::DestroyWindow(hwnd); break; } return ::DefWindowProc(hwnd, msg, wParam, lParam); } but it cant ok. how can I do it? thanks

Share this post


Link to post
Share on other sites
Advertisement
If you're using standard windows messaging, lParam is not a character string or even a character. It's a series of flags.

If you want to display the character, that's wParam. But, remember, it's a single character and not a null-terminated string.

You can try:

case WM_CHAR:
mesgg[0]=wParam;
mesgg[1]=0;


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!