CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2005
    Posts
    43

    Some questions...

    Hello people,
    i'm a newcomer to the forum and so i'd like to greet everyone who's attending the forum
    I have coded an mp3 player using standard mfc classes,utilising listboxes etc.Now,after finishing the functions that i wanted it to have(more or less),i decided to start coding a skin and things like that to make it a bit fancier So i started reading some articles from codeguru site and i must admit that they are very nice.I have decided to begin with the easiest stuff first.I started to code a Splash Screen in a separate project and was succesful in doing so.Then,i wanted to code a generic mfc class that would allow generic creation of splash screens in many progs.
    So,i created a class but i have a problem in getting windows messages(wm_paint and wm_timer in particular) that react with the modeless dialog i create.In my class,the constructor gets a pointer to parent CWnd AND the ID of new dialog that the user creates and then another function utilises:

    Create(IDD_MODELESS_SPLASH_SCREEN,Wnd_parent)

    to create and the modeless dialog,while another function appears it.Then a function is responsible for drawing a bitmap to the dialog,stretched or not.Once more the resource ID of the bitmap should be provided.
    Up till here everything works as it should.Then i'd want to create a timer and process wm_paint messages.But,for some reason the modeless dialog does not react on any messages.Notice that when a new modeless dialog is created by the user,he WOULD NOT have to let MSVC create a new class that handles the dialog events and therefore i should do sth about it.I suspect that the reason for the events that do not react has to do with the dialog "binding" to my class...


    Since i posted at the first place,grabbing the opportunity i'd also want what's the way to get the filename of the mp3 file(or any file of course) that i double click at and the default mp3 player is opened(that is my player which i've made default).I tried the commandline but it's not there.Maybe somewhere at the registry? Last but not least,is there a non-OS dependant(registry) way of designing a function that will make the mp3 player a default one ? I coded it for Win2k and while it worked fine there,it refused to work on winxp..

    Sorry for making so many questions btw :0 And thanx for reading that far !

  2. #2
    Join Date
    Jun 2003
    Location
    Bucharest, Romania
    Posts
    529

    Thumbs up Re: Some questions...

    Too many questions in only one thread. It becames unreadable at one point! A piece of advice: When you have multiple problems post multiple questions. This way you'll have a chance that somebody will answer quickly.
    Quote Originally Posted by lakis
    Hello people,
    i have a problem in getting windows messages(wm_paint and wm_timer in particular)
    Use class Wizard to add OnPaint and OnTimer functions coresponding to WM_PAINT and WM_TIMER messages.
    Quote Originally Posted by lakis
    Hello people,
    .. a function is responsible for drawing a bitmap to the dialog,stretched or notparticular)
    use WM_CTLCOLOR to display a background image. Select the bitmap you want in a CBrush (after you strench it) and return a handle to that brush.

    Quote Originally Posted by lakis
    Hello people,
    Then i'd want to create a timer and process wm_paint messages.But,for some reason the modeless dialog does not react on any messages
    I'm not quite sure I can understand what you want to say.. You can't add the message handlers or you add but nothing happens?
    Quote Originally Posted by lakis
    Hello people,
    i'd also want what's the way to get the filename of the mp3 file
    extract the name of the mp3 form the GetCommandLine() string. It should be there!
    Code:
    BOOL CMyApp::InitInstance()
    {
       // ...
      
       if (m_lpCmdLine[0] == _T('\0'))
       {
          // Create a new (empty) document.
          
       }
       else
       {
          // Open a file passed as the first command line parameter.
          OpenFile(m_lpCmdLine);
       }
      
       // ...
    }
    Quote Originally Posted by lakis
    Hello people,
    I tried the commandline but it's not there.
    I hardly believe that! In my programs it is there!
    Last edited by chi_luci; January 28th, 2005 at 02:57 PM.
    Help me help you ... rate this article if any good!

  3. #3
    Join Date
    Jan 2005
    Posts
    43

    Re: Some questions...

    I'm sorry about making many questions in one thread.It won't happen again..

    Thanx very much for replying chi_luci It seems that i've not made myself so clear.In fact my questions are 3:

    1) For some reason,in the project i mentioned above,in the code of the generic class i created,events won't catch up with the created modeless dialog.Seems that it's a problem of "binding" the DYNAMICALLY created dialog with the events included in my class.Remember,the user creates the dialog but DOES NOT have to "bind" it to a new class.He should just give the ID and the class would be responsible for creating it and preserving event messages.

    2) I know that commandline should work.That's what i first tried.Invoking a messagebox,however,did not return anything.That is when my mp3 player IS default and i double click on a song.The mp3 player opens but i cannot get the name of the song in which i double-clicked and there's nowhere in the commandline.Really ! On the contrary,if i right-click on the song and press "Open" the name of the file is appended on the commandline.I understand it's kinda weird and i think there should probably be a registry fix or sth ?

    3) Is there an OS-independant(meaning win systems) or better registry-independant way of making the mp3 player DEFAULT ?


    These are the questions in short

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured