May 02, 2024, 07:06:49 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Bug

Started by Parker, January 14, 2006, 06:16:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Parker

Bug
January 14, 2006, 06:16:53 PM Last Edit: January 14, 2006, 06:38:03 PM by Parker
Found one more:
Registry::OpenKey(unsigned int hKey, string strSubKey, opt unsigned int dwOptions=CCL_ALL_ACCESS)
{
RegOpenKeyEx(
hKey,
strSubKey,
0,
dwOptions,
m_hKey);
}

QuoteCompiling...
Registry.src
File: C:\dev\ac\Common Classes\Registry.src (155) undefined variable - dwOptions
Error(s) in compiling "C:\dev\ac\Common Classes\Registry.src"

I have a feeling it's a problem with using a constant as the optional parameter.
#define CCL_ALL_ACCESS 0xF003F
I gave it a different prefix (I think the real one is KEY_ALL_ACCESS) to avoid conflicts with the windows API headers in the future.

Edit - nevermind, the problem was that parameter wasn't in the declaration. It was added and it works fine now.

sapero

Parker, the 'opt' keyword should be used only in class/external function definition or in module-local functions

I would change 'string strSubKey' to 'string *strSubKey to avoid problems with null :)
#define CCL_ALL_ACCESS 0xF003F
extern int RegOpenKeyExA(int q,int q,int q,int q,int q);//temp

class Registry
{
declare OpenKey(unsigned int hKey, string *strSubKey, opt unsigned int dwOptions=CCL_ALL_ACCESS);
int m_hKey;
}

Registry::OpenKey(unsigned int hKey, string *strSubKey, unsigned int dwOptions) // no opt
{
RegOpenKeyExA(hKey,strSubKey,0,dwOptions,m_hKey);
}

Parker

I used "" for that, but I'll change it and look for others to allow null, thanks.