|
use the CFile class? and then read the value/string of every cells?
Is there any simple method?:->
|
|
|
|
|
:shrugs: Can't say.
Well I can suggest you this... I don't know how feasible this is...
Serialize(or write) the object into a file and then when you need it read back the object from file.
Nibu thomas
Software Developer
|
|
|
|
|
The flexgrid has option to save files as CSV. I did it over a year ago, so don't remember the details, but i do remmeber saving files as CSV from Flexgrid. Check the method listings in the help.
|
|
|
|
|
Check the SaveGrid method for FlexGrid,here is a quick look:
SaveGrid Method
Saves grid contents and format to a file.
Syntax
[form!]VSFlexGrid.SaveGrid FileName As String, SaveWhat As SaveLoadSettings, [ FixedCells As Boolean ]
Remarks
This method saves a grid to a binary or to a text file. The grid may be retrieved later with the LoadGrid method. Grids saved to text files may also be read by other programs, such as Microsoft Excel or Microsoft Word.
The parameters for the SaveGrid method are described below:
FileName As String
The name of the file to create, including the path. If a file with the same name already exists, it is overwritten.
SaveWhat As SaveLoadSettings
This parameter specifies what should be saved. Valid options are:
Constant
Value
Description
flexFileAll
0
Save all data and formatting information.
flexFileData
1
Save only the data, ignoring formatting information.
flexFileFormat
2
Save only the global formatting, ignoring the data.
flexFileCommaText
3
Save data to a comma-delimited text file.
flexFileTabText
4
Save data to a tab-delimited text file.
flexFileCustomText
5
Save data to a text file using the delimiters specified by the ClipSeparators property.
flexFileExcel
6
Save all data and formatting information to an Excel97 file. This filter does not support frozen color rows or columns.
Options As Variant (optional)
When saving and loading text files, this parameter allows you to specify whether fixed cells are saved and restored. The default is False, which means fixed cells are not saved or restored.
When saving and loading Excel files, this parameter allows you to specify the name or index of the sheet to be loaded, or the name of the sheet to be saved. If omitted, the first sheet is loaded.
The options for saving fixed rows, columns, and translated combo values include:
Constant
Value
Description
flexXLSaveFixedCells
3
Saves fixed cells.
flexXLSaveFixedRows
2
Saves fixed rows.
flexXLSaveFixedCols
1
Saves fixed columns.
flexXLSaveRaw
4
Saves raw (untranslated) data.
For example, the options can be written as:
fg.SaveGrid "book1.xls", flexFileExcel
fg.SaveGrid "book1.xls", flexFileExcel, "sheetName"
fg.SaveGrid "book1.xls", flexFileExcel, flexXLSaveFixedCells
fg.SaveGrid "book1.xls", flexFileExcel, flexXLSaveFixedRows
fg.SaveGrid "book1.xls", flexFileExcel, flexXLSaveFixedCols
fg.SaveGrid "book1.xls", flexFileExcel, flexXLSaveRaw
fg.SaveGrid "book1.xls", flexFileExcel, _
flexXLSaveFixedCells Or flexXLSaveRaw
Notes
|
|
|
|
|
Hi,
I have an MDI MFC VS2005 app. I added a dialog bar in resource view and changed the basze class from CDialog to CDialogBar.
I use following code to create the dialogbar.
Now it is created fine and it aligns at bottom as intended, but all the buttons on the dialogbar are disabled!!!.
What's going on here?
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
EnableDocking(CBRS_ALIGN_ANY);
m_launchbar.Create( this, IDD_LAUNCHBAR, CBRS_BOTTOM , IDD_LAUNCHBAR );
}
In addition to the above problem the OnShowWindow is fired only when exiting the app and never when the app is started.
IMPLEMENT_DYNAMIC(CLaunchbar, CDialogBar)
CLaunchbar::CLaunchbar(CWnd* pParent /*=NULL*/)
: CDialogBar()
{
}
CLaunchbar::~CLaunchbar()
{
}
void CLaunchbar::DoDataExchange(CDataExchange* pDX)
{
CDialogBar::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LBREXITAPP, m_lbrExitApp);
}
BEGIN_MESSAGE_MAP(CLaunchbar, CDialogBar)
ON_WM_SHOWWINDOW( )
ON_BN_CLICKED(IDC_LBREXITAPP, &CLaunchbar::OnBnClickedLbrexitapp)
END_MESSAGE_MAP()
// CLaunchbar message handlers
void CLaunchbar::OnShowWindow( BOOL bShow, UINT nStatus )
{
}
void CLaunchbar::OnBnClickedLbrexitapp()
{
// TODO: Add your control notification handler code here
}
Any help please?
|
|
|
|
|
venadder wrote: Now it is created fine and it aligns at bottom as intended, but all the buttons on the dialogbar are disabled!!!.
What's going on here?
Write event handlers for the buttons.
Nibu thomas
Software Developer
|
|
|
|
|
already have event handlers for on click as folows:
public:
afx_msg void OnBnClickedLbrexitapp();
void CLaunchbar::OnBnClickedLbrexitapp()
{
// TODO: Add your control notification handler code here
}
|
|
|
|
|
you created button and declare function for buttons but
buttons are disable,right?
|
|
|
|
|
venadder wrote: void CLaunchbar::OnBnClickedLbrexitapp()
You must provide a message handler in the MainFrame class not in the DialogBar class.
Nibu thomas
Software Developer
|
|
|
|
|
Thanx for your input. I changed it from dialog bar to CDialog anywyas. I have much more control and flexibility that way. It's easy to position teh window even with CDialog.
But thanx for your help. I appreciate it.
|
|
|
|
|
venadder wrote: I changed it from dialog bar to CDialog anywyas. I have much more control and flexibility that way. It's easy to position teh window even with CDialog.
Why oh why!!!
Then what is the use of a Dialog bar!!!
You just have to provide a message handler for the button in the main frame class. That's all. Nothing more nothing less. Just like you would do for a toolbar button.
Nibu thomas
Software Developer
|
|
|
|
|
So I know you can do this with Windows... cuz I turn winamp all the way down and I can still hear other applications...
I want to be able to mute only my application... how can I do this?
Thanks!
|
|
|
|
|
chasetoys wrote: I want to be able to mute only my application... how can I do this?
You can't. Windows XP doesn't have per-application volume controls. Windows Vista will do, but not XP. Winamp does this by modifying the audio data it is sending to Windows.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote: Windows XP doesn't have per-application volume controls.
Yes there is!! I installed K-Lite, and there is "MediaPlayer Classic" which came from K-Lite installation. To change the volume of MediaPlayer Classic does not affect WinXp overall volume. (Windows MediaPlayer and RealPlayer do.)
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: Yes there is!! I installed K-Lite, and there is "MediaPlayer Classic" which came from K-Lite installation. To change the volume of MediaPlayer Classic does not affect WinXp overall volume. (Windows MediaPlayer and RealPlayer do.)
What Media Player Classic does is process the audio before it sends it to Windows to change its volume. Windows XP does not have individual volume controls per application - that is a new feature coming with Windows Vista.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
store the user preferred volume (usually 0 [mute] - 10) and send/check this whenever you play sound. the exact code depends on what/how you are playing audio
|
|
|
|
|
I have run into a problem with registration keys ".Default\\.Default". WHat I am trying to do is read the "Apps\\Events\\.Default\\.Default" value. I am trying to identify System sound events that are attached to a .wav file for inclusion in a list box.
The Means Justifies the Ends
|
|
|
|
|
oldmirco wrote: I have run into a problem
What is the problem?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Do you need to read with RegEnumValue?
|
|
|
|
|
When I try:
RegOpenKeyEx(HKEY_CURRENT_USER,"AppEvents\\EventLabels", 0L,KEY_READ, &SoundsKey);
and use:
RegEnumKeyEx(SoundsKey,dwIndex,lpSubKey,&dwSubKeysz,
NULL, lpData, &dwDatasz, &ftLastWriteTime);
to return the next level in the chain, and use:
RegOpenKeyEx(HKEY_CURRENT_USER,
("AppEvents\\EventLabels\\"+lpData),
0L,KEY_READ, &SoundsKey);
(the strings concatenated in code)
I get an error code.
The Means Justifies the Ends
|
|
|
|
|
oldmirco,
you get this error "AppEvents\\EventLabels\\"+lpData
or you get runtime error
|
|
|
|
|
char buffer80[80];
char buffer256[256];
char buffer512[512];
LONG retValue;
CString EventKey;
CStringList EventKeyList;
CString DisplayValue;
FILETIME ftLastWriteTime;
HKEY SoundsKey;
DWORD dwIndex = 0;
DWORD dwSubKeysz;
char * lpSubKey = buffer256;
char * lpData = buffer512;
DWORD dwDatasz;
// "HKEY_CURRENT_USER\AppEvents\"
if (RegOpenKeyEx(HKEY_CURRENT_USER,"AppEvents\\EventLabels", 0L,
KEY_READ, &SoundsKey)==ERROR_SUCCESS)
{
do
{
*lpSubKey = 0;
dwSubKeysz = 256;
*lpData = 0;
dwDatasz = 512;
retValue = RegEnumKeyEx(SoundsKey,dwIndex,lpSubKey,&dwSubKeysz,
NULL, lpData, &dwDatasz, &ftLastWriteTime);
switch(retValue)
{
case ERROR_SUCCESS:
//add sub Key to a CStringList
EventKeyList.AddTail(lpSubKey);
/* the values should include ".Default", "Close", "Minimise", "Open"
"Start", "SystemAsterisk" etc. w/o the full key hierarchy
*/
break;
case ERROR_NO_MORE_ITEMS:
AfxMessageBox("No More Items", MB_OK);
break;
default:
if (AfxMessageBox("Try Again?", MB_OKCANCEL)!=IDOK) return TRUE;
}
dwIndex++;
} while(retValue!=ERROR_NO_MORE_ITEMS);
}
//Look in HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default
if (RegOpenKeyEx(HKEY_CURRENT_USER,"AppEvents\\Schemes\Apps\\.Default", 0L,
KEY_READ, &SoundsKey)==ERROR_SUCCESS)
{
// get key values
dwIndex = 0;
POSITION Ip = EventKeyList.GetHeadPosition();
while (Ip!=NULL)
{
*lpData = 0;
dwDatasz = 512;
DisplayValue = EventKeyList.GetNext(Ip);
strcpy(lpSubKey, DisplayValue);
/*
the keys that are stored in the EventKey list: ".Default", "Close", "Minimise", "Open"
"Start", "SystemAsterisk" either will or will not have a file name
(with a ".wav") as a data value. Those that have a value are
system sounds that will play, and that I want in the list box.
*/
retValue = RegQueryValueEx(SoundsKey,lpSubKey,NULL,NULL,(unsigned char*)lpData,&dwDatasz);
switch(retValue)
{
case ERROR_SUCCESS:
DisplayValue += " = ";
if (*lpData) DisplayValue += lpData;
if (AfxMessageBox(DisplayValue, MB_OK)!=IDOK);
break;
case ERROR_NO_MORE_ITEMS:
DisplayValue += " Not here";
AfxMessageBox(DisplayValue, MB_OK);
break;
default:
// This is the message for every item:
DisplayValue += " Error!";
if (AfxMessageBox(DisplayValue, MB_OKCANCEL)!=IDOK) return TRUE;
}
dwIndex++;
}
}
The Means Justifies the Ends
|
|
|
|
|
Hope I understood your question
I guess when I see RegEnumValue in title that you need to read value from keys
I find your problem you want run this way(I suggest) maybe you find a good way
...
...
... code is ok
//Look in HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default
then I suggest use this way
these keys are with subkey (example .Default with .Current and .Default
1- you want read first root that is HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default(RegOpenKeyEx)
then read first subkey with RegEnumKeyEx(.Default)
2-now you want concat root with current key
TCHAR test[256];
test[0]='\0';
strcat(test,"AppEvents\\Schemes\\Apps\\.Default");
strcat(test,"\\");
strcat(test,lpSubKey);//.Default
3-RegCloseKey(SoundsKey);
4-open new path with RegOpenKeyEx (test )
5-now you want subkeys from .Default that are .Default and .Current
6-RegCloseKey(SoundsKey);
7-now you need to loop for read subkeys from
HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default that are two keys
and hold in one Array
now you want concat these subkeys with current path but first close RegCloseKey(SoundsKey);
in the loop
<br />
for(int i=0;i<m_Array.GetCount();i++)<br />
{<br />
CString str;<br />
str=m_Array.GetAt(i);<br />
now concat current path with current subkey that is <br />
strcat(HKEY_CURRENT_USER\AppEvents\Schemes\Apps\.Default\.Default\.Current<br />
<br />
and use RegEnumValue for read value that is one path .wav<br />
next key is .Default<br />
}<br />
maybe it is some helpful to you
|
|
|
|
|
CWnd has no such RegEnumValue() method.
oldmirco wrote: WHat I am trying to do is read the "Apps\\Events\\.Default\\.Default" value.
So what's the problem? Are you using RegQueryValueEx() ?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Hi everybody!
Sorry for my bad english.
I would like to programmatically prevent from powering of the computer with the power off button. but I dont care about holding the power off button 5 second to hard shut the computer. Just the smooth shutdown.
in microsoft word, when you edit a document and do not save it. If you press the power down button ( digital type ), a Dialog will pop and ask you to save the document. If you press cancel, the System will not shut down and the application will stay active. I would like to do the same with my application.
Thanks in advance for your help!
Sébastien Nadeau
Security Software Developper
|
|
|
|
|