Console Program to Tray??????



  • Ohh shti 😃 VC++ is so hard...

    Linux, GCC, PowerPC and enigma or VDR is the best 😃 I think, i never do that, thanks for tips, help for all. I need to learn much or some tips need...



  • You need to learn WinApi. why do you use console? All you can use in Console you can use in WinApi and much more!

    MfG schirrmie



  • anyway i see that is another language vc++ then c++

    for example...

    unsigned int username, 
       password, 
       port, 
       configKey;
    
    void read_cfg()
    {
    FILE *fn = fopen("twister.cfg", "r");
     if(fn)
     {
      char buffer[100];
    
      while( fgets(buffer, 100, fn) != NULL )
      {
       sscanf(buffer, "USER= %2d ", &username);
       sscanf(buffer, "PASSWORD= %2d ", &password);
       sscanf(buffer, "PORT= %2d ", &port);
       sscanf(buffer, "CKEY= %2d ", &configKey);
    
      }
      fclose(fn);
     else
         {
      user=0;
      password=0;
      port =0;
      ckey= 0;
         }
    
    }
    int _tmain(int argc, _TCHAR* argv[])
    {
     read_cfg()
     printf(username);
     return 0;
    }
    

    This is working perfectly on linux... here on vc++ it is not commpile....



  • @(D)Evil:
    Sorry, dieser Threat war ne Weile in C++ drinnen, und dort gibt's die Möglichkeit, einen minimierenden Effekt über die Simulation von betriebssystem-spezifischen Tastaturkürzeln mit ISO-C++ zu erzeugen. Da es sich bei der Frage aber um WinAPI handelt, ist das natürlich Schwachsinn. Mir auch klar, dass das natürlich nicht die beste Lösung gewesen wäre, quick and dirty, aber funktionierend. Mein Fehler...

    @Darez:
    Sorry, this threat was located at our C++ category. Under C++ it's possible to minimize the console window with OS-depending shortcuts (application simulates keystrokes). This trick is just a kind of stupid while using WinAPI. I didn't know that you want a WinAPI-solution as I did my post, so excuse me.



  • Darez
    No... VC++ is a standard conform C++ Compiler! One of the best...
    I do not know why you use a integer whether you want to read out a char... i guess that is the Problem... and your style isn't very well:

    #include <iostream>
    #include <conio.h>
    
    typedef struct Config__
    {
    	unsigned int nUsername;
    	unsigned int nPassword;
    	unsigned int nPort;
    	unsigned int nConfigKey;
    }CONFIG, *LPCONFIG;
    
    void ReadConfig(LPCONFIG /*lpConfig*/);
    
    int _tmain(int argc, _TCHAR* argv[])
    {
    	CONFIG cfg;
    	ReadConfig(&cfg);
    
    	std::cout << cfg.nUsername << std::endl;
    
    	getch();
    
    	return 0;
    }
    
    void ReadConfig(LPCONFIG lpConfig)
    { 
    	FILE* pFile = fopen("twister.cfg", "r"); 
    
    	if (!pFile) 
    	{
    		(*lpConfig).nConfigKey	= 0;
    		(*lpConfig).nPassword	= 0;
    		(*lpConfig).nUsername	= 0;
    		(*lpConfig).nPort		= 0;
    
    		return;
    	}
    
    	char cBuffer[100]; 
    
    	while (fgets(cBuffer, 100, pFile)) 
    	{ 
    		sscanf(cBuffer, "USER= %2d ", &(*lpConfig).nUsername); 
    		sscanf(cBuffer, "PASSWORD= %2d ", &(*lpConfig).nPassword); 
    		sscanf(cBuffer, "PORT= %2d ", &(*lpConfig).nPort); 
    		sscanf(cBuffer, "CKEY= %2d ", &(*lpConfig).nConfigKey); 
    	} 
    
    	fclose(pFile); 
    }
    

    But why you do not simply find the solution of your primary project before you do something else?


Anmelden zum Antworten