i'm fed up with the #$&#$% open dialog

This is a discussion on i'm fed up with the #$&#$% open dialog within the Windows Programming forums, part of the Platform Specific Boards category; I know this seems far out, but do you it could just be my computer?...

  1. #16
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,534
    I know this seems far out, but do you it could just be my computer?
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  2. #17
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Could be your computer, or perhaps the graphics drivers in your machine.

    Another possibility is if you are not using the same language as others, that there is some bug in the language implementation. If you have another computer that you could try on, perhaps that would help.

    I also think there is some flag to turn off the "yellow info box", perhaps you can do that and work around the problem?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #18
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,534
    It is totally my computer! I just tried it on my parent's computer and it worked just fine!

    >> I also think there is some flag to turn off the "yellow info box", perhaps you can do that and work around the problem?
    I've already looked and I didn't find anything. I'll check again.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  4. #19
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,170
    Quote Originally Posted by Yarin View Post
    I've already looked and I didn't find anything. I'll check again.
    No such flag. I doubt it would be possible anyway since the open file dialog basically uses Explorer's implentation, and the tooltips are probably shell extensions...
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

  5. #20
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,607
    Have you made any registry changes for the .pc file extension?

    [Edit]Look in your registry under HKEY_CLASSES_ROOT\.pc anything there?[/Edit]

    gg
    Last edited by Codeplug; 01-31-2008 at 10:38 AM.

  6. #21
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,534
    The key .pc is there, but there's nothing in it.
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  7. #22
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,607
    In regedit, with the ".pc" key selected, is there any data for the "(Default)" key?

    gg

  8. #23
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,534
    No, not at all. It's data is "(value not set)"
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  9. #24
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,607
    You could try deleting that .pc key - although having it there didn't cause me any problems.

    Another easy thing you can do get a Dr. Watson dump of the crash. Do the following (assuming XP):
    1. Start->Run->sysdm.cpl, "Advanced" tab, "Error Reporting" button, Enable error reporting for Programs ("Choose Programs" button, All programs)
    2. Start->Run->drwtsn32.exe, Check "Create Crash Dump File". Set an easily accesable log file path as well. If there is already a drwtsn32.log in the log file path, then delete it.
    3. Reproduce the crash. Attach drwtsn32.log to this thread.
    gg

  10. #25
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Well, it does crash for me - after I created a pc file.

    May-be you could show the full source code?
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  11. #26
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,534
    gg, I'll do that then. Somthing I do know is that the actuall crash occures in shell32.dll.

    >> May-be you could show the full source code?
    Well, you already have the DoOpenDialog(), so I'll just show you my window's callback. I don't see how anything else could be of use.
    Code:
    LRESULT CALLBACK WindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
       switch(message)
       {
          case WM_CREATE:
          {
             windows = 0;
             CreateChild(hwnd, "EDIT", NULL, TEXTAREA_STYLE | 8, 0, 0, 0, 280, 380);
             CreateChild(hwnd, "EDIT", NULL, TEXTAREA_STYLE | ES_READONLY, 0, 320, 0, 280, 400);
             CreateChild(hwnd, "EDIT", "KEY", ES_AUTOHSCROLL | 8, WS_EX_STATICEDGE, 0, 380, 280, 20);
             CreateChild(hwnd, "BUTTON", "E\r\nN\r\nC", BS_MULTILINE, 0, 280, 0, 40, 80);
             CreateChild(hwnd, "BUTTON", "D\r\nE\r\nC", BS_MULTILINE, 0, 280, 80, 40, 80);
             CreateChild(hwnd, "BUTTON", "L\r\nO\r\nA\r\nD", BS_MULTILINE, 0, 280, 160, 40, 80);
             CreateChild(hwnd, "BUTTON", "S\r\nA\r\nV\r\nE", BS_MULTILINE, 0, 280, 240, 40, 80);
             CreateChild(hwnd, "BUTTON", "I\r\nN\r\nF\r\nO", BS_MULTILINE, 0, 280, 320, 40, 80);
             CreateChild(hwnd, "STATIC", WAIT_TEXT, SS_CENTER, WS_EX_STATICEDGE, 500, 175, 200, 50);
             ShowWindow(window[8], SW_HIDE);
             return 0;
          }
          case WM_COMMAND:
          {
             if(LOWORD(wParam) == 5003 || LOWORD(wParam) == 5004) // encrypt or dectrypt button
             {
                int keysize = GetWindowTextLength(window[2]);
                char *keybuff = new char[keysize];
                GetWindowText(window[2], keybuff, keysize);
                int bdw = GetWindowTextLength(window[0]);
                char *buff = new char[bdw];
                GetWindowText(window[0], buff, bdw + 1);
                if(LOWORD(wParam) == 5003) Encrypt(hwnd, buff, bdw, keybuff, keysize); // encrypt button
                else Decrypt(hwnd, buff, bdw, keybuff, keysize); // dectrypt button
                SetWindowText(window[1], buff);
                delete [] keybuff;
                delete [] buff;
                SetFocus(window[1]);
             }
             else if(LOWORD(wParam) == 5005) // load file button
             {
                char szfilename[401];
                if(!DoOpenDialog(hwnd, szfilename, 400)) return 0;
                char *buff = OpenCryption(hwnd, szfilename);
                if(!buff) {
                   MessageBox(hwnd, BAD_OPEN_TEXT, MB_TITLE, MB_ICONWARNING);
                   return 0;   }
                SetWindowText(window[0], buff);
                delete [] buff;
                SetFocus(window[0]);
             }
             else if(LOWORD(wParam) == 5006) // save file button
             {
                int ll, lt, nbdw = GetWindowTextLength(window[1]) + 1;
                char *buff = new char[nbdw];
                if(!buff) {
                   MessageBox(hwnd, "There is possibly not enough memory.", MB_TITLE, MB_ICONWARNING);
                   return 0;   }
                GetWindowText(window[1], buff, nbdw);
                DWORD bdw = DWORD(nbdw);
                if(!ncafilter(buff, bdw)) {
                   MessageBox(hwnd, ERR_SAVE_TEXT, MB_TITLE, MB_ICONWARNING);
                   return 0;   }
                if(bdw < 2) {
                   MessageBox(hwnd, NO_SAVE_TEXT, MB_TITLE, MB_ICONWARNING);
                   return 0;   }
                for(ll = 0; ll < bdw; ll++)
                   buff[ll] = getnca(buff[ll]);
                char szfilename[401];
                if(!DoSaveDialog(hwnd, szfilename, 400)) return 0;
                if(!SaveCryption(hwnd, szfilename, buff, bdw))
                   MessageBox(hwnd, BAD_SAVE_TEXT, MB_TITLE, MB_ICONWARNING);
                else
                   MessageBox(hwnd, SAVE_TEXT, PROGRAM_NAME, MB_ICONINFORMATION);
                delete [] buff;
                SetFocus(window[0]);
             }
             else if(LOWORD(wParam) == 5007) // information button
             {
                MessageBox(hwnd, INFO_TEXT, PROGRAM_NAME, MB_ICONINFORMATION);
             }
             return 0;
          }
          case WM_DESTROY:
          {
             int a;
             for(a = 0; a < windows; a++)
    		      DestroyWindow(window[a]);
             PostQuitMessage(0);
             bRunning = FALSE;
             return 0;
          }
          default:
             return DefWindowProc(hwnd, message, wParam, lParam);
        }
        return TRUE;
    }
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  12. #27
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,170
    On a side note, don't we agree that
    Code:
                if(!buff) {
                   MessageBox(hwnd, BAD_OPEN_TEXT, MB_TITLE, MB_ICONWARNING);
                   return 0;   }
    ...is a coding style to avoid? It's easier to read if you just placed down the bracket:
    Code:
                if(!buff) {
                   MessageBox(hwnd, BAD_OPEN_TEXT, MB_TITLE, MB_ICONWARNING);
                   return 0;   
                }
    You also seem to mixing several styles within the project? Hmmm. Is that such a good idea?
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

  13. #28
    The larch
    Join Date
    May 2006
    Posts
    3,573
    Code:
        int keysize = GetWindowTextLength(window[2]);
        char *keybuff = new char[keysize];
        GetWindowText(window[2], keybuff, keysize);
    Not 100&#37; sure, but your keybuff doesn't seem to have room for the terminating '\0'.

    It is quite possible that you are doing bad things to memory here and may-be in other places, so your application runs in the undefined behaviour.
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  14. #29
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,170
    Anon is correct. GetWindowTextLength returns the length of the string. It doesn't return the terminating '\0'.
    Code:
    GetWindowText(window[0], buff, bdw + 1);
    You allocate bdw characters, yet specify the max size (including the '\0') as bdw + 1, 1 more than you allocated.
    There's probably more.

    Btw, MSDN refers to '\0' as NULL character. As far as I understand, this is wrong?
    Last edited by Elysia; 01-31-2008 at 03:51 PM.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

  15. #30
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    It's technically a NUL character, but who's counting?

Page 2 of 3 FirstFirst 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Edit controls of a dialog from another dialog...
    By Snake in forum Windows Programming
    Replies: 9
    Last Post: 07-01-2005, 02:18 PM
  2. Splitting a dialog up into multiple classes
    By Just in forum Windows Programming
    Replies: 1
    Last Post: 05-29-2005, 11:11 PM
  3. open a file browser from a win32 dialog
    By jcorrington in forum Windows Programming
    Replies: 4
    Last Post: 11-10-2004, 06:28 AM
  4. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM
  5. Ghost in the CD Drive
    By Natase in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 10-12-2001, 05:38 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21