|
HAHAHA_NEXT wrote:
I keeps returning error 234 (ERROR_MORE_DATA). But i have a 12 Kb buffer, which means the problems is something else.
You failed to indicate what API you are using that is producing this "error." In any case, it's obvious that a 12KB buffer is insufficient. Try a larger number.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
ERROR_MORE_DATA is not really an error. It simply means that there are more values to enumerate. RegEnumValue does not enumerate *all* values, you give it a counter, and it enumerates one at a time. For instance (yes, this is C++ code, but you can figure out the algorithm):
DWORD error;
DWORD index = 0;
TCHAR nameBuff[1024];
TCHAR valueBuff[1024];
DWORD nameBuffSize, valueBuffSize;
DWORD type;
do
{
nameBuffSize = valueBuffSize = 1024;
error = ::RegEnumValue(hSectionKey, index, nameBuff, nameBuffSize,
0, &type,(BYTE *)valueBuff, &valueBuffSize);
if(error == ERROR_SUCCESS || error == ERROR_MORE_DATA)
{
}
index++;
} while(error == ERROR_SUCCESS || ERROR == ERROR_MORE_DATA);
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|
|
I think i found it. Stupid vb does not understand NULLS.
|
|
|
|
|
I think i found it. Stupid vb does not understand NULLS.
error = ::RegEnumValue(hSectionKey, index, nameBuff, nameBuffSize, 0, NULL,NULL,NULL);
Does not work with VB (&^%$^^&^%&) .
Thank you all. I changed my code and it works now.
|
|
|
|
|
Is there a way to conver a C++ program into MFC? IF so how do I go about doing it!!
|
|
|
|
|
Not automatically.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
How, can it be done? You said not automatically, so it is possible.
|
|
|
|
|
Well, the first thing to clear up is to remove the thinking that C++ and MFC are mutually exclusive things. One is merely a subset of the other. Converting a VB project to a C++ projects makes more sense than converting a C++ project to an MFC project. MFC is a tool that is used within, not in place of, a C++ project.
That said, what sort of C++ project are you wanting to convert? If it is GUI based, it is probably a good candidate to use MFC. If not, then an STL project might be more fitting.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
David, Its an STL project that I am running from the command line. How do i go about converting that into MFC?
|
|
|
|
|
Use AppWizard to create an MFC project. Decide if it will be SDI, MDI, or Dialog based, and then add the necessary files from the STL project.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hello,
I'm looking for a way to let the PC Speaker beep, but it must be asynchronous. The function I could find - Beep - is syncronus. :/
Thanks for the help,
Michael
|
|
|
|
|
Asynchronous standard beep using computer speaker:
MessageBeep((UINT)-1);
Best regards,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Thanks Dominik, though the MessageBeep isen't what I'm looking for, because it does play the default windows .wav sound and I actually need the PC-Speaker playing the sound.
-Michael
|
|
|
|
|
Read MSDN!!
MessageBeep
The MessageBeep function plays a waveform sound. The waveform sound for each sound type is identified by an entry in the [sounds] section of the registry.
<br />
BOOL MessageBeep(<br />
UINT uType
);<br />
Parameters
uType
Specifies the sound type, as identified by an entry in the [sounds] section of the registry. This parameter can be one of the following values: Value Sound
0xFFFFFFFF Standard beep using the computer speaker
MB_ICONASTERISK SystemAsterisk
MB_ICONEXCLAMATION SystemExclamation
MB_ICONHAND SystemHand
MB_ICONQUESTION SystemQuestion
MB_OK SystemDefault
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks
After queuing the sound, the MessageBeep function returns control to the calling function and plays the sound asynchronously.
If it cannot play the specified alert sound, MessageBeep attempts to play the system default sound. If it cannot play the system default sound, the function produces a standard beep sound through the computer speaker.
The user can disable the warning beep by using the Sound Control Panel application.
Windows CE: Passing 0xFFFFFFFF will cause the SystemDefault waveform to be played.
QuickInfo
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Requires version 1.0 or later.
Header: Declared in winuser.h.
Import Library: Use user32.lib.
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Yes, I read the MSDN and I also wrote a test program, but even when I pass 0xFFFFFFFF or ( (UNIT)-1 ) it just plays the system default sound using the sound card and not the PC Speaker.
Nevertheless, thanks for the help,
Michael
|
|
|
|
|
How about sndPlaySound(..., SND_ASYNC) ?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Thanks David, though I took a look at the functions and it's just playing .wav files and I need the PC-Speaker ( that old horrible thing ) playing the sound.
I guess I will start a extra thread just for the beeping
|
|
|
|
|
printf("\007");
TOXCCT >>> GEII power
|
|
|
|
|
Basically you'd use it to store persistent state information... user preferences, window size/position, etc. However these can also be stored in a private file (INI or any other type of file) as you see fit and ignore the registry completely.
Just one tip, there are a few different root-level registry hives. Application data should probably go in the HKEY_CURRENT_USER hive - this is meant for user-specific data (for instance, user A can have preferences one way, and user B can have preferences another way.)
Sometimes I feel like I'm a USB printer in a parallel universe.
|
|
|
|
|
Would you recommend using the windows registry rather than an INI file or would you use them both? Is there any other hive that I would use other than HKEY_CURRENT_USER? Also is there any documentation on that I can read about store data in the windows regestry? Whether it is on codeproject or another site??
Thanks Navin!
There are 10 kinds of people in this world. Those who understand binary and those who don't.
|
|
|
|
|
I sometimes put registry settings under HKEY_LOCAL_MACHINE for necessary things for the app, and under HKEY_CURRENT_USER for personal settings.
If it's broken, I probably did it
bdiamond
|
|
|
|
|
A user requires special privilege to write to the HKEY_LOCAL_MACHINE
If you store user-secific settings in a file, make sure to put them in a 'company specific' subfolder of the user's douments and settings folder, so if they 'roam' it should be available on the network.
If you use the MSDN and read about terminal services, you can be made very aware of ths issues of supporting multiple users from the same computer. Also, there are the windows logo guidelines that detail where your program should write certain classes of files to certain subdirectories on the computer.
|
|
|
|
|
Ahoy..
I guess you all probably know the folder dialog in Visual Studio whenever you're creating a new project. You can choose to browse for the desired folder to put your project in, like this:
http://www.blacksmith-studios.dk/ChooseFolder.JPG[^]
Anyways, I'm wondering how one can do this in MFC? It seems the CFileDialog class doesn't support the selecting of folders :S
Thanks a bunch
|
|
|
|
|
Will SHBrowseForFolder() suffice?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Well, that's what I used the last time.
Was just curious if I could do it the way Visual Studio does.
|
|
|
|