Click here to Skip to main content
15,925,400 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Propegating System Varaiables Pin
Guinness4Strength2-Jun-05 9:39
Guinness4Strength2-Jun-05 9:39 
GeneralRe: Propegating System Varaiables Pin
Blake Miller2-Jun-05 14:11
Blake Miller2-Jun-05 14:11 
GeneralHandle maps Pin
Budric B.2-Jun-05 4:37
Budric B.2-Jun-05 4:37 
GeneralRe: Handle maps Pin
S. Senthil Kumar2-Jun-05 5:58
S. Senthil Kumar2-Jun-05 5:58 
GeneralRe: Handle maps Pin
Budric B.2-Jun-05 6:15
Budric B.2-Jun-05 6:15 
GeneralRe: Handle maps Pin
S. Senthil Kumar2-Jun-05 6:54
S. Senthil Kumar2-Jun-05 6:54 
GeneralShell programming problem, about context menu Pin
scchan19842-Jun-05 4:36
scchan19842-Jun-05 4:36 
GeneralKinda new...need help Pin
Matthew Devine2-Jun-05 4:31
Matthew Devine2-Jun-05 4:31 
Alright I'm alittle new to this whole business and was wondering if I could get some help adding code to an existing project. I already have most of the code that needs to be added I'm just not quite sure what specifics need to be edited.

void CMFToolbar::SetOpenLoadProxy()
{
const char* conn_name="DefaultConnectionSettings";
const char* proxy_full_addr = "localhost:5115";

INTERNET_PER_CONN_OPTION_LIST list;
DWORD flag ;
if ( InternetGetConnectedState ( &flag, NULL ) )
{
if ( flag & INTERNET_CONNECTION_PROXY )
{
SetDefaultProxy();
}else
{
DWORD dwBufSize = sizeof(list);
// Fill out list struct.
list.dwSize = sizeof(list);
// NULL == LAN, otherwise connectoid name.
list.pszConnection = (LPTSTR)conn_name;
// Set three options.
list.dwOptionCount = 3;
list.pOptions = new INTERNET_PER_CONN_OPTION[3];
// Make sure the memory was allocated.
if(NULL == list.pOptions)
{
// Return FALSE if the memory wasn't allocated.
OutputDebugString("failed to allocat memory in SetConnectionOptions()");
}

// Set flags.
list.pOptions[0].dwOption = INTERNET_PER_CONN_FLAGS;
list.pOptions[0].Value.dwValue = PROXY_TYPE_DIRECT |
PROXY_TYPE_PROXY;

// Set proxy name.
list.pOptions[1].dwOption = INTERNET_PER_CONN_PROXY_SERVER;
list.pOptions[1].Value.pszValue = (LPTSTR)proxy_full_addr;//"http://proxy:80";

// Set proxy override.
list.pOptions[2].dwOption = INTERNET_PER_CONN_PROXY_BYPASS;
list.pOptions[2].Value.pszValue = "localhost; 127.0.0.1";

// Set the options on the connection.
InternetSetOption(NULL,INTERNET_OPTION_PER_CONNECTION_OPTION, &list, dwBufSize);

// Free the allocated memory.
delete [] list.pOptions;
InternetSetOption(NULL, INTERNET_OPTION_SETTINGS_CHANGED, NULL, 0);
InternetSetOption(NULL, INTERNET_OPTION_REFRESH , NULL, 0);
}
}

The following code is code I was given that will apparently scan a properties file for two specific fields. I know I need to add the code to open the file but I'm not sure what I would need to do after that?

char* whitespace_ltrim(char * pszSource)
{
char* cp = pszSource;
if (cp && *cp) {
while (isspace(*cp)) ++cp;
if (cp != pszSource) memcpy(pszSource, cp, (strlen(cp)+1)*sizeof(char));
}
return pszSource;
}

char* whitespace_rtrim(char* pszSource)
{
char* cp = pszSource;
if (cp && *cp) {
int bNonSpaceSeen = 0;

/* check if string is blank */
while (*cp){
if (!isspace(*cp)) bNonSpaceSeen = 1;
++cp;
}

if (bNonSpaceSeen){
--cp;
/* find last non-whitespace character */
while ((cp >= pszSource) && (isspace(*cp)))
*cp-- = '\0';
}
else{
/* string contains only whitespace characters */
*pszSource = '\0';
}
}
return pszSource;
}

char* whitespace_trim(char* pszSource) {
return whitespace_ltrim(whitespace_rtrim(pszSource));
}

/* psuedo code for reading a properties file */

void load_properties(void* config, char* file) {

char *name = NULL, *value = NULL, *eq_idx = NULL;
while( 1 ) {
/* get the next line */
char* line = NULL;
line = whitespace_ltrim(line);
if ( line != NULL && *line != '#' && (eq_idx = strchr(line, '=')) != NULL ) {
*eq_idx = '\0';
name = whitespace_trim(line);
value = whitespace_trim(eq_idx+1);
if ( strcasecmp("openload.proxy.host",name) == 0) {
/* strcpy(config->proxy_host,value); */
}
else if ( strcasecmp("openload.proxy.port",name) == 0) {
/* strcpy(config->proxy_port,value); */
}
}
}
}
GeneralCStatic question ( dumb friday question ) Pin
Maximilien2-Jun-05 4:03
Maximilien2-Jun-05 4:03 
GeneralRe: CStatic question ( dumb friday question ) Pin
Cedric Moonen2-Jun-05 4:07
Cedric Moonen2-Jun-05 4:07 
GeneralRe: CStatic question ( dumb friday question ) Pin
Tom Archer2-Jun-05 4:20
Tom Archer2-Jun-05 4:20 
GeneralRe: CStatic question ( dumb friday question ) Pin
Maximilien2-Jun-05 5:27
Maximilien2-Jun-05 5:27 
GeneralRe: CStatic question ( dumb friday question ) Pin
Maximilien2-Jun-05 5:48
Maximilien2-Jun-05 5:48 
GeneralRe: CStatic question ( dumb friday question ) Pin
Tom Archer2-Jun-05 5:57
Tom Archer2-Jun-05 5:57 
GeneralRe: CStatic question ( dumb friday question ) Pin
Maximilien2-Jun-05 7:25
Maximilien2-Jun-05 7:25 
GeneralRe: CStatic question ( dumb friday question ) Pin
Tom Archer2-Jun-05 9:46
Tom Archer2-Jun-05 9:46 
GeneralRe: CStatic question ( dumb friday question ) Pin
Maximilien2-Jun-05 11:48
Maximilien2-Jun-05 11:48 
GeneralRe: CStatic question ( dumb friday question ) Pin
Tom Archer2-Jun-05 10:02
Tom Archer2-Jun-05 10:02 
QuestionWhat shuld I do to grab any audio data from sound card? Pin
ytod2-Jun-05 4:02
ytod2-Jun-05 4:02 
Generalsame project to build dll and static lib Pin
Chintoo7232-Jun-05 3:48
Chintoo7232-Jun-05 3:48 
GeneralRe: same project to build dll and static lib Pin
Ravi Bhavnani2-Jun-05 5:16
professionalRavi Bhavnani2-Jun-05 5:16 
GeneralRe: same project to build dll and static lib Pin
liquid_2-Jun-05 7:20
liquid_2-Jun-05 7:20 
GeneralActiveX Pin
racing572-Jun-05 3:35
racing572-Jun-05 3:35 
QuestionHow to get the deleted character Pin
Veera Raghavendra2-Jun-05 3:12
Veera Raghavendra2-Jun-05 3:12 
AnswerRe: How to get the deleted character Pin
Cedric Moonen2-Jun-05 3:17
Cedric Moonen2-Jun-05 3:17 

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.