开发者

An IE7 toolbar button, with 2 different *.rc files

I have a IE 7 button toolbar project on Visual C++. My question is, can my button have 2 *.rc files. Means, by default it will use the 1st *.rc file, and when certain condition achieve inside my *.cpp, the button will be using 开发者_Python百科the 2nd *.rc file.

Is this allowed in visual studio or IE7?

edit: Both rc files has different information for icon image.


You can have as many resource files as you want; MSVS supports that. They still all have to have unique IDs, however, so you may just want to put them all in one file anyway.

You switch between resource sets at runtime by checking your condition, then loading the appropriate resource. You can use FindResource / LoadResource or LoadString if you're only switching strings.

One strategy might be to have a resource base which is added to all resource load requests and which is initially zero. If your condition is met, you could change that base to 10,000 or something. Then in your resource file the normal string, for example, would be 0, but the string in the case the condition is met is 10,000. The normal image would 25, but in the case where the condition is met it would be 10,025. There are probably better strategies, but that's what I came up with pre-coffee.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜