Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2005

Tip: Looking for answers? Try searching our database.

Using UpdateResource() to add a resource

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Klaatu - 06 May 2005 19:44 GMT
I've seen plenty of examples of updating a resource using UpdateResource().  
Has anyone actually used it to add a new resource?  For example, a menu
resource.  If so, how is it done?  I'm not quit sure how to present the raw
data.
Signature

Gort, Klaatu, Barrada Nikto...

William DePalo [MVP VC++] - 06 May 2005 23:21 GMT
> I've seen plenty of examples of updating a resource using
> UpdateResource().
> Has anyone actually used it to add a new resource?  For example, a menu
> resource.  If so, how is it done?  I'm not quit sure how to present the
> raw
> data.

I think you are about to step into one of the darker corners of Win32
programming. I don't want to sound like I am dissuading if you have decided
you must go this way ... but do you know that you can build menus at
runtime? It may be a better option.

If you want to go this route, take a look at this link:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/Win
dowsUserInterface/Resources/IntroductiontoResources.asp


It contains this quip in the paragraph on the MENUHEADER structure:

<quote>
The MENUHEADER structure contains version information for the menu resource.
The structure definition provided here is for explanation only; it is not
present in any standard header file.
</quote>

The help entry for the UpdateResource() function points out that you must
pass a pointer to the "raw data" to be used in the update so I think that
you will first have to dump an existing menu resource, determine its binary
format by looking at the header and your resource script, get an idea of the
format, do the update, test and repeat until it works. :-(

Regards,
Will
Klaatu - 09 May 2005 13:56 GMT
William:

Thanks for the advice.  Yes, I'm aware that I can create the menus
dynamically.  Our current menu structure does just that.  The real reason I
need to update resources is for translation issues.  Since we don't have menu
resources, and our menu text comes from a string table, I have to provide
them for our language translators.  Giving them menu resources provides
context and organization when they use a tool like visual localize.

> > I've seen plenty of examples of updating a resource using
> > UpdateResource().
[quoted text clipped - 28 lines]
> Regards,
> Will
Mihai N. - 10 May 2005 08:04 GMT
> Thanks for the advice.  Yes, I'm aware that I can create the menus
> dynamically.  Our current menu structure does just that.  The real reason I
> need to update resources is for translation issues.  Since we don't have menu
> resources, and our menu text comes from a string table, I have to provide
> them for our language translators.  Giving them menu resources provides
> context and organization when they use a tool like visual localize.
Why not give the .rc file?
Plus, any localization company worth the name is able to deal with
resources in executables/dlls without you writing any extra tools.

Signature

Mihai Nita [Microsoft MVP, Windows - SDK]
------------------------------------------
Replace _year_ with _ to get the real email

Klaatu - 10 May 2005 13:38 GMT
Nice idea, but, our menu resources don't live in the .rc file.  They are
built dynamically from strings in the stringtable and an external function
table.

> > Thanks for the advice.  Yes, I'm aware that I can create the menus
> > dynamically.  Our current menu structure does just that.  The real reason I
[quoted text clipped - 6 lines]
> Plus, any localization company worth the name is able to deal with
> resources in executables/dlls without you writing any extra tools.
Mihai N. - 13 May 2005 08:34 GMT
> Nice idea, but, our menu resources don't live in the .rc file.  They are
> built dynamically from strings in the stringtable and an external function
> table.
Then you do not need UpdateResource. Just read it from the external file,
build it, and use it.
UpdateResource is to update the menu resource in the executable file.

Signature

Mihai Nita [Microsoft MVP, Windows - SDK]
------------------------------------------
Replace _year_ with _ to get the real email

Klaatu - 11 May 2005 18:58 GMT
Although I did eventually work through the binary layout of the resources in
the dll, I decided to abandon this approach in favor of writing out an XML
file that contains the menu structure.  This resolved my problem since the
translator tool will import xml files.

> I've seen plenty of examples of updating a resource using UpdateResource().  
> Has anyone actually used it to add a new resource?  For example, a menu
> resource.  If so, how is it done?  I'm not quit sure how to present the raw
> data.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.