|
All you need to do is create a dialog class that contains the appropriately named list boxes and copy and paste this function. If you're not capable of that you should NOT be touching code that plays with the registry.
If you really can't create a dialog based project and copy/paste some code, I'd be happy to advise you, but I'm serious about how seriously you can screw Windows if you play with the Registry and don't know what you're doing.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Of cource I can do it all,
how do you think, if I'll be on this forum if I can't create a dialog box?
When I compile it, VC create some errors as:
: error C2660: 'SetDlgItemTextA' : function does not take 3 parameters
: error C2660: 'SetDlgItemInt' : function does not take 4 parameters
: error C2664: 'void __thiscall CWnd::GetDlgItem(int,struct HWND__ ** ) const' : cannot convert parameter 1 from 'struct HWND__ *' to 'int'
: error C2660: 'SendMessageA' : function does not take 4 parameters
: error C2664: 'RegEnumKeyExA' : cannot convert parameter 4 from 'const int' to 'unsigned long *'
: error C2664: 'void __thiscall CWnd::GetDlgItem(int,struct HWND__ ** ) const' : cannot convert parameter 1 from 'struct HWND__ *' to 'int'
: error C2660: 'SendMessageA' : function does not take 4 parameters
: error C2660: 'MessageBoxA' : function does not take 4 parameters
: error C2664: 'void __thiscall CWnd::GetDlgItem(int,struct HWND__ ** ) const' : cannot convert parameter 1 from 'struct HWND__ *' to 'int'
: error C2660: 'SendMessageA' : function does not take 4 parameters
: fatal error C1004: unexpected end of file found
that way ...
And I thought that it will be easy for me to see ready project, becourse I speek english wery bad ... and it will be easy to look throo ready sample.
best regrads ...
==============
www.design.kg
|
|
|
|
|
mmmmmmmmmmmmmmmmmmmmm
That's what happens when you copy/paste API code into MFC projects.
tell you what, all those places where you got errors prefix the function call with ::
That should remove these bugs
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Nish, while this is the cause of his last problem, this MSDN article had serious, serious problems - it simply would not work as it appears in MSDN.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Karavaev Denis wrote:
how do you think, if I'll be on this forum if I can't create a dialog box?
Well, you *did* say Unfortunly, I know C++ to bad to compile it myself.. You'd be amazed at some of the questions we get around here. Most are intelligent but some are just out of control.
C1004 means you either didn't put a final bracket, or you didn't include stdafx.h. The missing bracket is at the end. The HANDLE parameter should be a HKEY. Where the code checks if retValue == ERROR_SUCCESS, it should check for != ERROR_NO_MORE_ITEMS. Where it passes in MAX_PATH to RegEnumValues, it should set a DWORD to = MAX_PATH, pass in a pointer to that variable, and reset the variable to MAX_PATH. I think that was all, but my code follows to make sure. This smaple is SCREWED.
#define MAX_VALUE_NAME 255
VOID QueryKey(HWND hDlg, HKEY hKey)
{
CHAR achKey[MAX_PATH];
CHAR achClass[MAX_PATH] = "";
DWORD cchClassName = MAX_PATH;
DWORD cSubKeys;
DWORD cbMaxSubKey;
DWORD cchMaxClass;
DWORD cValues;
DWORD cchMaxValue;
DWORD cbMaxValueData;
DWORD cbSecurityDescriptor;
FILETIME ftLastWriteTime;
DWORD i, j;
DWORD retCode, retValue;
CHAR achValue[MAX_VALUE_NAME];
DWORD cchValue = MAX_VALUE_NAME;
CHAR achBuff[80];
RegQueryInfoKey(hKey,
achClass,
&cchClassName,
NULL,
&cSubKeys,
&cbMaxSubKey,
&cchMaxClass,
&cValues,
&cchMaxValue,
&cbMaxValueData,
&cbSecurityDescriptor,
&ftLastWriteTime);
SendMessage(GetDlgItem(hDlg, IDL_LISTBOX),
LB_ADDSTRING, 0, (LONG) "..");
DWORD dwLength = MAX_PATH;
SetCursor(LoadCursor(NULL, IDC_WAIT));
for (i = 0, retCode = ERROR_SUCCESS;
retCode != ERROR_NO_MORE_ITEMS; i++)
{
retCode = RegEnumKeyEx(hKey,
i,
achKey,
&dwLength,
NULL,
NULL,
NULL,
&ftLastWriteTime);
if (retCode != (DWORD)ERROR_NO_MORE_ITEMS)
{
SendMessage(GetDlgItem(hDlg, IDL_LISTBOX),
LB_ADDSTRING, 0, (LONG) achKey);
}
dwLength = MAX_PATH;
}
SetCursor(LoadCursor (NULL, IDC_ARROW));
SetCursor(LoadCursor(NULL, IDC_WAIT));
if (cValues)
{
for (j = 0, retValue = ERROR_SUCCESS;
j < cValues; j++)
{
cchValue = MAX_VALUE_NAME;
achValue[0] = '\0';
retValue = RegEnumValue(hKey, j, achValue,
&cchValue,
NULL,
NULL,
NULL,
NULL);
if (retValue != (DWORD) ERROR_SUCCESS &&
retValue != ERROR_INSUFFICIENT_BUFFER)
{
wsprintf (achBuff,
"Line:%d 0 based index = %d, retValue = %d, "
"ValueLen = %d",
__LINE__, j, retValue, cchValue);
MessageBox (hDlg, achBuff, "Debug", MB_OK);
}
achBuff[0] = '\0';
if (!lstrlen(achValue))
lstrcpy(achValue, "<NO NAME>");
wsprintf(achBuff, "%d) %s ", j, achValue);
SendMessage(GetDlgItem(hDlg,IDL_LISTBOX2),
LB_ADDSTRING, 0, (LONG) achBuff);
}
}
SetCursor(LoadCursor(NULL, IDC_ARROW));
}
and in OnPaint:
CDialog::OnPaint();
HKEY key;
DWORD result;
RegCreateKeyEx(HKEY_CURRENT_USER, _T("Software"), NULL,
NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &key, &result);
ASSERT(REG_OPENED_EXISTING_KEY == result);
QueryKey(m_hWnd, key);
RegCloseKey(key);
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Than you very much for your underasanding
but ... one more:
: error C2664: 'void __thiscall CWnd::GetDlgItem(int,struct HWND__ ** ) const' : cannot convert parameter 1 from 'struct HWND__ *' to 'int'
this error I get with your code?
Is I did wrong something again?
==============
www.design.kg
|
|
|
|
|
For some reason it knows to call ::GetDlgItem for me, but for you it's trying the CWnd:: function of the same name. Preface the function with :: and you'll be fine.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Hello,
I have a class derived from CFrameWnd.
Is it okay for me to do this from within my class?
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
if (msg.message==WM_CLOSE)
break;
}
What I want to know is, will this interfere with MFC's message handling?
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
In principle it should not interfere with MFC's message handling. But your message loop does not conform to the MFC standard. You would loose PreTranslateMessage and idle time processing (which updates menus and toolbars). Some MFC classes might stop working properly.
The msdn contains some articles how to write an MFC conformant message loop: Idle Loop Processing.
Another (maybe better) method is described in knowledge base article Q99999.
regards Oliver
|
|
|
|
|
Thanks Oliver.
I was expecting more responses though.
Your reply was the single solace
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Dear friends
Will you please help me how to display contents by maintaining scrollbar movement.I think i have to display line by line an WM_PAINT but it didn't work and access violation error comes.
Actually i am displaying the contents of clipboard so it should be of varying length and i am accessing it line by line from clipboard.
so please give me solution to do it in a right way.If possible please send me some code example.
i shall be ever great ful to you for this.
Thanking you in advance.
Binnu
|
|
|
|
|
Dear friends
Will you please help me how to display contents by maintaining scrollbar movement.I think i have to display line by line an WM_PAINT but it didn't work and access violation error comes.
Actually i am displaying the contents of clipboard so it should be of varying length and i am accessing it line by line from clipboard.
so please give me solution to do it in a right way.If possible please send me some code example.
i shall be ever great ful to you for this.
Thanking you in advance.
Binnu
|
|
|
|
|
how do you make it so a string or some variable that changes whithin the program will be dislayed in a tooltip box?
-Raffi
|
|
|
|
|
Do you want tooltip to the controls?
Eugene Pustovoyt
|
|
|
|
|
Hi,
Does anyone here have a favorite algorithm and/or method for generating serial numbers for users on applications you have written? If so, I would be very appreciative if you would share them
I am on the verge of writing my first shareware application and would like to implement this feature.
Also if you have any other ways or methods I would greatly appreciate hearing them...(i.e. links to articles on web pages, links to algorithms or methods, etc...)
I am not looking for something CRACK proof but something just to make it look a little more professional, and have casual users register.
TIA for any answers.
Sam C
----
Systems Manager
Hospitality Marketing Associates
|
|
|
|
|
How can I retrieve the desktop patterns and wallpaper displayed in the control\display pane?
|
|
|
|
|
There is a DrawDesktop api call ( that might not be the name, but it's something *like* that ).
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
This registry key has a list of all the patterns
HKEY_CURRENT_USER\Control Panel\Patterns
I cant figure out where it saves the current pattern
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Nish [BusterBoy] wrote:
This registry key has a list of all the patterns
HKEY_CURRENT_USER\Control Panel\Patterns
I cant figure out where it saves the current pattern
Open this key
HKEY_CURRENT_USER\Control Panel\Desktop
and take a look at the value "Pattern"
Now compare the value of "Pattern" with all the patterns to find out which of the named patterns is the current pattern
If there is no current patter "Pattern" will return a null string
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
For getting wallpaper info do this -
Open this key :-
HKEY_CURRENT_USER\Control Panel\Desktop
Query the following values :-
TileWallpaper [can be 1 or 0]
Wallpaper [the fullpath filename of the wallpaper]
WallpaperStyle [can be 0-for center and 2-for stretch] -- [I dont know what 1 stands for ]
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Hi all!
I have a tree in a dialog. The dialog has other controls on it also. When I select a branch in my tree, the branch changes color (it's highlighted). If click on different control, say a button outside the tree, then the branch change color back to before it was selected(it's not highlighted any more). How do I keep its highlighted color when the tree looses focus?
Thank You
Vu
vucsuf
|
|
|
|
|
Make sure you check "Show Selection Always" in the resource editor.
|
|
|
|
|
use the TVS_SHOWSELALWAYS style
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
Nish is a BIG fan of Goran Ivanisevic
|
|
|
|
|
Help!
I'm having problems understanding. I am reading a binary file using a structure to hold the data:
MY_STRUCT myStruct
fread(&myStruct,sizeof(MY_STRUCT),1,inFp)
When I examine the elements of myStruct, it looks like data is stored correctly in the structure's data elements.
HOWEVER, when I try to read the file again, the file pointer inFp is not at the end of the just read structure -- it doesn't advance to the end of the just read block of binary data, but instead looks to be positioned half-way between the start and end of the block.
Any help? I just want to read binary data one logical block at a time.
Thanks.
Johnny
|
|
|
|
|
fread should act just as you assume - it reads and sets the fp to the place it stopped reading. check the return from fread, or call feof, to make sure you're not out past the end of the file...
-c
Smaller Animals Software, Inc.
|
|
|
|
|