• Advertisement

Archived

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

Converting from Win32 functoin to MFC

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