Hi! LabWindows/CVI Engineer !
I need your help!
I'm trying to access win.ini file with Win32 API. As you know, GetProfileString and GetProfileStringEx function allow to access win.ini file.
WriteProfileString function is working well and i check text with notepad s/w.
But i can't access data with win32 api(GetProfileString, GetProfileStringEx).
When i checked with debugging, i found all zero string. i will atach sample source.
and i try to access registry.
but registry access function isn't working neither.
I'm wating your quick response.
OS : WinXP SP2
LabWindows/CVI : 8.1.0
Compile Option : default
void GetProfile(void)
{
DWORD lRetValue = 0,lRet=0;
char szTmp[1024];
memset(szTmp,0,sizeof(szTmp));
lRet = GetProfileString("Test","Item1","Not Define",szTmp,lRetValue); // No Return data (All zero)
SetCtrlVal(panelHandle,PANEL_STRING_READ,szTmp);
}
void WriteProfile(void)
{
char szTmp[1024];
DWORD lRet = 0;
memset(szTmp,0,sizeof(szTmp));
GetCtrlVal(panelHandle,PANEL_STRING_WRITE,szTmp);
lRet = WriteProfileString("Test","Item1",szTmp); // Ok write to win.ini file
}
void GetRegisty(char *pszCompany)
{
u32 lRetValue = 0,lRet=0;
char szTmp[1024];
HKEY hApp = NULL;
DWORD lType = REG_SZ;
memset(szTmp,0,sizeof(szTmp));
if(RegOpenKeyEx(HKEY_CURRENT_USER,"Software\\Application\\Name",0,KEY_ALL_ACCESS,&hApp)
!= ERROR_SUCCESS)
return;
lRetValue = 0;
lRet = RegQueryValueEx(hApp,"Company",NULL,
&lType,(LPBYTE)pszCompany,&lRetValue);
if(hApp != NULL)
RegCloseKey(hApp);
}