Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Adapting a console C++/Fortran code into win32 app.
New Posts  All Forums:Forum Nav:

Adapting a console C++/Fortran code into win32 app.

post #1 of 2
Thread Starter 
Hey all,

I'm doing a university project - thus far I have created a fortran program (~500 lines) which does a numerical calculation of hydrofoil lift and drag. And a C++ program which calls the fortran subroutines and runs a Genetic Algorithm.

It's been hard enough getting a mixed programming language to run, I am a complete beginner when it comes to the world of compilers, linkers, libraries.. etc. I've had quite a crash course to get this far in 3 weeks!

I am using the GCC compilers (g++ for c++; gfortran for fortran; linking with gfortran with C++ libraries).

I started off using an editor program called "Simply Fortran", I think I have outgrown it now, but still. I'm compiling through makefiles rather than command line prompts.

Now that the program is working, I have the option and the opportunity to create a windows app. I am trying to follow the tutorials on http://www.winprog.org/tutorial/start.html with a lot of trouble.

I don't really want to use any sort of special program (such as VC++) to help create the code, because I know my compilers work well for mixing fortran and C++.

I think I have nailed the fundamentals - Winmain() with message loop, Windproc with command lists. I have a .rc file to define my resources which compiles correctly, and a resource.h file to define IDs.

I'm really looking for advice in how to use the windows API easily, as I dont have long to learn how to do this. All I require from the windows app is the ability to:

- Open a dialog from a menu item where I can input variables
- Run the program from a menu item
- Output graphical results in the main window, which updates as the program runs.
- Have a small text box under the graph which I can print to (similar to the use of PRINT * and cout <<) as if it were the console.


Many thanks if you can offer any advice. And if you think I'm nuts, please tell me so tongue.gif
PAROXYSM
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom x4 II 965 GA-990FXA-UD3 XFX HD 4870 1GB Corsair (12gb) 
Hard DriveHard DriveCoolingOS
2x1TB Caviar Black OCZ Vertex 60gb H50 W7 64-bit / Fedora 17 64-bit 
MonitorKeyboardPowerMouse
V7 22" Logitech Deluxe 250 Antec TruePower 750W Modular Razer Lachesis 
Mouse Pad
None 
  hide details  
Reply
PAROXYSM
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom x4 II 965 GA-990FXA-UD3 XFX HD 4870 1GB Corsair (12gb) 
Hard DriveHard DriveCoolingOS
2x1TB Caviar Black OCZ Vertex 60gb H50 W7 64-bit / Fedora 17 64-bit 
MonitorKeyboardPowerMouse
V7 22" Logitech Deluxe 250 Antec TruePower 750W Modular Razer Lachesis 
Mouse Pad
None 
  hide details  
Reply
post #2 of 2
Thread Starter 
I have a feel this wont get any more respones, but nonetheless...

I've created a funky little win32 app now, using windows API. The problem is that I've called a large chunk of numeric code straight off a control (Menu -> run) and the UI freezes when it starts to run, since the message loop is on hold.

How can I start a worker thread (preferably in a way that I can just wrap around the code I've created)?
Code:
case ID_CONTROLS_RUN:
                {
                 // Big calculations (up to 30 seconds).... //
                InvalidateRect(hwnd, &prc, true);
                UpdateWindow(hwnd);
                }
break;
PAROXYSM
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom x4 II 965 GA-990FXA-UD3 XFX HD 4870 1GB Corsair (12gb) 
Hard DriveHard DriveCoolingOS
2x1TB Caviar Black OCZ Vertex 60gb H50 W7 64-bit / Fedora 17 64-bit 
MonitorKeyboardPowerMouse
V7 22" Logitech Deluxe 250 Antec TruePower 750W Modular Razer Lachesis 
Mouse Pad
None 
  hide details  
Reply
PAROXYSM
(13 items)
 
  
CPUMotherboardGraphicsRAM
Phenom x4 II 965 GA-990FXA-UD3 XFX HD 4870 1GB Corsair (12gb) 
Hard DriveHard DriveCoolingOS
2x1TB Caviar Black OCZ Vertex 60gb H50 W7 64-bit / Fedora 17 64-bit 
MonitorKeyboardPowerMouse
V7 22" Logitech Deluxe 250 Antec TruePower 750W Modular Razer Lachesis 
Mouse Pad
None 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Coding and Programming
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Adapting a console C++/Fortran code into win32 app.