|
Use the CFile::SetStatus() method, or use SetFileAttributes().
|
|
|
|
|
Thanks! I'll try them out.
|
|
|
|
|
Is there a way to change the fonts inside a listview control.
Thanks
|
|
|
|
|
See SetFont method of CWnd or WM_SETFONT msg.
|
|
|
|
|
d:\\Program Files\\Windows Media Player\\wmplayer.exe
d:\Program Files\Windows Media Player\wmplayer.exe
I:\Music\Symphony\RichardClayderman\Lieberstraum.mp3
I want use ShellExecute function to active a application (WindowMediaPlayer9 or WinAmp) and open a MP3 file also (play that MP3)
but I can not do that function always return ERROR_FILE_NOT_FOUND
When I type
"d:\Program Files\Windows Media Player\wmplayer.exe" "I:\Music\Symphony\RichardClayderman\Lieberstraum.mp3"
in RUN DialogBox (Start/Run)...>> it works OKAY
Can you show me a way to get right result?
thank
<br />
#define ERROR_FILE_NOT_FOUND 2L<br />
<br />
<br />
CHAR szCommandLine[300]=STR_NULL;<br />
CHAR szFileName[255]=STR_NULL;<br />
strcpy(szCommandLine,"\"d:\\Program Files\\Windows Media Player\\wmplayer.exe\" \"");<br />
<br />
ListView_GetItemText(hWndLvwContent_Time,dwIndex,2,szFileName,sizeof(szFileName));<br />
<br />
strcat(szCommandLine,szFileName);<br />
strcat(szCommandLine,"\"");<br />
MessageBox(hWnd,szCommandLine,"",MB_OK);<br />
If((INT)ShellExecute(NULL, NULL, szCommandLine, NULL, NULL, SW_SHOWNORMAL)<=32)<br />
{<br />
}
|
|
|
|
|
CHAR szCommandLine[300]=STR_NULL;
CHAR szFileName[255]=STR_NULL; What is STR_NULL defined as?
strcpy(szCommandLine,"\"d:\\Program Files\\Windows Media Player\\wmplayer.exe\" \"");
...
strcat(szCommandLine,"\""); Why are you escaping the double-quotes?
If((INT)ShellExecute(NULL, NULL, szCommandLine... Unless you really want to use wmplayer.exe, you can simply set szCommandLine equal to I:\\Music\\Symphony\\RichardClayderman\\Lieberstraum.mp3 and let the shell's association determine what app to run.
|
|
|
|
|
wonderful!
WinAmp' s activated auto to play that MP3 file
thank you
|
|
|
|
|
thank you
#define STR_NULL ""
|
|
|
|
|
Hi,
Is there a place that shows what is the meaning of m_reason member of CArchiveException.
I used a try/catch in my code and aperantly I got an exception with m_cause=7, what does it mean ?
The only thing I did was to serialize another member of my class...
Thanks,
Shay
|
|
|
|
|
Shay Harel wrote:
m_cause=7, what does it mean ?
CArchiveException::badSchema
|
|
|
|
|
First,
Thank you.
I still can't understand why. I did bump the Schema in 1 but I also have a switch statement that do the right serialize based on the schema....
Shay
|
|
|
|
|
What I have found is the easiest method of handling schema changes (since the MFC Schema stuff does nothing) is to write out a couple of extra bytes in each object. This will let you do your own object versioning and conditional serialization. Example:
void MyClass::Serialize(CArchive &archive)
{
WORD wMagicNum;
WORD wVersion;
CObject::Serialize(archive);
if (archive.IsStoring())
{
archive << (WORD)0x4C53; // LS
archive << (WORD)4; // version
archive << m_cServerConfigName << m_cLoginHTMLFileName << m_cDefaultIPAddress;
archive << (WORD)m_bUseSSL << (WORD)m_wNumWorkerThreads;
archive << (DWORD)m_iInputBufferSize << (DWORD)m_iOutputBufferSize;
archive << (DWORD)m_iSQLBufferSize << (DWORD)m_iMaxParameters;
archive << m_cCurrentApplicationSetFileName;
archive << (WORD)m_bUseMailSender << m_cMailProfile << m_cMailProfilePassword << (DWORD)m_iMailWorkerThreadCount;
archive << m_cSMTPHost << (DWORD)m_iSMTPAuthenticationMode << m_cSMTPUserName;
archive << m_cSMTPPassword << (DWORD)m_iSMTPPort << m_cSMTPBoundIP << (DWORD)m_iMailTransportToUse;
archive << (WORD)m_bOutputPerformanceHeader << (WORD)m_bCompactOutputBuffer;
}
else
{
archive >> (WORD&)wMagicNum;
if (wMagicNum != 0x4C53)
{
TRACE("Bad id number in front of a LightningServer item\n");
AfxThrowArchiveException(CArchiveException::generic);
}
archive >> (WORD&)wVersion;
archive >> m_cServerConfigName >> m_cLoginHTMLFileName >> m_cDefaultIPAddress;
archive >> (WORD&)m_bUseSSL >> (WORD&)m_wNumWorkerThreads;
archive >> (DWORD&)m_iInputBufferSize >> (DWORD&)m_iOutputBufferSize;
archive >> (DWORD&)m_iSQLBufferSize >> (DWORD&)m_iMaxParameters;
archive >> m_cCurrentApplicationSetFileName;
if (wVersion > 0)
{
archive >> (WORD&)m_bUseMailSender >> m_cMailProfile >> m_cMailProfilePassword >> (DWORD&)m_iMailWorkerThreadCount;
if (wVersion > 1)
{
archive >> m_cSMTPHost >> (DWORD&)m_iSMTPAuthenticationMode >> m_cSMTPUserName;
archive >> m_cSMTPPassword >> (DWORD&)m_iSMTPPort >> m_cSMTPBoundIP >> (DWORD&)m_iMailTransportToUse;
}
if (wVersion > 2)
archive >> (WORD&)m_bOutputPerformanceHeader;
if (wVersion > 3)
archive >> (WORD&)m_bCompactOutputBuffer;
}
}
}
|
|
|
|
|
I want to make a application that supports form creation(a form editor), like in MS Access or in VC++ Dialog Editor, like the VB form editor. i want to add controls dynamically to CFormView . and want to give the user the ability to move, resize or select the control in design mode. Please if any one can help me i would be very greatfull to him/her.
|
|
|
|
|
Hi,
I write into Excel over COM
My Problem is the interface IDispatch. I can't get acces to a SeriesCollection object with this interface.
I've tried to map anotherone but this doesn't works. The compiler says the code is ok but when executing i got an invalid pointer massage
Here are some parts of my code:
_ApplicationPtr pXL;
pXL.CreateInstance(L"Excel.Application.9");
.
.
.
pXL->Range["Messwerte!B5"]->Value2= 35.6;
pXL->Range["Messwerte!B6"]->Value2= 32.7;
pXL->Range["Messwerte!B7"]->Value2= 33.6;
pXL->Range["Messwerte!B8"]->Value2= 37.6;
pXL->Range["Messwerte!B9"]->Value2= 34.6;
pXL->Charts->Add();
pXL->ActiveChart->SetSourceData(pXL->Range["Messwerte!B5:Messwerte!B9"], _variant_t((long)xlColumns) );
pXL->ActiveChart->ChartType = xlLineMarkers;
pXL->ActiveChart->Location(xlLocationAsObject,"Messwerte");
pSheet->Shapes->Item( _variant_t((long)1) )->Top = 0;
pSheet->Shapes->Item( _variant_t((long)1) )->Left = 0;
pSheet->Shapes->Item( _variant_t((long)1) )->Width = 400;
pSheet->Shapes->Item( _variant_t((long)1) )->Height = 200;
// it works until here now i want change some attributes of the chart so i have to use an SeriesCollection Object
IID IID_ISERIESCOLLECTION = {0x00020813-0x0000-0x0000-0xC000
0x000000000046};
ISeriesCollection *pscMyCollection;
pXL->ActiveChart->SeriesCollection( _variant_t((long)1) )->QueryInterface(IID_ISERIESCOLLECTION, (void**)&pscMyCollection);
pscMyCollection-> //here i want to acces members, e.g. Item, Add.. but it doesn't work
Thanks for Help
|
|
|
|
|
seemed to be the wrong Inteface.
Does perhaps someone know an InterfaceID with which i,ve got acces to SeriesCollection member?
|
|
|
|
|
I'm trying to create multiple buttons on a dialog page dynamically and have been able to get the buttons to appear, but i can't get the tools tips to work. Before I did this I was using static buttons and they worked fine. Now everything works except the tool tip. Could this be because I'm just using one resource button on that dialog page?
m_Icon[ndx].Create(_T(""), WS_CHILD | WS_VISIBLE | WS_TABSTOP , CRect(0, 0, 0, 0), this,IDC_BTN );//IDC_BTN is the only resource on dialog created in the dialog editor
Any idea to the limit of the number of objects that can be put on a page? Looks like I may have a max of 600 plus all the stuff to make the page into a x/y graph.
Thanks for any help
|
|
|
|
|
As I understand it, applications which share a dll will share the code segment of the dll. Each application will get a new data segment for the data in the dll.
This can be overridden with the #pragmas such that a shared data segment can be used.
And I understand that variables must be initilized in order to be in that data segment.
Now when I create a class, can I specify what data segment it's data members will be in?
related question:
Let's say I have an array[] of some type that is supposed to be member data of a class. Should I create it as global (to the shared memory segment) and then only have a pointer to it in the class? If so, will all instantiations of the dll class point to the same data?
Thanks,
-KS
|
|
|
|
|
Is it possible to have one button do the function of two buttons in MFC.
For example: I have two buttons Beginner Mode, Advanced Mode. The beginner mode puts the user in different settings than the advanced mode. I want them to both be in one button., so when the user clicks on beginner mode, the beginner settings show and the button text changes to advanced mode.
|
|
|
|
|
well, you can internally keep track of the mode via a variable, lets say bool bAdvancedMode = false . Depending on the value you can handle it like that:
voice OnButtonClick()
{
if(bAdvancedMode)
ShowAdvancedProperties();
else
ShowBeginnerProperties();
}
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
you can,
you need to keep a variable somewhere to keep the "mode" you're in.
you can also use a checkbox, to toggle on/off the advanced/beginner mode.
in the case of the checkbox, the button itself becomes the variable (unless it's private, or you need the variable to be a global state)
Max.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
Yes this can be done. I've done this with CButtonSt in the articles section on this board.
Use the SetWindowText to set the text of the button to what it should say then just keep track so on the button click you know what functions to call.
|
|
|
|
|
Assuming that you have a property that identifies whether or not they are in beginner mode or advanced:
void CFunDlg::OnExample()
{
if(CFunDlg::m_bAdvanced)
MessageBox(_T("User has selected the Adavanced Option."));
}
-Nick Parker
|
|
|
|
|
I want to deal with files using fstream, like:
std::fstream file;<br />
file.open("imi.asp");
But i want to have some kind of error message if the file does not exists. The code i have written above is not returning any error in case if the file is not present. Please tell me that how can i find that the file does not exist.
|
|
|
|
|
How about:
std::fstream file;
file.open("imi.asp");
if(!file.is_open())
{
cerr << "Unable to open file!\n";
exit(1);
}
Hope this helps,
Nathan
---------------------------
Hmmm... what's a signature?
|
|
|
|
|
You could also:
fstream infile;
infile.open("mystuff.dat", ios::in);
if(!infile)
cerr << "mystuff.dat couldn't be opened.\n";
-Nick Parker
|
|
|
|