Link to home
Start Free TrialLog in
Avatar of Troudeloup
Troudeloup

asked on

no console window while running a program on windows - making it a win32 program a must? how?

I have programs like this one


#include <iostream>
#include <windows.h>
#include <fstream>
#include <string>

using namespace std;




int main ()
{

      string line;
      ifstream file("lines.txt");
      getline(file, line);
      cout << line << endl;
      
      return 0;
}



but it pops  a console window while ran.

is making it a win32 program a solution?

how do I do it with generic c++ code , and compile it with mingw?
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Troudeloup
Troudeloup

ASKER

#include <iostream>
#include <windows.h>
#include <fstream>
#include <string>

using namespace std;



int WINAPI WinMain(
  HINSTANCE hInstance,  // handle to current instance
  HINSTANCE hPrevInstance,  // handle to previous instance
  LPSTR lpCmdLine,      // pointer to command line
  int nCmdShow          // show state of window
)
{

      string line;
      ifstream file("lines.txt");
      getline(file, line);
      cout << line << endl;
     
      return 0;
}









given this, is it possible to pop a msgbox?



also, does it create a tab on the start bar?

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
also, is it possible to display a small cute icon on the clock bar with my own alter alternating graphics?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
is it because once I click the messagebox, the process will end?


because i'd like to have the tab showing permanently when the code is running.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
uh, are you being sarcastic?


or maybe you never pop any box?

but then what did write ?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
uhhhh how about just a boot-to-go tab in the main bar?

(i'll, like, take that for now ;p)
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok i have to ask a lot Qs about that snippet ;p