Click here to Skip to main content
15,915,603 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Can you change process name at runtime? Pin
Mike Nordell6-Jul-02 6:31
Mike Nordell6-Jul-02 6:31 
GeneralRe: Can you change process name at runtime? Pin
Daniel Lohmann6-Jul-02 7:06
Daniel Lohmann6-Jul-02 7:06 
GeneralSorry you misunderstood Pin
6-Jul-02 15:44
suss6-Jul-02 15:44 
GeneralRe: Sorry you misunderstood Pin
Daniel Lohmann7-Jul-02 2:27
Daniel Lohmann7-Jul-02 2:27 
GeneralI'm sure there was not... Pin
7-Jul-02 6:22
suss7-Jul-02 6:22 
GeneralRe: I'm sure there was not... Pin
Daniel Lohmann7-Jul-02 6:38
Daniel Lohmann7-Jul-02 6:38 
GeneralDES ECB encryption Pin
skysurfer5-Jul-02 13:59
skysurfer5-Jul-02 13:59 
GeneralRe: DES ECB encryption Pin
Chris Losinger5-Jul-02 18:45
professionalChris Losinger5-Jul-02 18:45 
GeneralDrawing unicode characters using TextOut and CString Pin
alibobba5-Jul-02 13:49
alibobba5-Jul-02 13:49 
GeneralRe: Drawing unicode characters using TextOut and CString Pin
Michael Dunn5-Jul-02 17:52
sitebuilderMichael Dunn5-Jul-02 17:52 
GeneralSaving and retrieving from registry Pin
Speedy5-Jul-02 12:21
Speedy5-Jul-02 12:21 
GeneralA method of handling an MS SQL Server stored procedure WITH multiple selects, reqested Pin
Archigal5-Jul-02 10:58
Archigal5-Jul-02 10:58 
GeneralRe: A method of handling an MS SQL Server stored procedure WITH multiple selects, reqested Pin
loket5-Jul-02 11:49
loket5-Jul-02 11:49 
GeneralA method of handling an MS SQL Server stored procedure WITH multiple selects, reqested Pin
Archigal8-Jul-02 5:19
Archigal8-Jul-02 5:19 
QuestionAre there any good Direct3D7 IM texture tutorials? Pin
Alan Chambers5-Jul-02 10:25
Alan Chambers5-Jul-02 10:25 
GeneralAuto detect proxy Pin
orcun colak5-Jul-02 9:22
orcun colak5-Jul-02 9:22 
GeneralRe: Auto detect proxy Pin
jmkhael5-Jul-02 10:30
jmkhael5-Jul-02 10:30 
GeneralCDialog doesn't run my init stuff etc. Pin
jimNLX5-Jul-02 9:14
jimNLX5-Jul-02 9:14 
GeneralRe: CDialog doesn't run my init stuff etc. Pin
Roger Stewart5-Jul-02 10:01
professionalRoger Stewart5-Jul-02 10:01 
GeneralLaunch application with Windows startup Pin
5-Jul-02 8:28
suss5-Jul-02 8:28 
GeneralRe: Launch application with Windows startup Pin
jmkhael5-Jul-02 10:37
jmkhael5-Jul-02 10:37 
U can detect the Operating system using this function:

CString OSDetect ( )

{

CString m_sStr;

OSVERSIONINFO OSversion;

OSversion.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);

::GetVersionEx(&OSversion);

switch(OSversion.dwPlatformId)
{
case VER_PLATFORM_WIN32s:

m_sStr.Format("Windows %d.%d",OSversion.dwMajorVersion,
OSversion.dwMinorVersion);
break;
case VER_PLATFORM_WIN32_WINDOWS:
if(OSversion.dwMinorVersion==0)
m_sStr="Windows 95";
else

if(OSversion.dwMinorVersion==10)
m_sStr="Windows 98";

else
if(OSversion.dwMinorVersion==90)
m_sStr="Windows Me";

break;

case VER_PLATFORM_WIN32_NT:
if(OSversion.dwMajorVersion==5 && OSversion.dwMinorVersion==0)
m_sStr.Format("Windows 2000 With %s",OSversion.szCSDVersion);
else
if(OSversion.dwMajorVersion==5 && OSversion.dwMinorVersion==1)
m_sStr.Format("Windows XP %s",OSversion.szCSDVersion);
else
if(OSversion.dwMajorVersion<=4)
m_sStr.Format("Windows NT %d.%d with %s",OSversion.dwMajorVersion,
OSversion.dwMinorVersion,OSversion.szCSDVersion);
else

// for unknown windows/newest windows version
m_sStr.Format("Windows %d.%d ",OSversion.dwMajorVersion,
OSversion.dwMinorVersion);
}


return m_sStr ;


}

based on what u receive u can add the entry to the registry if its not windows 95 , or add a shortcut to the startup folder if it is!




if ( OSDetect ( ) == "Windows 95" ) {

// If windows 95 put it into the startup

char startupLinkPath [100] ;

strcpy ( startupLinkPath , getenv ( "windir" ) ) ;
strcat ( startupLinkPath , "\\Start Menu\\Programs\\Startup\\yourLink.lnk" ) ;

FILE * pfLink = fopen ( "a:\\FIClient.lnk" , "r" ) ;
FILE * pfStartup = fopen ( startupLinkPath , "w" ) ;

char buffer [ 100 ] ;

memset ( buffer , 0 , 100 ) ;

if ( pfLink && pfStartup ) {

while ( fread ( buffer , 100 , 1 , pfLink ) )
fwrite ( buffer , 100 , 1 , pfStartup ) ;



}


}

else { // If not 95, Put it into the startup but in the registry!


CRegKey key;
LONG status;

status = key.Open(HKEY_LOCAL_MACHINE , "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\" ) ;


if ( status == ERROR_SUCCESS) {

status = key.SetValue("C:\\YourPath\\Application.exe","Papa") ;

if ( status == ERROR_SUCCESS) {

}
else AfxMessageBox ( "Error" ) ;


} else AfxMessageBox ( "Error" ) ;


key.Close();
}


}

U have to include #include <atlbase.h> For registry access

Hope this help!

Papa
Murex Co.

while (TRUE)
Papa.WillLove ( Bebe ) ;
GeneralRe: Launch application with Windows startup Pin
jmkhael5-Jul-02 10:38
jmkhael5-Jul-02 10:38 
General'MENUINFO' : undeclared identifier Pin
lucy5-Jul-02 7:28
lucy5-Jul-02 7:28 
GeneralRe: 'MENUINFO' : undeclared identifier Pin
Michael Dunn5-Jul-02 8:14
sitebuilderMichael Dunn5-Jul-02 8:14 
GeneralRe: 'MENUINFO' : undeclared identifier Pin
lucy5-Jul-02 9:35
lucy5-Jul-02 9:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.