|
If your program uses MFC check to see if you linked MFC statically or if you linked to use the shared DLL. If you linked to use the shared DLL then you need to have those DLL's in the path.
Another thing to look at...Did you use any ActiveX controls, if so, then you need to have those accessible
Gary Kirkham
A working Program is one that has only unobserved bugs
|
|
|
|
|
|
When I use TextOut() to display a string, the string is displayed horizontally. So I create a font with lfEscapement & lfOrientation = 900. And select it to the CDC object. I think the string should be displayed vertically. Unfortunately, it isn't displayed vertically.
How can I do that?
Thanks in advance.
Vincent
|
|
|
|
|
Did you check the return value from CreateFont? There may be some other problem...show us some code
Gary Kirkham
A working Program is one that has only unobserved bugs
|
|
|
|
|
1. Make sure it's a TrueType font.
2. If it still doesn't work, please post some code.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Dear Alvaro,
Thank you very much. After I added "lf.lfOutPrecision = OUT_TT_ONLY_PRECIS;", it worked.
Thanks again
Vincent
|
|
|
|
|
For some reason when i try to delete a node and print out the remaining list its prints a bunch of numbers i dont need
The list after deleting 92:
6685124 82 62 72 99
The list after deleting 72:
6685124 82 62 7801996 99
i need it to display like this
The list after deleting 92:
82 62 72 99
The list after deleting 72:
82 62 99
u can see what i need to get rid of.
heres is some code that i think could be the problem, and by the way this list is circular! if this isent enough code please say so
void ClosedList::Delete(int item)
{
NodeType* delPtr;
NodeType* currPtr;
if (item == head->component)
{
delPtr = head;
head = head->link;
}
else
{
currPtr = head;
while (currPtr->link->component != item)
{
currPtr = currPtr->link;
}
delPtr = currPtr->link;
currPtr->link = currPtr->link->link;
}
delete delPtr;
}
here is my print function
void ClosedList::Print() const
{
NodeType* currPtr = head->backlink;
if(!IsEmpty())
{
do
{
cout << currPtr->component << " ";
currPtr = currPtr->backlink;
}while (currPtr!= head);
cout << currPtr->component << " ";
}
cout <<endl;
bool ClosedList::IsEmpty() const
{
return (head == NULL);
}
|
|
|
|
|
I just ripped this out of an old assignment, you might try something like this as I know it works. Keep in mind this is only for a singly linked-list.
int records::DeleteNode(double num)
{
ListNode *NodePtr, *PreviousNode, *BufPtr;
bool bIsFound;
BufPtr = head;
while(BufPtr != NULL)
{
if(BufPtr->ssan == num)
{
bIsFound = true;
}
else
{
bIsFound = false;
}
BufPtr = BufPtr->Next;
if(bIsFound == true)
BufPtr = NULL;
}
if(bIsFound == false)
return -1;
if(!head)
return -1;
if(head->ssan == num)
{
NodePtr = head->next;
delete head;
head = NodePtr;
}
else
{
NodePtr = head;
while(NodePtr != NULL && NodePtr->ssan != num)
{
PreviousNode = NodePtr;
NodePtr = NodePtr->next;
}
PreviousNode->next = NodePtr->next;
delete NodePtr;
}
return 0;
}
Nick Parker
Not everything that can be counted counts, and not everything that counts can be counted. - Albert Einstein
|
|
|
|
|
Actually this is a two part question.
My first question is to anyone who has used the MSFlexGrid control in their software. In my MDI the resource file is huge. And I believe it is because of the flexgrid. Because this file is so huge it takes a long time to recompile the program. I am asking is there a way to reduce this time.
My second question is the program I am working on was developed awhile ago and it will only execute on a machine the has Visual Studio on it. But I have taken the proper steps so that this should not happen. Yet it still does.
Please help.
Matt
|
|
|
|
|
Hi All,
I'm looking for an all-inclusive article or series of articles or a reference book of somesort on iostream and its uses, along with throughough documentation on cout and cin. I need to at least start using these but I really don't know how and am having a hard time finding information about it. Thought this is a good place to ask.
any comments or suggestions is greatly appreciated.
Thank you.
|
|
|
|
|
groover4life wrote:
I'm looking for an all-inclusive article or series of articles or a reference book of somesort on iostream and its uses
This[^] is an excellent reference.
Nick Parker
Not everything that can be counted counts, and not everything that counts can be counted. - Albert Einstein
|
|
|
|
|
Oh yeah. Much better. Thanks alot!!! now I have another whole website.
Thank you!!
|
|
|
|
|
hi All,
I'm looking for an article and/or source code for a super fast search algorithm. I'm traversing a directory searching for certain files, but there is a huge amount of files involved and I need to group the files together. I need to be able to do this preferably using a super fast search method.
Any help is greatly appreciated.
thank you.
|
|
|
|
|
So you're only searching for specific file names?
There are two ways that come to mind:
1. Use the FindFirstFile and FindNextFile APIs. You can also go with the CFileFind class, which is probably only a little less efficient than calling the APIs directly. As you read the file names, organize them into groups.
2. Do a "DIR" into a file:
WinExec("dir /b > zzFiles.txt", SW_HIDE);
Read each line of zzFiles.txt up to the last one (which should be zzFiles.txt) and get the file names from there. I haven't timed it, but I bet the first approach is more efficient.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Right, That's actually what I am doing right now is using the FindFirstFile and FindNextFile. So I'm not really searching for 1 specfic filename. I'm writing a custom "windows explorer" which requires me to take a series of files in a directory and group them togther, display the master file.
So at this time, I'm searching through the directory several times:
- once to find the master files
- then one time for every master file I have found
So, there could be 5,000 files in the directory with say, 50 master files. This would result in traversing the directory 50+1 times, totalling 51 independent searches in 1 directory.
Becuase of this, I am looking to figure out a method that requires searching the directory only once, and group the files as I go using an container class or something. But I don't know enough about STL yet and it would take too long to write 1 up on my own.
Sorry I wasn't this clear the first time. but that is my real delimea. What I want to do is use STL in such a way that I could just traverse the directory once, creating a map such as:
master_file1: file1, file2, file3
master_file2: file1, file2, file3
Any ideas? Anyone? Thanks alot!
|
|
|
|
|
OK, so you need a map of vectors:
1. Define your types
using namespace std;
typedef string FileName;
typedef vector< FileName > FileNames;
typedef auto_ptr< FileNames > FileNamesPtr;
typedef map< FileName, FileNamesPtr > MasterToFileNamesPtrMap;
2. Then you can use:
MasterToFileNamesPtrMap map;
FileNamesPtr pFN(new FileNames);
pFN->push_back(fileName);
map[masterFileName] = pFN;
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
Isn't that Simple.... Thanks. I've been reading up on STL. I think I'm gonna start using it. I have lots of uses for it. Just have to learn more.
Thank you very much for your help. The example you gave helps alot in explaining a solution to my problem, but more importantly helps me understand STL much more as it is applied to one of my specific applications.
Thank you. I appreciate it greatly Alvaro.
|
|
|
|
|
typedef std::list<std::string> FileList;
typedef FileList::iterator FileListIterator;
struct SortByDate : public std::binary_function<std::string, std::string, bool>
{
public:
SortByDate(const char* dir) : m_dir(dir) {}
bool operator()(const std::string& lhs, const std::string& rhs)
{
struct stat st = {0};
std::string filename = m_dir;
filename += "\\";
filename += lhs;
if (stat(filename.c_str(), &st) == -1)
{
return true;
}
int lhs_ctime = st.st_ctime;
filename = m_dir;
filename += "\\";
filename += rhs;
if (stat(filename.c_str(), &st) == -1)
{
return false;
}
int rhs_ctime = st.st_ctime;
return lhs_ctime < rhs_ctime;
}
private:
const char* m_dir;
};
bool GetDirectoryList(const char* dir, FileList& fileList)
{
DEBUGF("GetDirectoryList %s", dir);
HANDLE hSearch;
WIN32_FIND_DATA FindData;
char tmpDir[MAX_PATH*2];
lstrcpy(tmpDir, dir);
lstrcat(tmpDir, "\\*.*");
hSearch = FindFirstFile(tmpDir, &FindData);
if (INVALID_HANDLE_VALUE == hSearch)
{
return false;
}
do
{
if (!(FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{
fileList.insert(std::upper_bound(fileList.begin(),
fileList.end(),
FindData.cFileName,
SortByDate(dir)),
FindData.cFileName);
}
}
while (FindNextFile(hSearch, &FindData));
FindClose(hSearch);
return true;
}
Here's a simple example. You can exclude the SortByDate function if you like. I should have made it more STL like but didn't have time.
Todd Smith
|
|
|
|
|
Hi guys
Do tyou know the way that when CFileDialog is called it goes to the last visited directory (or last directory shown when CFileDialog was called last time).
Best regards and Mery Christmas.
Dr. PI
|
|
|
|
|
The way I do it, is to save the path for the last file my application opened in the registry. Then the next time I need to load the file dialog, I extract the path from the registry and use it to set the dialog's m_ofn.lpstrInitialDir...before I call DoModal
Gary Kirkham
A working Program is one that has only unobserved bugs
|
|
|
|
|
Gary Kirkham wrote:
A working Program is one that has only unobserved bugs
You are the only person I've found online who echoes this sentiment which is near and dear to my heart. My CP sig used to be the same as my email sig, which is "There is always one more bug...".
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Another one in that vein:
Every computer program has at least one bug and can be shortened by one instruction...from which, by induction, one can assert that every program can be reduced to one instruction which doesn't work.
Gary Kirkham
A working Program is one that has only unobserved bugs
|
|
|
|
|
Hmm, that would imply a program with zero instructions is buggy.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi -
I have a question which is probably very simple...
I'm trying to build an application which requires an open-file dialog like the explorer in windows (or like any other app that works with files). I want to use Windows Forms in Visual C++.net.
Does anyone have some canned code that generates an open-file dialog with a TreeView to the left and a ListView to the right, that allows the user to select a file from the ListView by clicking on the appropriate icon?
I would be very, very grateful!
Thanks,
KBL
|
|
|
|
|
When should I go for a win32 application instead of an MFC application?
Where could I find a good online tutorial about win32 programming? And MFC?
Thanks so much!
-- naradaji
|
|
|
|