Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Another Question (Dialog Box)

  • 26-05-2004 1:54pm
    #1
    Registered Users, Registered Users 2 Posts: 1,253 ✭✭✭


    Satchmo was already very good to answer my last question.
    (here -> http://boards.ie/vbulletin/showthread.php?s=&threadid=163299)

    Also, I mentioned that I would have more. So here we go!

    I have been implementing the search facility by presenting the use with a list of drives and an option to enter a path. My boss thinks that it would be much better if you could click on a button and have a dialog box appear similar to the search box from windows where you can be very accurate about where to search. (I also think it would be better)

    Problem is there does not seem to be a standard MFC class for such a dialog box or am i wrong??????????

    The only thing I can see that is remotely close is the CFindReplaceDialog which seems to be for searching for text within a document.

    Is there a standard dialog for this or will I have to create one?

    Any help would be appreciated! :)


Comments

  • Registered Users, Registered Users 2 Posts: 1,253 ✭✭✭gobby


    I think I will take that as a 'Yes, you must make your own you lazy git' then :dunno:


  • Registered Users, Registered Users 2 Posts: 2,243 ✭✭✭zoro


    I think I will take that as a 'Yes, you must make your own you lazy git' then :dunno:
    :lol:
    :D

    Relax mate :) Try google - if you can't find your answer there then check back here again. Not every one is a C++ head *waves Java rulezzz 4eva flag* :)


  • Registered Users, Registered Users 2 Posts: 1,253 ✭✭✭gobby


    Originally posted by zoro
    :lol:
    :D

    Relax mate :) Try google - if you can't find your answer there then check back here again. Not every one is a C++ head *waves Java rulezzz 4eva flag* :)
    Heh... Yeah, I guess your right on that one. Well, I'm off home so will see what I can dig up tomorrow.


  • Registered Users, Registered Users 2 Posts: 1,481 ✭✭✭satchmo


    Sorry, haven't done any MFC so can't help you here! However I'm sure the answer you're looking for is buried somewhere in the MSDN Library, all you have to do is find it!


  • Registered Users, Registered Users 2 Posts: 1,253 ✭✭✭gobby


    Originally posted by satchmo
    Sorry, haven't done any MFC so can't help you here! However I'm sure the answer you're looking for is buried somewhere in the MSDN Library, all you have to do is find it!
    No worries. I will have a look around and possibly somebody in my workplace can help out. Thanks anyways! :)


  • Advertisement
  • Closed Accounts Posts: 2,313 ✭✭✭Paladin


    All your dialog classes:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_Dialog_Box_Classes.asp

    Depending on what way you go about this there is more than one way to skin a cat as it were...

    As I have no idea what youre doing you will know which of these suits best.


  • Registered Users, Registered Users 2 Posts: 1,253 ✭✭✭gobby


    Originally posted by Paladin
    All your dialog classes:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_Dialog_Box_Classes.asp

    Depending on what way you go about this there is more than one way to skin a cat as it were...

    As I have no idea what youre doing you will know which of these suits best.
    I have looked here and in my local MSDN help library. Neither seem to have what I am after. This is bad! I am extremly close to finishing the application and as such I really want to finish it so I can move on.


  • Registered Users, Registered Users 2 Posts: 95 ✭✭Mr.StRiPe


    sorry you got me on a busy day so didn't have time to create simple example! but the following code does what you want. At least you should have something to lookup in msnd anyway :)
    
    //Have this as a global variable
    HWND g_hMDIClient = NULL;
    
    //hInst is (HINSTANCE hInst) from winmain()
    SetUpMDIChildWindowClass(hInst);
    
    	CLIENTCREATESTRUCT ccs;
                    //main is the HWND of the main window initialised from winmain()
    	ccs.hWindowMenu  = GetSubMenu(GetMenu(main), 2); 
    	ccs.idFirstChild = ID_MDI_FIRSTCHILD;
    
    	
    
    g_hMDIClient = CreateWindowEx(WS_EX_CLIENTEDGE, "mdiclient", NULL,
    									WS_CHILD | WS_CLIPCHILDREN | WS_VSCROLL | WS_HSCROLL | WS_VISIBLE,CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,main, (HMENU)IDC_MAIN_MDI, GetModuleHandle(NULL), (LPVOID)&ccs);
    
    	if(g_hMDIClient == NULL)
    		MessageBox(main, "Could not create MDI client.", "Error", MB_OK | MB_ICONERROR);
    
    
    // Call this when you want to open dialog box outside of winmain
    
    HWND hChild = CreateNewMDIChild(g_hMDIClient);
    	if(hChild)
    	{
    								DoFileOpen(hChild);	
    	}
    
    
    void DoFileOpen(HWND hwnd)
    {
    	OPENFILENAME ofn;
    	char szFileName[MAX_PATH] = "";
    
    	ZeroMemory(&ofn, sizeof(ofn));
    
    	ofn.lStructSize = sizeof(ofn);
    	ofn.hwndOwner = hwnd;
    	ofn.lpstrFilter = "Neural Network Files (*.net)\0*.net\0All Files (*.*)\0*.*\0";
    	ofn.lpstrFile = szFileName;
    	ofn.nMaxFile = MAX_PATH;
    	ofn.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY;
    	ofn.lpstrDefExt = "txt";
    
    	if(GetOpenFileName(&ofn))
    	{
                     //Put whatever function you want here thats takes the filepath as a string
    		OpenNeuralNetwork(szFileName);
    	}
    }
    
    


  • Registered Users, Registered Users 2 Posts: 1,253 ✭✭✭gobby


    Wow, cheers Mr.StRiPe. I am heading home now but I think that tomorrow I will have a lot to try. I had also found some examples on MSDN but they were not as good as that.


  • Registered Users, Registered Users 2 Posts: 1,253 ✭✭✭gobby


    Hmmm.....

    Okay. So I have looked at this code and also at some more code from MSDN help files. I am still very unsure of how this should work. Perhaps I can be a little more specific about what it is that I am trying to do.

    What I want is a 'Browse for Folder' dialog box similar to when adding a folder of mp3's to Winamp, for example.

    There seems to be some pre constructed dialog boxes such as for opening/saving a file or printing a document but nothing like what I am searching for.

    The way I have my 'Search' dialog implemented at the moment is that the user is presented with a list of drives and the option of selecting a drive and also entering a path.

    One problem is that in my company people will quite often need to search network locations and as it is, my application does not support this.

    What would be ideal is a dialog box that is similar to the windows search facility. Specifically when you select 'Browse' in the 'Look in:' drop box.

    I should mention that I am a student and my C++ skills may not be quite as good as I would like. Hence, trying to make sense of someone elses code can take me some time.

    My boss is aware of what I am trying to achieve and is currently in contact with some collegues in Stuttgart so hopefully they might have some classes/resources already written but in the meantime I would like to get a better idea of what must be done to achieve what I want to do....

    (Public holliday in Germany on Monday so it might be Tuesday before I am able to reply to any posts here. :D )

    Again, thanks for all the replys and I am sorry for being rubbish with Visual C++ :D

    [edit] I have about a week to finish this and a couple of other issues...


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,426 ✭✭✭ressem


    How about the folder browser at
    http://www.codeproject.com/dialog/cfolderdialog.asp?df=100&forumid=3533&exp=0&select=266520

    I'm only going by the screenshots though.


  • Registered Users, Registered Users 2 Posts: 1,253 ✭✭✭gobby


    Originally posted by ressem
    How about the folder browser at
    http://www.codeproject.com/dialog/cfolderdialog.asp?df=100&forumid=3533&exp=0&select=266520

    I'm only going by the screenshots though.
    Actually man, thats brilliant! It has really pointed me in the right direction. I would never have found 'SHBrowseForFolder' otherwise!

    Cheers to everyone for the help! :D


Advertisement