|
It seems you've used message reflection to handle control notifications. If you want to give dialog a chance to handle them as well, use ON_NOTIFY_REFLECT_EX and return FALSE from handler defined in control class.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
1.How do I start my CFileDialog in a particular folder. Actually I want it to detect the folderthe app is in, and start off in that directory by default.
2. Same question a s above, but now I also want the name of a particular file in the app directory(known file) to be populating the File NAme box in CFileDialog.
Thanks,
I hope it can be done.
ns
Its the Open dialog
|
|
|
|
|
CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL );
where :
lpszFileName
The initial filename that appears in the filename edit box. If NULL, no filename initially appears.
try working on it!
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Okay. but how do we set the default directory? I havent tried your idea yet but I'm thinking I'll be entering stuff like:
lpszFileName = "file1.txt"<br />
with no directory info....
So am I missing something?
Thanks so much,
ns
|
|
|
|
|
CFileDialog has one struct like this:
typedef struct tagOFN { // ofn
DWORD lStructSize;
HWND hwndOwner;
HINSTANCE hInstance;
LPCTSTR lpstrFilter;
LPTSTR lpstrCustomFilter;
DWORD nMaxCustFilter;
DWORD nFilterIndex;
LPTSTR lpstrFile;
DWORD nMaxFile;
LPTSTR lpstrFileTitle;
DWORD nMaxFileTitle;
LPCTSTR lpstrInitialDir;
LPCTSTR lpstrTitle;
DWORD Flags;
WORD nFileOffset;
WORD nFileExtension;
LPCTSTR lpstrDefExt;
DWORD lCustData;
LPOFNHOOKPROC lpfnHook;
LPCTSTR lpTemplateName;
} OPENFILENAME;
lpstrInitialDir
could help u with something??
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Thanks. Thats great info. I didnt know that this struct existed, and really didnt see it mentioned in the CFileDialog documentation, at least at first glance.
Appreciate it,
ns
|
|
|
|
|
Great! Glad could be a help!
Papa
Murex Co.
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hello!
I saw the article about "Load, show and convert miscellaneous file-formats using freeimage
" in this codeproject site. The project is so great.. Gettting image file information is what I need. But I don't want to use MainFrame... Document.. or menu bar.. at all..
All I need is only file name..
So I create new testing Dialog based project Called, JPEGINFO,
Then I add following function..to my project.
<br />
BOOL CJPEGINFODlg::GetImageInfo()<br />
{<br />
FIMULTIBITMAP *m_pBitmapMP;<br />
FIBITMAP *m_pBitmap;<br />
<br />
m_pBitmap = NULL;<br />
m_pBitmapMP = NULL;<br />
CString msg,msg1,msg2;<br />
<br />
CString filename = "E:\\filesfolder\\two\\New Folder\\FaxMachines.JPG";
<br />
m_pBitmap = FreeImage_LoadJPEG(filename,JPEG_DEFAULT);
m_pBitmapMP = FreeImage_OpenMultiBitmap(FIF_JPEG,filename,false,false,false);<br />
<br />
if( !m_pBitmap )<br />
{<br />
MessageBox( "Sorry couldn't open!!");<br />
return false;<br />
<br />
}<br />
<br />
return true; <br />
}<br />
But I got following errors..
<br />
<br />
--------------------Configuration: JPEGINFO - Win32 Debug--------------------<br />
Compiling...<br />
JPEGINFODlg.cpp<br />
Linking...<br />
JPEGINFODlg.obj : error LNK2001: unresolved external symbol __imp__FreeImage_OpenMultiBitmap@20<br />
JPEGINFODlg.obj : error LNK2001: unresolved external symbol __imp__FreeImage_LoadJPEG@8<br />
Debug/JPEGINFO.exe : fatal error LNK1120: 2 unresolved externals<br />
Error executing link.exe.<br />
<br />
JPEGINFO.exe - 3 error(s), 0 warning(s)<br />
I included "freeimage.h" to my project though.
i don't know why I can't run. Would you please help me...
Thank you so much..
|
|
|
|
|
the LNK2001 Error shows when the Linker cannot find the label,function or variable in all the object files/libs that searches...
or a missing function body
look that...
Renjith-CPian.
|
|
|
|
|
I'm working on a multi threaded (32 threads) application thats really intense on the tcp/ip stack, i.e. using a lot of sockets (up to 64 at) once, each thread is using 2 sockets, one for receive and one for send. how do I make it not eat up all the free sockets? after some time the program has ran and created/closed lots of sockets, i cant connect to anywhere from my machine, everything is denied, im suspecting my app eats up all the socket space or something.. but I do closesocket() on each socket i finish using.
Anyone knows what can I do to solve this?
Cheers,
Magey.
|
|
|
|
|
i think that may bcz of u forget to deallocate the previously allocated objects in your app..
review your code for find them..There is no other way,bcz i dunno how you implement that....
Renjith-CPian.
|
|
|
|
|
I'm back with the continuing sage of my error messages. Just got this one and I really don't know where to begin to look. Any ideas? Thanks in advance.
--------------------Configuration: hw1 - Win32 Debug--------------------
Linking...
hw1.obj : error LNK2001: unresolved external symbol "void __cdecl Input_Data(struct Diver_Info * const)" (?Input_Data@@YAXQAUDiver_Info@@@Z)
Debug/hw1.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
hw1.exe - 2 error(s), 0 warning(s)
Nick Parker
|
|
|
|
|
You have prototype of the function, but there's no function definition. Maybe you've forgot about const in argument list.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Hmmm...ok. I have only one, well two of the functions written now. Inside main looks like this:
#include "hw1.h"
void main()
{
Diver_Info theDivers[Total_Divers];
cout << "Loading list of divers from file.\n";
Input_Data(theDivers);
cout << "Computing scores of divers.\n";
cout << "Creating a report of divers information.\n";
cout << "Sorting scores in descending order.\n";
cout << "Writing the output file of divers.\n";
}
I have the function defined in another file, but it looks like this:
#include "hw1.h"
void Input_Data(Diver_Info theDivers[])
{
int DiverCount = 0;
ifstream inputFile;
inputFile.open(ListOfDivers, ios::in);
inputFile.get(theDivers[DiverCount].Diver_Name, 80);
while(! inputFile.eof())
{
for(int i = 0; i < Num_Of_Dives; i++)
{
inputFile >> theDivers[DiverCount].Dives[i].difficulty;
for(int j = 0; j < Num_Of_Scores; j++)
{
inputFile >> theDivers[DiverCount].Dives[i].scores[j];
}
}
DiverCount++;
inputFile.ignore(100, '\n');
inputFile.get(theDivers[DiverCount].Diver_Name, 80);
}
inputFile.close();
}
void Calculate_Totals(Diver_Info theDivers[])
{
float Score, Max_Score, Min_Score;
for(int i = 0; i < Total_Divers; i++)
{
theDivers[i].Total_Score = 0.0f;
for(int g = 0; g < Num_Of_Dives; g++)
{
Max_Score = 0.0f;
Min_Score = 10.0f;
Score = 0.0f;
for(int h = 0; h < Num_Of_Scores; h++)
{
Score += theDivers[i].Dives[g].scores[h];
if(theDivers[i].Dives[g].scores[h] < Min_Score)
{
Min_Score = theDivers[i].Dives[g].scores[h];
}
if(theDivers[i].Dives[g].scores[h] > Max_Score)
{
Max_Score = theDivers[i].Dives[g].scores[h];
}
}
theDivers[i].Total_Score += (Score - Max_Score - Min_Score) * .6f * theDivers[i].Dives[g].difficulty;
}
}
}
Does something look missing?
Nick Parker
|
|
|
|
|
In the header file I have the other function prototypes commented out.
#ifndef HW1_H
#define HW1_H
#include <fstream.h>
#include <iomanip.h>
#define ListOfDivers "divers.dat"
#define OutputFile "output.dat"
#define ReportFile "report.dat"
const int Total_Divers = 24;
const int Best_Divers = 12;
const int Num_Of_Dives = 10;
const int Num_Of_Scores = 7;
struct Dive_Stats
{
float difficulty;
float scores[Num_Of_Scores];
};
struct Diver_Info
{
char Diver_Name[80];
Dive_Stats Dives[Num_Of_Dives];
float Total_Score;
};
void Input_Data(Diver_Info []);
#endif
Nick Parker
|
|
|
|
|
|
|
Oh boy, I am ashamed to admit this, really, please don't hold it against me......PLEASE. I am blaming it on the fact that classes started again on Monday. I am also hoping and praying that for x periods of time as I would look through various pages of code that I was going temporarily blind.
I just needed to include "hw1f.cpp".
#include "hw1.h"
#include "hw1f.cpp"
void main()
{
Diver_Info theDivers[Total_Divers];
cout << "Loading list of divers from file.\n";
Input_Data(theDivers);
cout << "Computing scores of divers.\n";
Calculate_Totals(theDivers);
cout << "Creating a report of divers information.\n";
Create_Report(theDivers);
}
Thanks for all the help this morning though, hopefully I have all the cobwebs cleaned out.
Nick Parker
|
|
|
|
|
Instead of #including .cpp file, you should add it to the project. But maybe it's the content of the next class
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
No, this is just a refresher application to "wake us up" from the summer. There aren't any assigned points (yet). HELLO MY NAME IS NICK, I AM AWAKE NOW Thanks for all your help.
Nick Parker
|
|
|
|
|
I would like to create a tree class, which has associated with each child item a structure of various flags, etc. Can someone point me in the right direction for this?
I'm not sure how, in deriving my new class from CTreeCtrl, I could access the nodes to add this new structure. (Assuming of course that would be the right path)
Thanks in advance!!
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
Well, you *can* associate data with CTreeCtrl items. Use CTreeCtrl::GetItemData and CTreeCtrl::SetItemData for that.
The question is, however, if you really should go this way. Do you just want to have in-memory tree, or displaying contents in window is essential?
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
I have a tree which is essentially a project file structure. With each file(leaf/node) in the tree I would like to track several flags and strings.
I don't need to display this extra info, just access it for a variety of tasks performed on these files.
Are you suggesting to just create a duplicate tree, that has nodes defined to hold my structure?
BW
{insert witty/thought-provoking saying here}
|
|
|
|
|
If you already have a CTreeCtrl/CTreeView in your project, and you just want to add extra data to tree items, then Set/GetItemData is the way to go.
If you don't have CTreeCtrl and you're not going to display your tree in window, then you should rather create the tree yourself - it'll be trivial.
Tomasz Sowinski -- http://www.shooltz.com
Free your mind and your ass will follow.
|
|
|
|
|
Thanks, again.
BW
{insert witty/thought-provoking saying here}
|
|
|
|