|
Hi there.
I have created an MDI program, and I need to know, where do I add the filters used when a user does a File->Open? Sorry if this is an inane question, but I'm used to using Borland C++ Builder, and obviously VS .Net does things differently.
Thanks!
James A Beggs
American Quarter Horse Association
Manager of Product Development
|
|
|
|
|
Are you using CFileDialog or GetOpenFileName()?
|
|
|
|
|
I, uhm.... dont know?
I used the wizard to generate an automatic MDI for me, and it set up the parent's menu system and everything. It had a section in the wizard for inputting the file name to open, but I decided to add more to it.
The main application class inherits from CWinApp. The wizard automatically created a Message Map that maps its file->open to CWinAPP::OnFileOpen
(Man, I feel stupid. I wouldn't think working on something so simple would have been so hard when translating from Borland C++ Builder to VS .Net. I guess C++ Builder's RAD spoiled me :/ )
James A Beggs
American Quarter Horse Association
Manager of Product Development
|
|
|
|
|
Sounds like you simply need to modify the IDR_MAINFRAME string in the resource file.
|
|
|
|
|
Well... it has a string in the string table, IDR_ImageFileMasterTYPE (the name if the application is Image FileMaster), and it contains the string that is listed when you do a File->Open, including a path, a filter, etc.
But, in modifying the string so that it contained more than one filter made no difference; it listed the new string in the file->open dialog, but didn't actually show the new file extensions.
James A Beggs
American Quarter Horse Association
Manager of Product Development
|
|
|
|
|
Probably because an MDI app, by default, does not know how to handle more than one file type. Read MSDN article Q141921.
|
|
|
|
|
Well, how irritating. I changed the string, as it said, but according to the article, it wasn't enough. Oh well, thanks for the pointer to the article!
James A Beggs
American Quarter Horse Association
Manager of Product Development
|
|
|
|
|
James A Beggs wrote:
I changed the string, as it said, but according to the article, it wasn't enough.
Right, you must implement at least the first four steps in order to achieve the desired results. Simply changing the string does nothing. I would suggest stepping through the MFC code for opening documents to see what is going on. Knowing how/why MFC does what it does is always helpful.
|
|
|
|
|
I think I'll also be getting a book on MFC, as I haven't really worked with it either.
Thanks again.
James A Beggs
American Quarter Horse Association
Manager of Product Development
|
|
|
|
|
Actually, could you suggest a good book on MFC?
James A Beggs
American Quarter Horse Association
Manager of Product Development
|
|
|
|
|
"Good" is in the eye of the reader! I have Kruglinski's Inside Visual C++ (which includes nothing for v6), and Mastering MFC Development Using Microsoft Visual C++ 6.0 by Microsoft Press.
I believe all books are intended for a particular target audience. I've read very little of either book because most of what they contain I've known about simply by using MFC from its inception (see my earlier note on stepping through code). I'm no MFC expert, and probably learn 1-2 new things about it each week.
|
|
|
|
|
I want to install the "Standard 19200 bps Modem" in Windows
programmatically and set some modem properties like "Use flow control" (AT commands)
etc .
Any pointers would be very helpful.
Regards,
Ajith
|
|
|
|
|
Hi all
How do I measure the time taken to execute a function? I'm working on a real time project at the moment so I want to know how fast my program would go. I've noticed the function time(time_t *) but I don't know how it works. Can anybody please give me some codes on how to use it?
Thanks a lot
|
|
|
|
|
Heres an article i wrote a while back, it should give a good idea how to clock your functions.
http://www.codeproject.com/cpp/profiler.asp
Cheers
"Two wrongs don't make a right, but three lefts do!" - Alex Barylski
|
|
|
|
|
For Win32/x86 the most accurate is:
class CHPFCounter
{
public:
__int64 m_started;
void Start()
{
LARGE_INTEGER li;
QueryPerformanceCounter(&li);
m_started = li.QuadPart;
}
double Time()
{
LARGE_INTEGER li;
QueryPerformanceCounter(&li);
__int64 ticks =li.QuadPart - m_started;
QueryPerformanceFrequency(&li);
double seconds = (double) ticks / li.QuadPart;
return seconds;
}
};
Time() returns time in seconds (resolution is around CPU clock).
However, it's recommended to
a) measure each snippet multiple times, to see variations
b) verify the assembly that you indeed measure what you think you measure
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
hi you can do profiling ,
see the article at
http://www.codeproject.com/useritems/profiling_isapi.asp
regards
tarun
|
|
|
|
|
Using time(time_t *) is easy. time_t is declared as typedef long time_t . The function time(...) returns the time elapsed in seconds from the start of the system's calender. On my system, it returns how many seconds elapsed since 00:00:00 1/1/1980. To use this function to calculate time difference, you may look at double difftime ( time_t timer1, time_t timer0 ) . I believe that using clock_t clock() would give much more accurate results. For example, write:
clock_t start, finish;
start = clock()
finish = clock()
cout << "The function took " <<
double(finish - start) / CLOCKS_PER_SECOND <<
" seconds.\n";
<marquee>Hosam Aly Mahmoud
|
|
|
|
|
I have 2 program listings as a function in VB6. I want that function run in C++ Builder6, but i confuse the way to access FileSystemObject and type, DateLastModified of a file and to initiate interval variable with the type Date
//--------------------------------------------------------------------------
Function del()
Dim a As FileSystemObject
Dim d As Folder
Dim c As file
Set a = New FileSystemObject
Set d = a.GetFolder("d:\oracle\admin\" & HOST.Text & "\udump\")
For Each c In d.Files
If c.Type = "TRC File" Then
c.Delete True
End If
Next
End Function
//-----------------------------------------------------------------------------
Function newest() As file
Dim a As FileSystemObject
Dim d As Folder
Dim c As file
Dim interval As Date
interval = #12/12/2012#
Set a = New FileSystemObject
Set d = a.GetFolder("d:\oracle\admin\" & HOST.Text & "\udump\")
For Each c In d.Files
If (interval > (Now() - c.DateLastModified)) Then
interval = (Now() - c.DateLastModified)
If c.Type = "TRC File" Then
Set newest = c
End If
End If
Next
End Function
//--------------------------------------------------------------------------
Thx for helping me;)
|
|
|
|
|
Hi,
I want to get the user account information from the local machine. For this I'm using NetUserGetInfo method. Moreover I want to know if a particular user account has been disabled or not. I went through some Network Management Structures but din't come across any structure that would explicitly provide me with this info. Kindly anybody tell me how to extract this info from Windows using Net API.
Thanks
Abhishek.
Learning is a never ending process of Life.
|
|
|
|
|
Look at the usri2_flags member of the USER_INFO_2 structure.
|
|
|
|
|
Hi all,
I want to use a tab control inside apropertyPage,but i have absolutly no idea
about how to use a tab control in MFC.Can i get a step by step Tutorial to add a tab control and adding controls to each tab.I searched the web ,but couldn't found a good tuto.Any help would be appreciated.
|
|
|
|
|
Are you talking about a property sheet that contains multiple property pages? If so, take a peek at CPropertySheet and CPropertyPage.
|
|
|
|
|
Thanks a lot John and David,
I solved my problem
|
|
|
|
|
Hi ,
I again have a problem,i have this modal tabbed Dialog inside a propertyPage,I want this tabbed sheet as a fixed position(unmovable,unresizable).
|
|
|
|
|
NOTE:
If you don't know how Property sheets work, continue reading, if you already know, don't continue...
Well, a "CPropertySheet" it's a container class, it contains several "CPropertyPage"s.
in order to make it work you must follow those easy steps:
1. Create a dialog for each "page" you need.
2. Place all the controls inside the dialog using the resource editor.
3. Then you'll need to map all the messages you need, in order to do so, create a class for the newly created and populated dialog, and select the class CPropertyPage.
4. Repeat step 2 and 3 until you've finished to populate/define the recently created property pages (dialogs).
5. Now you must create a new class from the class wizard, select the base class CPropertySheet.
6. Modify the newly CPropertySheet in order to add the required pages in it's constructor.
7. Call the property sheet from your code.
this is how it works...
if you need more help on this topic, e-mail me...
hope this helps...
|
|
|
|