Jump to content
  • Advertisement
Sign in to follow this  
FelipeFS

Translation: Delphi procedure that initialize with message to C++

This topic is 2759 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

I want to convert the traditional way that the Delphi recieves the messages from Windows to C++.

In Delphi, some components have the procedure:

// Prototype inside a class
procedure WMKeyDown(var Message: TWMKeyDown); message WM_KEYDOWN;

// Procedure block
procedure CLASSNAME.WMKeyDown(var Message: TWMKeyDown);
begin
// Code here
end;


But I don't want to traslate to this way:


LRESULT CALLBACK WndProc( HWND Handle, UINT Message, WPARAM wp, LPARAM lp )
{
switch(Message)
{
case WM_KEYDOWN:
// Code here
break;
}
return DefWindowProc(Handle, Message, wp, lp);
}


There is another way to traslate this code to C++, using some directive in the function prototype?

Share this post


Link to post
Share on other sites
Advertisement
Neither C nor C++ have any keywords or directives to make implementing message handlers easier or cleaner. I'm not sure what you're looking to do, but Win32 message callbacks look mostly like what you've posted there, not including the messed up switch statement.

Share this post


Link to post
Share on other sites
Maybe if you told us a little bit more about why you're trying to do this we may be able to help?

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!