|
Tom Wright wrote:
When you say function pointer ...what do you mean?
A callback function.
void CALLBACK TimerProc(...)
{
}
SetTimer(..., TimerProc);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Never worked with callbacks....guess it's time to learn.
Thank again David
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Let me ask you this. According to the MSDN is says that the hWnd is
Handle to the window to be associated with the timer. This window must be owned by the calling thread. If this parameter is NULL, no window is associated with the timer and the nIDEvent parameter is ignored.
My thread does not have a window associates to it. And I need for SetTimer to look at the nIDEvent parameter because I have three timers doing three different things.
Can I just pass the handle from my main app and still have the timer work in my UI thread?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
I havent done DX programming before but I found out that you can enter fullscreen mode by SetCooperativeLevel and pass DDSCL_FULLSCREEN as one of the params.
For OpenGL I ran accorss the following line of code: ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN);
How do I determine if an app is running in the fullscreen mode?
|
|
|
|
|
Hey all.
I've searched for a few days and the best class that I've found where I can easily read data from a spreadsheet was one that is posted on this site named CSpreadsheet. It works great, with one exception, I cannot get it to read check boxes (and to see whether or not they are checked). In the sheet in Excel, I can see the name of the checkbox is Check Box 1 ... but I can not find any class(es) or code samples that shows me how to read them. Can anyone point me in the right direction? I would really appreciate it
TIA
|
|
|
|
|
huh? Why would you have to write a function for each edit box. Just read in the float and dow what you want to do to it. Else you can to what David Crow suggests which seems the easiest way.
Maybe you could give more detail in what you are doing and trying to accomplish
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
I'm trying to find the number of directories (subfolders) in a certain user-defined folder.
I'm having to retrieve files from these subdirectories according to extension, and recursive algorithms traverse ALL subfolders, making my application very slow.
What I am planning on doing is retrieving the number of folders, partitioning them, and creating three or four threads to traverse each partition. This should enhance my execution time considerably.
Please help! Is there a function that will retrieve the number of directories in a folder?
Thanks
When the going gets tough... write a computer program to do it for you
|
|
|
|
|
FayezElFar wrote:
What I am planning on doing is retrieving the number of folders, partitioning them, and creating three or four threads to traverse each partition. This should enhance my execution time considerably.
Doubtful, since the extra time that is involved in context switching would add to the overall time. If you had a true multiprocessor machine, then the threads would truly operate independently of each other.
I tried something very similar to this a few years ago for finding files. For each file pattern that was sought, I created a thread. As each thread worked, the results were added to a listbox of some sort. While it was neat to watch, it was definitely slower than had I processed each file pattern separately.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks for the warning. Is there anything else you would suggest? Below you will find the heirarchy of the folders (and files) I'm trying to access. My goal is to retrieve all files of a certain extension.
USER DEFINED DIRECTORY LEVEL 1
|
------------------------------------------
| | | .................. . . . |
Dir1 Dir2 Dirx LEVEL 2
|
---------------------
| | | | | |
SD1 SD2 SD3 SD4 SD5 FILE! Level 3
SD: Subdirectory
I need the file in the third level. However, the class I'm using right now will go through all the SDs in search for it.. I cannot specify how deep the recursion goes. Plus I don't have much time to create my own class. Deadlines deadlines deadlines.
When the going gets tough... write a computer program to do the thing for you
|
|
|
|
|
What does the "search" method of the class look like? Perhaps it can be tweaked just a bit in hopes of shaving off a second here and there.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I'm using a class I got off of codeproject, calles CSADirRead. It's an amazing class, written by a guy at Smaller Animals Inc. (props).
Please let me know of anything you can find.
When the going gets tough... write a computer program to do the thing for you
|
|
|
|
|
You might ask Chris Losinger if he has any performance suggestions.
In the interim, see if you can build upon this:
int FindFiles( LPCSTR lpszFolder )
{
CString strFolder(lpszFolder);
CFileFind find;
BOOL bFound;
int nCount = 0;
bFound = find.FindFile(strFolder + "\\*.*");
while (TRUE == bFound)
{
bFound = find.FindNextFile();
if (find.IsDirectory() == TRUE)
{
if (! find.IsDots())
nCount += FindFiles(find.GetFilePath());
}
else
{
if (find.GetFileName().Right(4) == ".txt")
nCount++;
}
}
return nCount;
}
...
int x = FindFiles("c:\\winnt");
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
the above works fine. Make sure you call FindNextFile before calling any of the GetFileName Path etc functions. Go to msdn.com and select Library. In the search field type "CFileFind::"
It tells you everything you need to know
|
|
|
|
|
Thanks a whole bunch bro.
Got it working. Not as fast as it needs to be, but I think I reached near-HD-speed cap. That's good enough
I appreciate it.
cheers
When the going gets tough... write a computer program to do the thing for you
|
|
|
|
|
Hi all,
I'm slowly teaching myself Visual C++, and generally doing okay. I've come across a stumbling block though.
I'm working with an SDK that requires a non-disclosure agreement, so I can't paste code fully here sorry. Here's a bit of a mockup of my problem though.
in program.h
afx_msg void __stdcall doThatThing(struct ndaStruct*, void*)<br />
in program.cpp
void MSWSTDCALL programApp::doThatThing(ndaStruct *foo, void *local_state)<br />
{<br />
}<br />
Another bit obviously calls doThatThing - this is however done from within a function that is a part of the SDK I'm working with, so can't change anything about the way that it calls it.
When I attempt to compile, I get:
error C2664: 'NDA_function' : cannot convert parameter 6 from 'void (struct ndaStruct *,void *)' to 'void (__stdcall *)(struct ndaStruct *,void *)<br />
I'm sure I just need to change the declaration in program.h somehow, but I REALLY don't know how.
Sorry for the vagueness... I know it may make it a bit confusing.
Any help?
|
|
|
|
|
Have you tried making the doThatThing() member function static ?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hah! As simple as that. Worked perfectly.
Thanks a lot
|
|
|
|
|
I'm not really sure what you're trying to do, but it may be an ambiguity between ::doThatThing() and programApp::doThatThing() so you may have to explicitly declare the parameter as either ::doThatThing() or programApp::doThatThing() depending on where it is called.
|
|
|
|
|
I have seen at least one commercial product (VisualTest) that has a horizontal splitter window with a title. That is, the top gripper bar is wider than normal, and has text in it that describes the contents of the window below. A screen shot is available at:
http://www.magicdave.com/private/browse/vt.jpg
I can sort of simulate that if the window contains a ListView by setting the ListCtrl to REPORT style and adding one column heading with the text, but that leaves you with that annoying column sizing thing in the header, which I find unaesthetic. Further, you're out of luck entirely if the window contains a TreeCtrl--and the window I'm making does.
I have tried every solutuion I can think of, including attaching a custom CHeaderCtrl, but nothing seems to work.
Any suggestions?
|
|
|
|
|
looks to me like an edit box with static text label at the top of it.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
>looks to me like an edit box with
>static text label at the top of it.
Ah, that's another wrinkle I should have mentioned. This would indeed be fairly easy to do in a dialog-based app, but my app is SDI.
I'm thinking there must be some way of subclassing a splitter window to give it a title bar, but I haven't been able to find it.
|
|
|
|
|
Hi
I'm having some problems storing some values. Here is it:
I have a class with is derived from CObject. It just stores Variables !
<br />
CMyStoreClass : public CObject<br />
{<br />
CString m_strName;<br />
<br />
CUIntArray m_arFirstArray;<br />
CUIntArray m_arSecondArray;<br />
[...].br />
CUIntArray m_arSixthArray;<br />
}<br />
Then in my Dialog class I have a variable which shall store the CMyStoreClass Instances.
<br />
CPtrList m_Rules;<br />
To Add a Instance of CMyStoreClass:
<br />
CMyStoreClass store;<br />
store.m_strName = "Test";<br />
store.m_arFirstArray = 5;<br />
store.m_arSecondArray = 6;<br />
[...].br />
if(m_Rules.IsEmpty())<br />
m_Rules.AddHead(&store);<br />
else<br />
m_Rules.AddTail(&store);<br />
Everthing still works fine but now if i want to access the CMyStoreClass Objects again:
<br />
for(POSITION pos = m_Rules.GetHeadPosition();pos != NULL; )<br />
{<br />
CMyStoreClass* pStore = (CMyStoreClass*) m_Rules.GetNext(pos);<br />
ASSERT(pStore);<br />
if(pStore->m_strName != "Test") continue;<br />
}<br />
when my programm executes this lines it breaks and "strcmp.asm" opens and i get to "dodwords:".
I have no clue what's wrong. Anyone ? Any clue ?
MFG
RedDragon2kx
Unix and C are the ultimate computer viruses.
|
|
|
|
|
Have you stepped into CString 's != operator to see what is going on?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I gonna try this, but if i try:
<br />
MessageBox(pStore->m_strName);<br />
it fails, szText is marked as <badptr> in Debugger Window. It says:
CXX0030: Error: expression cannot be evaluated char
Unix and C are the ultimate computer viruses.
|
|
|
|
|
RedDragon2k wrote:
it fails,
Which means what?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|