Click here to Skip to main content
15,897,968 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow "Winmain()" works in MFC? and From where it is called? Pin
Sethuraman.K10-Oct-07 19:50
Sethuraman.K10-Oct-07 19:50 
AnswerRe: How "Winmain()" works in MFC? and From where it is called? Pin
Nibu babu thomas10-Oct-07 20:01
Nibu babu thomas10-Oct-07 20:01 
GeneralRe: How "Winmain()" works in MFC? and From where it is called? Pin
Sethuraman.K10-Oct-07 20:07
Sethuraman.K10-Oct-07 20:07 
AnswerRe: How "Winmain()" works in MFC? and From where it is called? Pin
David Crow11-Oct-07 3:36
David Crow11-Oct-07 3:36 
QuestionRegistry Restore Using A Service Pin
nagadravid10-Oct-07 19:35
nagadravid10-Oct-07 19:35 
AnswerRe: Registry Restore Using A Service Pin
vipin_nvk10-Oct-07 21:09
vipin_nvk10-Oct-07 21:09 
QuestionHelp:Multi-threading Pin
himuskanhere10-Oct-07 19:26
himuskanhere10-Oct-07 19:26 
QuestionUuidFromString not creating GUID correctly - Help! Pin
Priya_Sundar10-Oct-07 19:10
Priya_Sundar10-Oct-07 19:10 
In this function i am trying to disable the dchp in the adapter register key.
Also i am notify the NICs driver that the settings have changed.


bool CTcpIpPropertiesChangerApp::DisableDchp()
{
char szValue[MAX_GUID_STRING_LEN];
CString str,str2;
DWORD pdw=99;
CRegKey key,key2;

for(int flag=1;flag<=100;flag++)
{
str.Format("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards\\%d",flag);

if(key.Open(HKEY_LOCAL_MACHINE,str,KEY_READ|KEY_WRITE)==ERROR_SUCCESS)
{
key.QueryValue(szValue,"ServiceName",&pdw);
key.Close();

str.Format("SYSTEM\\CurrentControlSet\\Services\\TcpIp\\Parameters\\Interfaces\\%s",szValue);


key.Open(HKEY_LOCAL_MACHINE,str,KEY_WRITE);

key.Open(HKEY_LOCAL_MACHINE,str,KEY_WRITE);

DWORD keyy=0;
::RegSetValueEx(key.m_hKey,"EnableDHCP",0,REG_DWORD,(PBYTE) &keyy,sizeof(PDWORD));

key.Close();

HDEVINFO hDevInfo = SetupDiGetClassDev (NULL,NULL,NULL,DIGCF_ALLCLASSES);
if( INVALID_HANDLE_VALUE == hDevInfo )
{
AfxMessageBox("Error :SetupDiGetClassDevs()");
return FALSE;
}

//An SP_PROPCHANGE_PARAMS structure corresponds to a DIF_PROPERTYCHANGE installation request.
SP_PROPCHANGE_PARAMS spPropChangeParams;
spPropChangeParams.ClassInstallHeader.cbSize = sizeof(SP_CLASSINSTALL_HEADER);
spPropChangeParams.ClassInstallHeader.InstallFunction = DIF_PROPERTYCHANGE;
spPropChangeParams.Scope = DICS_FLAG_GLOBAL;
spPropChangeParams.StateChange = DICS_DISABLE;
spPropChangeParams.HwProfile = 0;

//An SP_DEVINFO_DATA structure defines a device instance that is a member of a device information set.
SP_DEVINFO_DATA spDevInfoData;

spDevInfoData.cbSize = sizeof(SP_DEVINFO_DATA);

for (int k=0;SetupDiEnumDeviceInfo(hDevInfo,k,&spDevInfoData);k++)
{
unsigned char GuidString[MAX_GUID_STRING_LEN];
GuidString[MAX_GUID_STRING_LEN - 2] = _T('\0');

for(int l=0;l<max_guid_string_len;l++)
guidstring[l]="szValue[l];

" guid="" ret;
="" uuidfromstring(&guidstring[1],="" &ret);

="" if(spdevinfodata.classguid="=" ret="" )
="" {
="" setupdisetclassinstallparams="" sets="" or="" clears="" class="" install="" parameters="" for="" a="" device="" information="" set="" particular="" element.=""
="" if="" (="" setupdisetclassinstallparams(hdevinfo,="" &spdevinfodata,="" (sp_classinstall_header="" *)&sppropchangeparams,="" sizeof(sppropchangeparams))="=" false)="" setupdidestroydeviceinfolist="" (hdevinfo);
="" return="" false;="" }

="" setupdicallclassinstaller="" calls="" the="" appropriate="" installer,="" and="" any="" registered="" co-installers,="" with="" specified="" installation="" request="" (dif="" code).
="" (setupdicallclassinstaller(dif_propertychange,="" hdevinfo,="" &spdevinfodata)="=FALSE)" }
="" }="" }
}<="" code="">


For this i am trying to create a GUID inside the second for loop where in i get "{CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC}" as 'ret' value instead of {A89377EA-D4ED-4A03-A303-A37F-4A9DE785E1A9} which is the '&GuidString[1]' value.

I think i need to typecast correctly.

Kindly help!

Priya Sundar

AnswerRe: UuidFromString not creating GUID correctly - Help! Pin
Sachinpatole10-Oct-07 19:15
Sachinpatole10-Oct-07 19:15 
GeneralRe: UuidFromString not creating GUID correctly - Help! Pin
Priya_Sundar10-Oct-07 19:27
Priya_Sundar10-Oct-07 19:27 
AnswerRe: UuidFromString not creating GUID correctly - Help! Pin
Nibu babu thomas10-Oct-07 19:36
Nibu babu thomas10-Oct-07 19:36 
GeneralRe: UuidFromString not creating GUID correctly - Help! Pin
Priya_Sundar10-Oct-07 19:43
Priya_Sundar10-Oct-07 19:43 
GeneralRe: UuidFromString not creating GUID correctly - Help! Pin
Nibu babu thomas10-Oct-07 19:47
Nibu babu thomas10-Oct-07 19:47 
GeneralRe: UuidFromString not creating GUID correctly - Help! Pin
Priya_Sundar10-Oct-07 20:34
Priya_Sundar10-Oct-07 20:34 
GeneralRe: UuidFromString not creating GUID correctly - Help! Pin
Nibu babu thomas10-Oct-07 20:37
Nibu babu thomas10-Oct-07 20:37 
GeneralRe: UuidFromString not creating GUID correctly - Help! Pin
Priya_Sundar10-Oct-07 21:07
Priya_Sundar10-Oct-07 21:07 
QuestionWhat is core dump ? Pin
Yashusid10-Oct-07 18:52
Yashusid10-Oct-07 18:52 
QuestionMessagebox problem Pin
Lakshmi_p10-Oct-07 18:41
Lakshmi_p10-Oct-07 18:41 
AnswerRe: Messagebox problem Pin
Sachinpatole10-Oct-07 19:18
Sachinpatole10-Oct-07 19:18 
AnswerRe: Messagebox problem Pin
Nibu babu thomas10-Oct-07 19:31
Nibu babu thomas10-Oct-07 19:31 
GeneralRe: Messagebox problem Pin
Naveen10-Oct-07 20:06
Naveen10-Oct-07 20:06 
GeneralRe: Messagebox problem Pin
Nibu babu thomas10-Oct-07 22:10
Nibu babu thomas10-Oct-07 22:10 
GeneralRe: Messagebox problem Pin
Lakshmi_p10-Oct-07 20:14
Lakshmi_p10-Oct-07 20:14 
QuestionHow to locate application folder? Pin
TooShy2Talk10-Oct-07 15:46
TooShy2Talk10-Oct-07 15:46 
AnswerRe: How to locate application folder? Pin
Naveen10-Oct-07 16:14
Naveen10-Oct-07 16:14 

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.