Menu

Problems calling a char* var inside a rc file

2002-12-09
2012-09-26
  • Nobody/Anonymous

    Cant i use a var as a text parameter when inside a .rc file? Im getting rc error when trying to do it like this:

    ID_ABOUT DIALOG DISCARDABLE 200, 200, 200, 150 
    STYLE DS_3DLOOK | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
    CAPTION "About..."
    FONT 8, "MS Sans Serif"
    BEGIN
    EDITTEXT (varAboutText) ID_ABOUTTEXT, 2, 14, 196, 115, ES_MULTILINE   //This is what im talking about.
    DEFPUSHBUTTON "Ok", ID_ABOUTOK, 2, 134, 40, 14
    PUSHBUTTON "Cancel", ID_ABOUTSITE, 158, 134, 40, 14
    LTEXT "Thanks for using it, really :)", ID_LABELABOUTTEXT, 3, 3, 150, 10
    END

     
    • Nobody/Anonymous

      Hmmm... Looks very strange to me. RC files are only good for discribing what the dialog will look like, no more no less. As RC's get compiled into an own format (.res) and then linked to your app, you can't simply add a char* or whatever in there. Leave this (varAboutText) out, fill in "" and compile it with windres. Afterwards in your actual .c or .cpp source send the edit a message for setting or changing it's text ( SetDlgItemText(hwnd, ID_ABOUTTEXT, "I want this text displayed..."); ). This should do the trick. Using MFC you could alter the text by simply asigning a variable a new value, but using plain C or CPP this won't work.

      Hope this helps...
      Bye

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.