Some coding questions
-
Hi all, I have some quick fire questions that I would love to know the answers to, so please reply even if you only know one or two, or even have an idea. 1.) How do you go about assigning the 6 char string "Arial" to the LOGFONT.lfFontName property? I keep getting an error about can't convert from char [6] to char [32]? 2.) Is the only way of displaying text with DirectX by use of GDI's HFONT and TextOut methods having retrieved a DC from the surface the text is to go to? 3.) Is it normal to create a HFONT based on the newest LOGFONT spec using CreateFontIndirect() and delete it using DeleteObject(hFont) after the desired text has been displayed. Or is better to create multiple HFONTs for differing texts? Basically is there a time penalty for creating/deleting HFONTs? 4.) How do I get the current screen resolution? At the moment I am using the EnumDisplayModes() with my own callback function. Could I use this to find it? 5.) Is there anyway of using a reference to a structure to save me typing out the structure name when accessing its properties? so that: MYSTRUCT hello; hello.name = "hello"; hello.width = 1; hello.height = 2; ------------------- MYSTRUCT hello; *using* hello; name = "hello"; width = 1; height = 2; *end* hello; ------------------- Thanks for getting this far, hope you can answer some of the questions. Cheers all, Alan. P.S. My condolences to all fellow England and USA football fans who saw their teams go out in todays matches :( . "When I left you I was but the learner, now I am the master" - Darth Vader
-
Hi all, I have some quick fire questions that I would love to know the answers to, so please reply even if you only know one or two, or even have an idea. 1.) How do you go about assigning the 6 char string "Arial" to the LOGFONT.lfFontName property? I keep getting an error about can't convert from char [6] to char [32]? 2.) Is the only way of displaying text with DirectX by use of GDI's HFONT and TextOut methods having retrieved a DC from the surface the text is to go to? 3.) Is it normal to create a HFONT based on the newest LOGFONT spec using CreateFontIndirect() and delete it using DeleteObject(hFont) after the desired text has been displayed. Or is better to create multiple HFONTs for differing texts? Basically is there a time penalty for creating/deleting HFONTs? 4.) How do I get the current screen resolution? At the moment I am using the EnumDisplayModes() with my own callback function. Could I use this to find it? 5.) Is there anyway of using a reference to a structure to save me typing out the structure name when accessing its properties? so that: MYSTRUCT hello; hello.name = "hello"; hello.width = 1; hello.height = 2; ------------------- MYSTRUCT hello; *using* hello; name = "hello"; width = 1; height = 2; *end* hello; ------------------- Thanks for getting this far, hope you can answer some of the questions. Cheers all, Alan. P.S. My condolences to all fellow England and USA football fans who saw their teams go out in todays matches :( . "When I left you I was but the learner, now I am the master" - Darth Vader
Alan Chambers wrote: hello.name = "hello"; 1. you can't do this in C/C++. hello.name isn't a CString object, it's just an array of characters. so you have to do this : strncpy(hello.name, 32, "Arial"); 4. use GetDeviceCaps 5. nope, not in C/C++ -c
Garbage collection, making life better - for weenies!
Image Processing - now with extra cess.
-
Alan Chambers wrote: hello.name = "hello"; 1. you can't do this in C/C++. hello.name isn't a CString object, it's just an array of characters. so you have to do this : strncpy(hello.name, 32, "Arial"); 4. use GetDeviceCaps 5. nope, not in C/C++ -c
Garbage collection, making life better - for weenies!
Image Processing - now with extra cess.
Thanks for the reply Chris, your answers worked a treat. Sorry I didn't get back to sooner, but I went to bed straight after I posted the questions. I am just wondering how to pull out the system and graphics card name, clock speed, RAM etc.? I might find this information useful. I know you can get some of them through enumeration but this seems an awfully long way to go about getting information on the current spec. Again my thanks to you Chris. Alan. "When I left you I was but the learner, now I am the master" - Darth Vader