Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

demonrealms

Converting from Win32 functoin to MFC

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

Hey, I''ve used this code on Win32 and it works fine. So I know there are things that need to be changed with MFC. So how would I use this command on MFC?
ShellExecute(hwnd, "open",
		"c:\\vice-city-records.txt", NULL, NULL, NULL);
Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
The only change that I would see is that the hwnd parameter would probably come from the window object.

Share this post


Link to post
Share on other sites
That''s what I was thinking but I just got into MFC so I don''t knwo how to tell it what the main window object/handler is. Does anyone know what I could do? Thanks so far.

Share this post


Link to post
Share on other sites
It depends where the function is being called from.
If it is being called from within the Window that you want to own it or the class that owns the CWnd* handle to the main window then you use the function:


GetSafeHwnd();


However, if its being called anywhere else, use:


AfxGetApp()->GetSafeHwnd();


Hope this helps

Share this post


Link to post
Share on other sites

  • 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!