|
Hi,
I have written a small dialog application that works fairly well, but I have noticed that under Windows XP the menu doesn't display correctly. It's only a minor thing, but behind the text on the menu, it is white, even though it should be grey (or whatever colour the theme has set). I have seen this in some other programs too (though not many), and have also seen it asked here before though with no reply/solution
It's only a very minor thing as it is purely aesthetic and does not affect the functioning of my program, but it would be great if I could get rid of it as it looks a little unprofessional.
Does anybody know how I can make the menu appear correctly on XP? My program is just a dialog based Win32 app with no MFC...
Many thanks for any suggestions.
Cheers,
KB
|
|
|
|
|
What you see is a well-known bug in XP. There are three things required to trigger the behavior you describe: 1) a dialog-based app; 2) XP and 3) themes enabled. There is a CMenu replacement here on CP that corrects this bug: Owner Drawn Menu with Icons, Titles and Shading. Try the dialog sample, and you will see that it works correctly.
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
You can try to write "*.manifest" file for your program.
With this file your program will appear in 2000-look in Win2000 and with XP-look in WinXP. Your controls also will change their appearance and look.
You can see "Using Windows XP Visual Styles" topic in MSDN.
1) Add a file called YourApp.exe.manifest to your source tree that has the following XML format:
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestversion="1.0">
<assemblyidentity
version="1.0.0.0"
processorarchitecture="X86"
name="CompanyName.ProductName.YourApp"
type="win32"
="">
<description>Your application description here.
<dependency>
<dependentassembly>
<assemblyidentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorarchitecture="X86"
publickeytoken="6595b64144ccf1df"
language="*"
="">
2) Add the manifest to your application's resource file as follows:
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "YourApp.exe.manifest"
yiy
|
|
|
|
|
Using a .manifest file will not fix the XP menu bug.
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
Thanks for the replies, much appreciated. Does this mean that if I created an owner-drawn menu instead of creating one in the dialog editor, it would show correctly? (That is, if it is okay to mix an owner-drawn menu with a dialog-based app...)
Many thanks,
KB
|
|
|
|
|
Hello,
I've written a class that 'reads' Mp3 files. It all works fine, but when a Mp3 has VBR, my calculations are incorrect!
My question:
Is there a site or something where I can find onformation on VBR?
I didn't find any...
thanks in advance!
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Well this isn't exactly C++ but...
I have a game (made in C++ using DirectX, so there.. C++ :P) and it encapsulates java scripts to extend its functionality. Now i was wondering if there's any way to see if a key is being pressed in java, without using the window event stuff, cause i cant create a window since its encapsulated in the game. I've looked on sun through the documentation but i can't find anything providing something to read the keyboard state, or an event model that works without creating a window first or whatever. Anyone know if its possible?
Kuniva
--------------------------------------------
|
|
|
|
|
How are you doing the embedding (also, are you using Java or JavaScript? It's not entirely clear)? I would think that the easiest way would be to just keep track of the key events in the C++ side and pass those along to the Java/JavaScript side (or rather, the Java/JavaScript side would query the C++ side for the key states).
- Mike
|
|
|
|
|
um, well the game isn't a game i wrote, its just a commercial game i have. It just links to the java scripts and provides basic events like ie clicked() which occurs when a player is clicked. The scripts are used to write mods and thus extend game functionality. An entire set of classes and functions are provided for this which link back to the main executable. I don't know much about using java in a C++ app so i don't know how exactly it's done. But so i can't just keep track of the key events in the C++ side.. I need to have a way to do this from the scripts... but i suppose it's not possible
oh and its Java, not Javascript
|
|
|
|
|
The architecture you describe is almost impossible to believe !!! That someone would interface java classes into a C++ game to provide user extendable functionalilty is implausible to say the least. I suspect that you are confused. However in case you are not
java.awt.AWTKeyStroke / javax.swing.KeyStroke is what you are looking for.
http://java.sun.com/j2se/1.4.2/docs/api/
|
|
|
|
|
Thank you.
About the game.. It really is the way i described it, the game is Vampire: The Masquerade - Redemption from Nihilistic Software. Many RP games implement some sort of scripting feature these days to let users add modules and all (like NeverWinter Nights for example). Just with Vampire, they chose to use Java instead of inventing their own scripting language for it. I'm guessing it loads all classes on startup in the JVM (A javai.dll is included in the root directory of the game) and the dll maps the function calls to the executable and vice versa. When u make a script u just have to make sure u derive it from a base class (in most cases Codex) and then there's subclasses for things, players, actors, regions, sectors, sounds, items, disciplines and so on.
Kuniva
--------------------------------------------
|
|
|
|
|
Ok here is the code...
<code> m_strOut = "scrollbar-darkshadow-Color:"+m_str1+";\r\n"+
"scrollbar-3dlight-Color:"+m_str2+";\r\n"+
"scrollbar-arrow-Color:"+m_str3+";\r\n"+
"scrollbar-base-Color:"+m_str4+";\r\n"+
"scrollbar-face-Color:"+m_str5+";\r\n"+
"scrollbar-highlight-Color:"+m_str6+";\r\n"+
"scrollbar-shadow-Color:"+m_str7+";\r\n"+
"scrollbar-track-Color:"+m_str8+";";</code>
and when I changed it to...
<code> m_strOut = "<style>\r\n"+
"{\r\n"+
"scrollbar-darkshadow-Color:"+m_str1+";\r\n"+
"scrollbar-3dlight-Color:"+m_str2+";\r\n"+
"scrollbar-arrow-Color:"+m_str3+";\r\n"+
"scrollbar-base-Color:"+m_str4+";\r\n"+
"scrollbar-face-Color:"+m_str5+";\r\n"+
"scrollbar-highlight-Color:"+m_str6+";\r\n"+
"scrollbar-shadow-Color:"+m_str7+";\r\n"+
"scrollbar-track-Color:"+m_str8+";\r\n"+
"}\r\n"+
"</style>";</code>
I get an error : error C2110: cannot add two pointers.
I don't know what is the problem.
HELP!!!!
<marquee>Universal Project</marquee>
|
|
|
|
|
You can't concatenate ptrs in a CString. So:
m_strOut = "abc"; is ok but m_strOut = "abc" + "def"; isn't. You can resolve this with:
m_strOut = "abc";
m_strOut + "def";
or:
m_strOut = "abc" + CString("def");
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Thankyou I solved it by doing:
m_strOut = "<style>\r\n{\r\nscrollbar-darkshadow-Color:"+m_str1+";\r\n"+
"scrollbar-3dlight-Color:"+m_str2+";\r\n"+
"scrollbar-arrow-Color:"+m_str3+";\r\n"+
"scrollbar-base-Color:"+m_str4+";\r\n"+
"scrollbar-face-Color:"+m_str5+";\r\n"+
"scrollbar-highlight-Color:"+m_str6+";\r\n"+
"scrollbar-shadow-Color:"+m_str7+";\r\n"+
"scrollbar-track-Color:"+m_str8+"\r\n}\r\n</style>";
<marquee>Universal Project</marquee>
|
|
|
|
|
But
";\r\n"+"scrollbar-3dlight-Color:" shouldn't compile.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I think it works because of the evaluation order, i.e.:
"<style>\r\n{\r\nscrollbar-darkshadow-Color:"+m_str1 Results in a CString, then
(previous CString) + ";\r\n" results in another CString, so the following concatenation is a CString + a const char* .
- Mike
|
|
|
|
|
I guess it does compile since I did it If you want I'll send you the source.
I think the \r\n makes it posibble I think. Send me an email if you want the source or executable.
<marquee>Universal Project
|
|
|
|
|
I have heard about TWAIN to scan an image.
Looking in codeproject and codeguru i saw samples about it.
However, those samples use the vendor UI.
I need to scan an image without using the vendor UI.
I need to set the resolution as well.
I will appreciate getting a sample.
Thanks in advance,
Dudi
|
|
|
|
|
what does "scan" mean? to get buffer of the image, or scan the buffer?
includeh10
|
|
|
|
|
"Scan" means scanning an image using flatbed scanner.
|
|
|
|
|
OK, i have found it.
Just setting ShowUI field to FALSE in a structure TW_USERINTERFACE.
|
|
|
|
|
as my test, calling function GetDocument() in a thread always causes program crashes, why?
includeh10
|
|
|
|
|
|
i do use raw thread instead of AfxBeginThread.
do you mean AfxBeginThread will solve the problem? if so, AfxBeginThread should have something difference inside?
thx.
includeh10
|
|
|
|
|
Theads don't see the CWnd* Maps of other threads, so you can only see the views/documents created in each thread. In your example GetDocument will be returning NULL, which you should always be testing for.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|