|
Aah. So you need to do
BOOL res = ff.FindFile(_T("filespec.whatever"), 0);
while(ff.FindNextFile())
{
}
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"
|
|
|
|
|
i guess i'm to late... but heres the code
CFileFind ff;
if(ff.FindFile(sPath+"*.bup"))
{
while(ff.FindNextFile())
{
InsertItem(ff.GetFilePath(),atoi(ff.GetFileTitle()));
}
InsertItem(ff.GetFilePath(),atoi(ff.GetFileTitle()));
}
ff.Close();
|
|
|
|
|
I am working with Visual C++ 6.0 in an MFC project and I lost/deleted corrupted my resource.h file. Is there a way to have Visual C++ auto generate my Resource defines. This is my worst nightmare I had probably over 1000 defines. Thanks in Advance
I think im going to be sick (
Alex
|
|
|
|
|
|
Tom,
Thank You. I did check this site and unfortunatly for me "Resource ID organizer" is based on the resource.h. As you already know this file no longer exists within my project. Fortunatly though "Resource ID organizer" is a great IDea and I will probabaly add it to my toolkit. I still have my .rc file and I may be able to extract **_**_** and auto generate IDs, I guess I was sort of hoping that I would not have to do this. Please know that the help you gave me is greatly appreciated.
Thanks again
Cheers
Alex
|
|
|
|
|
Oops. I haven't used the product in a very long time and for some reason was thinking it worked from the .rc file. Anyway, I'm definitely glad to hear that at least I was able to point you in the direction of a useful utility. Good luck with the resource.h problem.
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
Dude, I think you're screwed
If it was me, I would write a little Python script to scan your RC file and extract any strings that matched the pattern IDC_[A-Z]*, IDI_[A-Z]*, etc., assign them uniqe numbers and print the results out as a list of #define's. This will probably need a bit of tweaking by hand but it will do most of the grunt work for you.
Then I would think about a backup plan...
"Sucks less" isn't progress - Kent Beck [^]
Awasu 1.1 [^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Here is a function, can you tell me the function of "RUNTIME_CLASS"
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CStudentDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CStudentView));
Thank you in advance!
|
|
|
|
|
RUNTIME_CLASS is a macro that returns the static CRuntimeClass member data for a given class which allows the function being called (the CSingleDocTemplate c'tor in this case) to validate RTCI (Run-Time Class Information).
To be more specific, the CSingleDocTemplate needs to verify that a CDocument-derived class, a CFrameWnd-derived class and a CView-derived class are all being sent. As a result, this macro is used in passing those values.
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
|
Hi, all
When is it necessary to use critical sections in a multithread application? I have read that it should be used when “manipulating shared resources”, but what do those that really mean? Does it mean when manipulating: global variables, allocated memory chunks or files? And does “manipulating” mean: reading (probably not), writing or reallocating? Could anyone please demonstrate some code examples for typical situations when critical sections should be used?
Thanks in Advance
Aidman » over and out
We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
|
|
|
|
|
Use it when you assign global varibles, reading is safe.
Allocated memory chunks and files, don't know.
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
Rickard Andersson18 wrote:
reading is safe.
not really, when it's not an atomic operation - anything above size of 4 is in danger: you might catch the first half before the modification, and the other afterwards.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Oh, okay!
I've learned it from CP when I one time also talked about critical sections and threads etc here.
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
E-Mail: nikado@pc.nu
Interests: C++, ADO, SQL, Winsock, 0s and 1s
|
|
|
|
|
The best advise I saw was if you think you need a critcal section then you probably do, err on the side of caution.
Manipulating, IMHO, means changing a shared resource, if a file is open for reading only by all threads then you don't need it, but if one thread writes to the file, then you probably do. Having a global variable is not a good idea at the best of times, but especially not in a multi threaded application.
I would recomend the book "Multithreading applications in Win32" by Jim Beveridge and Rober Wiener.
If I have seen further it is by standing on the shoulders of Giants. - Isaac Newton 1676
|
|
|
|
|
Whenever > 1 thread needs read or write access to a resource (memory/disk/database record whatever) you typically need to synchronize the access. Depending on the resource it may be possible for > 1 thread to have simultaneous read access, but there may be a bigger picture issue such as one thread writing to the resource when others are reading it. You then need to go a level higher and see whether transactions are needed etc.
Bottom line is you need to go read a good book or two on multithreaded design and implementation and all that entails. Multithreading is a whole world unto itself where deadlocks occur at the blink of an eye. And debuging multithreaded apps is way harder than single threaded apps.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
You should guard all non constant data that you share between threads with some sort of locking mechanism. 'Manipulating' in this context, probably does mean writing. A critical section is a spin lock, it uses an atomic instruction to repeatedly test for and aquire the lock. This makes critical sections unsuitable for locking resources that may take a long time to become free, the other threads will consume cycles waiting for the lock. You should use a kernel lock in these cases, such as a mutex or event. Critical sections are only suitable for syncronising threads, not processes - they rely on shared memory.
Have a look at the boost thread library http://www.boost.org/libs/thread/doc/[^], it makes it a hell of a lot easier to write correct multithreaded programs.
Ryan.
|
|
|
|
|
Thanks mates
I am beginning to realize the many disadvantages of using multithreads.
It’s not as “perfect” as I imagined, but then again nothing ever is
Aidman » over and out
We haven't inherited Earth from our parents, instead we have borrowed her from our children; an old Indian saying.
|
|
|
|
|
There are several options out there such as drag and drop where you can change the order of a list control. So, when the user modifies your list control,
How do you save changes made to a ListCtrl by a user? (so that those changes could be loaded in at a later time)
Any suggestions would be helpful.
I wish I could type better ...
|
|
|
|
|
I'm not sure I follow the question. The ListCtrl (SysListView32) itself doesn't do anything magic to save its state or contents. You're responsible for doing that. Having said that, the ways in which you can persist the order of your list control's contents are way too numerous to get into without more specifics on what you're trying to do.
Cheers,
Tom Archer
Inside C#, Extending MFC Applications with the .NET Framework
It's better to listen to others than to speak, because I already know what I'm going to say anyway. - friend of Jörgen Sigvardsson
|
|
|
|
|
create your own ListControl Class and when the destructor is called, store all the info about the control somewhere. the registry?! I use a .mdb file and some SQL, so I can change the ListCtrl "on the fly"
|
|
|
|
|
I maintain an array of the column details that I write out to the registry for later reloading.
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
Hi,
how can I display system "Properties" dialog for more than one file/directory? Like in Explorer when I have selected multiple files/directories, I click right button and from context menu a select "Properties". Now I use this code:
SHELLEXECUTEINFO sei;
ZeroMemory(&sei, sizeof(sei));
sei.cbSize = sizeof(sei);
sei.hwnd = AfxGetMainWnd()->GetSafeHwnd();
sei.nShow = SW_SHOW;
sei.lpFile = filePath;
sei.lpVerb = _T("properties");
sei.fMask = SEE_MASK_INVOKEIDLIST;
ShellExecuteEx(&sei)
It works fine for single file/directory. But how can I display that dialog for more than one file/directory?
Thanks in advance.
|
|
|
|
|
Now I trid to put NULL char between file paths and double NULL at the end of list, but it also doesn't work...
|
|
|
|
|
Has anyone a exmple, to set the Quickinfo for the Statusbar dynamic during the runtime ?
I need this, cause the language of the prog could be changed during runtime too, and this is the only problem.
Also to change the font. SetFont set not the Font I want, but some internal systemfont.
Thanks in advance
Kristian
PS : I use mfc 7.0
|
|
|
|