iphone
asked on
Migrating from win32 APP to MFC
Hi,
Is there any easy way to migrate from application that develop with win32 app to mfc? or have to redo everything in mfc?
Regards
Is there any easy way to migrate from application that develop with win32 app to mfc? or have to redo everything in mfc?
Regards
You need to create application using MFC Application Wizard and rewrite main functions. Only low-level stuff from existing application can be used. For example, if you have drawing function which accepts HDC parameter, you can call it from MFC CWnd::OnPaint passing CDC::m_hDC.
Out of topic: Is it time to move to MFC?
Out of topic: Is it time to move to MFC?
it actually depends on how the wrapper classes were designed. If you have called functions for a certain job when an event was fired then you will find it really easy to migrate the codes from win32App to MFC, cause in that case you will just have to design the user interface and the message maps and call the functions accordingly.
On the other hand if you hardcoded the instructions inside the event messages then you should get prpared for some real hard work.
Nafis
On the other hand if you hardcoded the instructions inside the event messages then you should get prpared for some real hard work.
Nafis
>>Is there any easy way to migrate from application that develop with win32 app to mfc?
If you already have a working application - why would you want to do that?
If you already have a working application - why would you want to do that?
ASKER
Because i want to load external SWF(Flash files) and play in the application, i ever ask this question and the best answer i found is use browser object to open html page which load SWF in there. So far the solution i have to achive this is only support for MFC programming. Is there any other way i could done in Win32 APP? The SWF is external file.
>>>>Is there any easy way to migrate from application that develop with win32 app to mfc?
No, but it shouldn't be a task impossible. If your current application has a main dialog window you should create a dialog-based MFC app by using the Wizard. Then, you should be able to import your current resource-file by copy-paste. Add dialog classes for all dialogs you have and add an appropriate CString member for any edit field. For any button or menu you should add the equivalent item in the resource editor. Finally add (empty) handler functions for any event you currently were handling in the WIN32 app. Key events you better handle by accelerator entries. All drawing issues you should move to OnPaint member function of your diaolg class. Note most WINAPI functions have an equivalent in MFC by simply replacing the handle argument by the class object:
HWND hwnEdit = GetDlgItem(hwndDlg, IDC_EDIT);
SetWindowText(hwndEdit, "Hello World");
==>
myDlg.GetDlgItem(IDC_EDIT) ->SetWindo wText("Hel lo World);
If you call the latter in a member function of MyDlg you can/have to omit the "myDlg." I would recommend to migrate all WINAPI call to the corresponding MFC member call if available.
Always consider that a MFC application is reacting on messages rather than actively controlling the screen. So, don't migrate lengthy parts of your current app but always try keep it short and simple, e. g. send/post messages instead of doing all at one time. Then you can react in a different event handler what makes the app quick and user friendly.
Regards, Alex
No, but it shouldn't be a task impossible. If your current application has a main dialog window you should create a dialog-based MFC app by using the Wizard. Then, you should be able to import your current resource-file by copy-paste. Add dialog classes for all dialogs you have and add an appropriate CString member for any edit field. For any button or menu you should add the equivalent item in the resource editor. Finally add (empty) handler functions for any event you currently were handling in the WIN32 app. Key events you better handle by accelerator entries. All drawing issues you should move to OnPaint member function of your diaolg class. Note most WINAPI functions have an equivalent in MFC by simply replacing the handle argument by the class object:
HWND hwnEdit = GetDlgItem(hwndDlg, IDC_EDIT);
SetWindowText(hwndEdit, "Hello World");
==>
myDlg.GetDlgItem(IDC_EDIT)
If you call the latter in a member function of MyDlg you can/have to omit the "myDlg." I would recommend to migrate all WINAPI call to the corresponding MFC member call if available.
Always consider that a MFC application is reacting on messages rather than actively controlling the screen. So, don't migrate lengthy parts of your current app but always try keep it short and simple, e. g. send/post messages instead of doing all at one time. Then you can react in a different event handler what makes the app quick and user friendly.
Regards, Alex
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No, you need a lot of work.