first windows program

This is a discussion on first windows program within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I've started to learn Windows programming and wrote first program: Code: #include <windows.h> int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE ...

  1. #1
    Registered User Micko's Avatar
    Join Date
    Nov 2003
    Posts
    712

    first windows program

    Hi, I've started to learn Windows programming and wrote first
    program:
    Code:
    #include <windows.h>
    
    int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                        PSTR szCmdLine, int iCmdShow)
    {
         MessageBox (NULL, TEXT ("Hello, Windows 98!"), TEXT ("HelloMsg"), 0) ;
    
         return 0 ;
    }
    I) have question regarding MessageBox:
    when 0 is last argument button OK will show up, I can put something else,
    for example: MB_YESNOCANCEL. My native language is not english so my question is how to change button to display text which on my language means Cancel?
    Is it possible without making new form and adding buttons to simulate MessageBox?
    Thanks

  2. #2
    Registered User
    Join Date
    Jun 2004
    Posts
    42
    What's the language of your windows os? If you are using english version windows, I think it is relativly hard to do this, because messagebox is an API of windows system, you may use API inspecting technology to do it. Anyway, I think the easy way is to make a new form.
    That is only what I know, maybe it exists some wonder methods.

  3. #3
    Registered User Micko's Avatar
    Join Date
    Nov 2003
    Posts
    712
    Language is english and code page is Croatian. I thought definition for that buttons is in some header file and to change there, but I guess, I'll make new form.
    I don't know really what is API so I must spend some time to understed how it works
    Thanks

  4. #4
    Registered User
    Join Date
    Sep 2003
    Posts
    23
    Quote Originally Posted by Micko
    Language is english and code page is Croatian. I thought definition for that buttons is in some header file and to change there, but I guess, I'll make new form.
    I don't know really what is API so I must spend some time to understed how it works
    Thanks
    Seems like you'll need to do it by yourself. Or download WINE and build
    something similar looking at their code. I always hated dialogs with
    just Yes/No/OK etc. It is much better and safer for the user to have a button
    that sais "Delete", "Add", "Close", "Don't save" etc.

  5. #5
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    It looks like you could use xMsgBox.
    Code:
    int iRet;
    X_MSG_BOX_PARAMS xmb = { 0 };
    
    xmb.szTitle  = TEXT("Sleep or Eat?");
    xmb.dwStyle  = MB_ICONQUESTION | MB_DEFBUTTON2;
    xmb.hwnd     = NULL;
    xmb.szPrompt = TEXT("What would you like to do today?");
    
    // Set number of custom buttons(0 - 3)...
    xmb.dwCountButtons = 2;
    
    // Set button captions...
    xmb.szButtonCaptions[0] = TEXT("Eat!");
    xmb.szButtonCaptions[1] = TEXT("Sleep!");
    
    iRet = XMsgBox(&xmb);
    
    printf("Button Number %d was pressed by the user.\n", iRet);
    [Note: Screenshot is from a similar sample available in the zip.]
    Attached Images Attached Images  
    Attached Files Attached Files

  6. #6
    Registered User Micko's Avatar
    Join Date
    Nov 2003
    Posts
    712
    Thanks very much for help

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 02:42 AM
  2. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 03:30 PM
  3. Program works on Windows XP and 2000, not on 98 or ME
    By MidnightlyCoder in forum C++ Programming
    Replies: 7
    Last Post: 03-10-2006, 03:36 PM
  4. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  5. my first windows console program
    By Syneris in forum Windows Programming
    Replies: 3
    Last Post: 04-08-2002, 04:18 PM

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