|
Hi all. I have an MFC dll that uses the CFileDialog class. I'm making a custom version using the default template, and capturing the messages and doing what I need to do. One thing I must do is force the window into list view only and keep it there, prevent the user from changing the view to thumbnail or list or icon view.
On NT my code works like a champ. For some odd reason though, it doesn't on Win2k. On Win2k the Open/Save dialog comes up, shows the list view ever so briefly, and then display a blank listbox with no items in it. When looking at the messages (using Spy++) I see the window gets the style change I'm sending (It actually gets 4 which is where I think my problem lies), and when it attempts the call the SetItemText, it fails.
Why is this happening? I think it's becuase there is another GWL_STYLE message being sent by the default message processing for the window, but its coming AFTER I perform my change, therefore overriding my change. I can change the view using the view button (But I'm going to hide this button) but that doesn't help me. Yes the dialog is set with the OFN_EXPLORER option. Here's the code snippet:
if(strcmp(_strlwr(szClassName), "syslistview32") == 0)
{
switch(x -> message)
{
//case WM_NCPAINT : // Needed if there are no items to display
case LAST_LISTVIEW_MSG : // Magic message sent after all items are inserted
// force report view (Gives the details)
ln=GetWindowLong(x->hwnd,GWL_STYLE);
ln&=~(LVS_ICON|LVS_LIST|LVS_SMALLICON);
ln|=LVS_REPORT;
SetWindowLong(x->hwnd,GWL_STYLE,ln);
//::SetWindowPos(x->hwnd,HWND_NOTOPMOST,
// 0,0,0,0,
// SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
ln=GetWindowLong(x->hwnd,GWL_STYLE);
ln&=~(LVS_ICON|LVS_LIST|LVS_SMALLICON);
ln|=LVS_REPORT;
SetWindowLong(x->hwnd,GWL_STYLE,ln);
// Hide the tool bar stuff we don't need.
TBBUTTONINFO tbinfo;
tbinfo.cbSize = sizeof(TBBUTTONINFO);
tbinfo.dwMask = TBIF_STATE;
tbinfo.fsState = TBSTATE_HIDDEN | TBSTATE_INDETERMINATE;
::SendMessage(hWndToolbar,TB_SETBUTTONINFO,(WPARAM)TB_BTN_LISTVIEW,(LPARAM)&tbinfo);
::SendMessage(hWndToolbar,TB_SETBUTTONINFO,(WPARAM)TB_BTN_DETAILVIEW,(LPARAM)&tbinfo);
// This id is the Windows 2k/Xp combo button for the detail option list
// With the current problem on Win2k, we should leave this button viewable until we can
// figure out why the list box doesn't update to the detail view properly.
// ::SendMessage(hWndToolbar,TB_SETBUTTONINFO,(WPARAM)40970,(LPARAM)&tbinfo);
...
Do the other stuff
..
Any ideas on how to ensure I am the last one to set the ListBox Style?
|
|
|
|
|
Hi!
How to get the music's detail information such as title, artist, album and genre etc from a CD format file?
Thanks!
|
|
|
|
|
...you may get them trough an InterNet service (try WinAmp) !
Kochise
In Cod we trust !
|
|
|
|
|
|
I have recently installed Microsoft SDK. The help folder of the main Microsoft SDK folder contains files with extensions .HXC, .HXI, .HXK, .HXQ, .HXS, .HXT etc. These are the help files as it is shown in the file type column of explorer. However, these files do not open. I am using WIN98 SE.
How to read/ view these files? Do I have to install some other update to read these?
Pani
|
|
|
|
|
|
Thank you Stephane.
I'll download h2viewer and try to view the files.
Pani;)
|
|
|
|
|
how can i begin to become a C++ programmer ?
thanks for reading
|
|
|
|
|
For your information.
I began to become a C++ programmer this way 5 years ago:
1) To get a PC.
2) To get some development tool for C++ (the compiler and linker).
If the OS is Windows, then the development tools may be Microsoft Visual C++ or Borland C++ Builder, etc.
If the OS is Linux, then it may usually be gcc or g++ or something.
3) To get a book which teaches the C++ programming language. (The language itself)
4) To get a book which teaches how to use the development tool(s) and basic knowledge on Windows / Linux programming.
Or to get the user manual for the tool(s).
5) Study hard. Practice and practice...
BuggyMax
|
|
|
|
|
what books did you learn ?
thanks alot
;P
|
|
|
|
|
The book I used to learn was Deitel & Deitel C++ How to Program. I have looked at many other programming books and this was the best by far. I later bought the C# and Java books in the same series.
dog_spawn
http://hatekill.yojutsu.com[^]
|
|
|
|
|
C++ from the Ground Up (2nd Edition)
C++ Primer (3rd Edition)
The C++ Programming Language (3rd Edition)
--------------------
Programming Windows, Fifth Edition
Programming Windows With MFC
... etc.
BuggyMax
|
|
|
|
|
Hi,
I need to disable the Most Recently Used command from the File menu in an MFC application as certain times. I have tried adding a Update Command handler like this, using m_bTestFile as my flag:-
void CMainFrame::OnUpdateFileMruFile1(CCmdUI* pCmdUI) <br />
{<br />
pCmdUI->Enable(m_bTestFile);<br />
}
It enables / disables OK but I have lost the list of files. I would like to do something like this....
void CMainFrame::OnUpdateFileMruFile1(CCmdUI* pCmdUI) <br />
{<br />
if(m_bTestFile)<br />
pCmdUI->Enable(FALSE);
else<br />
????
}
But what do I call to make it work as normal when m_bTestFile is FALSE, any ideas?
Thanks,
Ali
|
|
|
|
|
I don't know about disabling the MRU list but have some other suggestions. First make a copy of the list, then empty the real one so the File menu doesn't have any MRU items and finally copy the temp list back to the real one when want the user to see it again. A second approach is to leave it there but ignore any use of it. ie, When the user selects a MRU item, ignore it.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Thanks for the suggestions. Ignoring the MRU items sounded like a good idea and fairly simple. I've successfully done this by adding a test in OnOpenDocument which aborts when it is not allowed to open files (with a helpfull message for the user telling them that what they want to do is daft!)
But the files get removed from the list because they fail to open, and the list is not grayed out. Its a good solution because the user can't destroy there own data, but its not as slick as I would like.
Copying the list and putting it back sounds ideal and I would like to try it if possible. But I have no idea how or where to do this, can you point me in the right direction?
Thanks for any help ,
Ali
|
|
|
|
|
Hi Alison,
Overide CWinApp::OnOpenRecentFile() and change it as follows:
BOOL CWinApp::OnOpenRecentFile(UINT nID)
{
ASSERT_VALID(this);
ASSERT(m_pRecentFileList != NULL);
ASSERT(nID >= ID_FILE_MRU_FILE1);
ASSERT(nID < ID_FILE_MRU_FILE1 + (UINT)m_pRecentFileList->GetSize());
int nIndex = nID - ID_FILE_MRU_FILE1;
ASSERT((*m_pRecentFileList)[nIndex].GetLength() != 0);
TRACE2("MRU: open file (%d) '%s'.\n", (nIndex) + 1,
(LPCTSTR)(*m_pRecentFileList)[nIndex]);
if ( bNotAllowedToOpenFiles )
InformUser();
else
if (OpenDocumentFile((*m_pRecentFileList)[nIndex]) == NULL)
m_pRecentFileList->Remove(nIndex);
return TRUE;
}
This also shows m_pRecentFileList is where the list is stored.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Sorry for the delay in responding, I've been away for the weekend. Thanks for the help, I'll have a look at your BOOL CWinApp::OnOpenRecentFile(UINT nID) function now.
Much appreciated ,
Ali
|
|
|
|
|
Hi,
just try default (inherited) method
|
|
|
|
|
Talik wrote:
just try default (inherited) method
Sorry, I'm not sure what you mean? Can you add any more?
Cheers,
Ali
|
|
|
|
|
I have a really strange problem with VC 6.0.
At a place in my program I start 2 new threads ( GUI and Worker ) and if I put a break points in the worker thread and then when the program comes to the break point and should break, Everything locks up for 20-60sec.
VC totally freezes and all other applications on my machines is also effected
(Can’t close them, no redraw. But if IE is showing an animated GIF this is still running, and mouse pointer is working so it’s not a total lockup and task manager is NOT showing any process running at 99-100%)
This lockup ONLY happens when I debug in my worker thread.
If I don’t put any break points in that thread everything works as it should.
And it’s really annoying. And I tried removing the ncb/opt files, reinstalled VC , close everything else running But nothing helps. If anyone have and idea of what it might be please tell be before I’m going nuts and throws the computer out the window.
I’m running VC 6.0 SP5 on Windows XP SP1 .
|
|
|
|
|
I see a problem like this from time to time, where VC++ appears to hang when a breakpoint is reached in my multithreaded app. The only workaround that I've found that sometimes works is Ctr+Alt+Del to bring up Task Manager, which wakes VC up again.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi ,
Does anybody know how to read a dump file ?
I mean that I would like to know the functions names not thier address ?
Is it possible?
Do I need another program to do this ?
Thanks
|
|
|
|
|
You can read dump files with Visual Studio.NET or with WinDbg (from the Microsoft Debugging Tools[^]).
You'll need the debugging symbols for your application, for the system, and for any third-party DLLs you're using, to get the best out of a dump file.
|
|
|
|
|
Hi,
I want to play a wav. file and at the same time stream the samplple values (raw data) in real time into a vector or something in order to do signal processing on the samples.
I guess that the sound file contains some control bits (for instance sample frequency, rate, etc.), but I´m only intested in the actual sound data.
Right now I´m using PlaySound() to play the wav. file, but I cant manage to extract the actual sample values...
Thanks in advance!
|
|
|
|
|
lol, this is very easy!
read the sample rate and the bits per sample out of the wav file, then read a block, perform DSP action on the samples, copy it into a sound buffer, start playing, and continue with the next block!
Don't try it, just do it!
|
|
|
|