Click here to Skip to main content
15,901,426 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
GeneralRe: 'MENUINFO' : undeclared identifier Pin
Aaron Schaefer12-Aug-02 9:18
Aaron Schaefer12-Aug-02 9:18 
GeneralRe: 'MENUINFO' : undeclared identifier Pin
lucy13-Aug-02 13:41
lucy13-Aug-02 13:41 
GeneralListview redraw problems Pin
CaesarCZ5-Jul-02 7:13
CaesarCZ5-Jul-02 7:13 
GeneralRe: Listview redraw problems Pin
Michael Dunn5-Jul-02 8:16
sitebuilderMichael Dunn5-Jul-02 8:16 
GeneralRe: Listview redraw problems Pin
[James Pullicino]5-Jul-02 8:23
[James Pullicino]5-Jul-02 8:23 
GeneralRe: Listview redraw problems Pin
CaesarCZ5-Jul-02 8:40
CaesarCZ5-Jul-02 8:40 
GeneralRe: Listview redraw problems Pin
[James Pullicino]5-Jul-02 8:44
[James Pullicino]5-Jul-02 8:44 
GeneralRe: Listview redraw problems Pin
CaesarCZ5-Jul-02 8:56
CaesarCZ5-Jul-02 8:56 
GeneralRe: Listview redraw problems Pin
[James Pullicino]5-Jul-02 11:06
[James Pullicino]5-Jul-02 11:06 
GeneralRe: Listview redraw problems Pin
CaesarCZ5-Jul-02 12:58
CaesarCZ5-Jul-02 12:58 
GeneralRe: Listview redraw problems Pin
CaesarCZ5-Jul-02 23:45
CaesarCZ5-Jul-02 23:45 
GeneralRe: Listview redraw problems Pin
Shog96-Jul-02 17:11
sitebuilderShog96-Jul-02 17:11 
GeneralRe: Listview redraw problems Pin
CaesarCZ7-Jul-02 0:18
CaesarCZ7-Jul-02 0:18 

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.