Version info and ListBox

This is a discussion on Version info and ListBox within the Windows Programming forums, part of the Platform Specific Boards category; Hi! The first problem is that I'm trying to add a version info into .exe file and I just can't ...

  1. #1
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669

    Question Version info and ListBox

    Hi!

    The first problem is that I'm trying to add a version info into .exe file and I just can't get it working (if I click on the .exe file with the right button there should be a tab named "Version" beside the "General" tab). In the resource file I added the version info component and now I think that I should write something into the .c file but I really do not have any idea what to write.

    Can you help me with this problem?

    And the second problem is that I somehow can not add a listbox component on the main window (that window has a menu and a toolbar). How to do that?
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    >>Can you help me with this problem?

    Maybe, but without code it is very hard. Like mind reading, you need something to work with in the first place.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    381
    Firstly you really should mention what compiler your using.
    An answer to your first problem is adding a resource called VERSIONINFO. Msdn comes in handy here:
    http://msdn.microsoft.com/library/de...o_resource.asp

    But Novacain's right, you'll need to post some code before we can help with your other problem.

  4. #4
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669
    The first problem is solved and for the second problem I'm posting this code:

    Code:
    LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    {
    	HMENU hMenu, hEdit;
    
    	switch (message)
    	{
    		case WM_CREATE:
    			hMenu = LoadMenu (hInst, MAKEINTRESOURCE (IDR_MENU01));
    			SetMenu (hwnd, hMenu);
    			hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | 
    WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_MULTILINE  | ES_AUTOVSCROLL | ES_AUTOHSCROLL, 
    0, 0, 100, 100, hwnd, NULL, GetModuleHandle(NULL), NULL); // I copy/paste this from 
    //the tutorial I have on my disk, 
    //but this is for the edit control and 
    //I really do not know what to write for the ListBox control and
    //I do not quite understand for the edit control either
    			return 0;
    		case WM_COMMAND:
    			hMenu = GetMenu (hwnd);
    			switch (LOWORD (wParam))
    			{
    				case IDM_FILE_EXIT:
    					SendMessage (hwnd, WM_CLOSE, 0, 0);
    					return 0;
    				case IDM_HELP_ABOUT:
    					DialogBox (hInst, MAKEINTRESOURCE (IDD_ABOUT), hwnd, About);
    					break;
    			}
    			break;
    		case WM_DESTROY:
    			PostQuitMessage (0);
    			return 0;
    	}
    	return DefWindowProc (hwnd, message, wParam, lParam);
    }
    My compiler is Visual C++ 5.0 on Win98.

    Thank you for helping me.
    Last edited by GaPe; 03-27-2002 at 04:23 AM.
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

  5. #5
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    For a list box;


    Code:
    hEdit = CreateWindowEx(WS_EX_CLIENTEDGE,"listbox", "",
               WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL |  LBS_STANDARD,
               0, 0, 100,100,hwnd,NULL,GetModuleHandle(NULL), 0);

  6. #6
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669
    Thanks Fordy. Could you explain this to me? I do not know what is what. What's the code for the table something like it is in the Windows Commander or Explorer (Name, Extension, ...)? And how to implement the right click with the mouse on some component?
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

  7. #7
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669
    I have another question. If I want to use an edit control and I write something in it and then I want to save that text into a file, how can I implement this problem? Can I use fwrite function?
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

  8. #8
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    Could you explain this to me? I do not know what is what. What's the code for the table something like it is in the Windows Commander or Explorer (Name, Extension, ...)? And how to implement the right click with the mouse on some component?
    Sorry I dont understand


    I have another question. If I want to use an edit control and I write something in it and then I want to save that text into a file, how can I implement this problem? Can I use fwrite function?
    Look up GetWindowText() this will give you a string with the contents of the editbox......then you can fwrite

  9. #9
    Code Warrior
    Join Date
    Nov 2001
    Posts
    669

    Thumbs up

    Code:
    hEdit = CreateWindowEx(WS_EX_CLIENTEDGE,"listbox", "",
               WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL |  LBS_STANDARD,
               0, 0, 100,100,hwnd,NULL,GetModuleHandle(NULL), 0);
    I don't know the meaning of the parameters. Why is the last parameter 0 and what is "GetModuleHandle(NULL)"?
    -------------------
    In the explorer if you click "View"->"Details" then you see a table with the "Name", "Extension" and so on. How to write something like that?
    -------------------
    About the right click I meant this. If you click with the right button on the mouse on the edit control you get a pop-up with commands "Undo", "Cut", "Copy" and so on. How to implement that?
    Current projects:
    1) User Interface Development Kit (C++)
    2) HTML SDK (C++)
    3) Classes (C++)
    4) INI Editor (Delphi)

  10. #10
    Registered User
    Join Date
    Jan 2002
    Posts
    381
    >>I don't know the meaning of the parameters. Why is the last parameter 0 and what is "GetModuleHandle(NULL)"?

    ftp://ftp.cs.virginia.edu/pub/lcc-win32/win32hlp.exe
    That file installs a win help file that is pretty much a condensed version of msdn. It lists all the parameters for pretty much all functions.

    >>In the explorer if you click "View"->"Details" then you see a table with the "Name", "Extension" and so on. How to write something like that?

    Thats what the VERSIONINFO resource is for.

    >>About the right click I meant this. If you click with the right button on the mouse on the edit control you get a pop-up with commands "Undo", "Cut", "Copy" and so on. How to implement that?

    Should be done automaticly by windows.

  11. #11
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    GetModuleHandle(NULL) returns the HINSTANCE of your app. the instance is the handle the OS uses to find your app from allthe others it is running.

    In your code just change it to hInst (which I assume is global)

    Make the variables in your callback STATIC or they will have lost scope as soon as your WM_CREATE has finished and breaks or returns. This means you do not have to GetMenu() each time.

    HWND is not exactly the same as a HMENU. (it is but better to learn that it is not)

    HMENU hMenu, hEdit;

    change to

    static HWND hEdit=NULL;
    static HMENU hMenu=NULL;

    To do the right click thingy.
    Will need to process WM_RBUTTONDOWN msg's, find where.
    PtInRect() and GetWindowRect() on the HWND of the ctrl / dlg to test where the user has clicked is where you want a popup menu. Then you will need to create a menu from resource or on the fly.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. read a listbox in another app
    By bonkey in forum Windows Programming
    Replies: 5
    Last Post: 08-14-2002, 03:49 PM
  2. readling listbox in another app
    By bonkey in forum C++ Programming
    Replies: 2
    Last Post: 08-14-2002, 12:39 PM
  3. Listbox Craziness
    By -KEN- in forum Windows Programming
    Replies: 6
    Last Post: 02-18-2002, 08:22 PM
  4. Listbox multi collum
    By (TNT) in forum Windows Programming
    Replies: 2
    Last Post: 01-02-2002, 08:06 AM

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