Leonardo Santagada wrote:
I am checking for errors, all the functions exit clearly and yet they don't get/set the values. I used the NetLibConfigSaveAs and saved it to NetPanel so it was supposed to show up in the netpreferences, but it did not. I will try it again today using POL CNetLib and the I will post my findings.
Thanks, Leonardo Santagada
Bellow is the code that I made based in the posts you sent me... but it is getting stuck in the line "ErrAlert(err);" it shows the alert "interface not found" even after I go to network settings and configure an ppp network in the emulator and in the simulator.
CString ConfiguraNet(void) { Err err; UInt16 ifInstance = 0; UInt32 ifCreator; UInt16 currnetIFInstance; UInt16 netRef; NetConfigNamePtr pNetPanelConfN = (NetConfigNamePtr)"NetPanel"; char pszUserName[32],pszPassword[32];
err= SysLibFind("Net.lib",&netRef);
if(err!=errNone) return CString("Erro ao achar NetLib");
UInt16 i = 0;
err = NetLibIFGet(netRef,i,&ifCreator,&currnetIFInstance);
while (err == errNone && ifInstance == 0)
{
if (ifCreator == netIFCreatorPPP)
ifInstance= currnetIFInstance;
i++;
err = NetLibIFGet(netRef,i,&ifCreator,&currnetIFInstance);
}
if(err!=errNone)
{
ErrAlert(err);
return CString("Erro ao tentar achar a IF ppp");
}
StrCat(pszUserName,"Test");
StrCat(pszPassword,"Test");
err = NetLibIFSettingSet(netRef,netIFCreatorPPP,ifInstance,netIFSettingUsername, (void*)pszUserName, StrLen(pszUserName)+1);
if(err!=errNone) return CString("Erro ao setar Username");
err = NetLibIFSettingSet(netRef,netIFCreatorPPP,ifInstance,netIFSettingPassword, (void*)pszPassword, StrLen(pszPassword)+1);
if(err!=errNone) return CString("Erro ao setar Password");
err=NetLibConfigSaveAs(netRef, pNetPanelConfN);
if(err!=errNone) return CString("Erro ao salvar conf");
else return CString("OK");
}
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
