C++ Question Can't redraw standard MFD labels

DesideriusPapp

New member
Joined
May 23, 2009
Messages
21
Reaction score
0
Points
0
Keith I think AstroMatiz is exactly what I was looking for... I'll let you know!

---------- Post added at 11:56 AM ---------- Previous post was at 12:55 AM ----------

No way. I followed the instructions in Keith's tutorial, compared my code with his, rewritten some according to the Matiz sample, and still can't get oapiMFDButtonLabel to return anything. Beats me. And I'm SURE is a silly simple thing I'm overlooking.
 
E

ex-orbinaut

Guest
Keith I think AstroMatiz is exactly what I was looking for... I'll let you know!

---------- Post added at 11:56 AM ---------- Previous post was at 12:55 AM ----------

No way. I followed the instructions in Keith's tutorial, compared my code with his, rewritten some according to the Matiz sample, and still can't get oapiMFDButtonLabel to return anything. Beats me. And I'm SURE is a silly simple thing I'm overlooking.

You know, I am still a noob at VC++ myself, especially where working with bitmaps was concerned, but I did notice that I was having problems with the LPCWSTR myself only while I had not implemented the DLLCLBK void InitModule (HINSTANCE hModule) part. If I am not mistaken, to get the device context handle, you need to have a handle on your instance of the vessel to start with. I believe the decompressed texture is treated as a bitmap in the memory, so this would be important in order to write the label onto the button. Please correct me if I am wrong, but so far I have NEVER been able to make any dynamic textures or bmp's work without it, and I get similar sort of errors in the attempt to do so.

Just a chance...
 

DesideriusPapp

New member
Joined
May 23, 2009
Messages
21
Reaction score
0
Points
0
SOLVED!!!

As I thought, it was much simpler than expected - and I've been as stupid as a noob can be. The point is that I copied down the API Guide MFDMode code snippet which is

void MyVessel::MFDMode (...),

and I didn't notice that in the code samples it's actually

void::MyVessel::clbkMFDmode

until I went berserk with debugging and placed breakpoints all over the place, thus noticing that TriggerRedrawArea was never called.

So that's it. I'm grateful to all those who dedicated time to try and help me out, and want to apologize for what in the end turned out to be (another) stupid problem.

On the bright side, at least I've learned how to debug and properly get a handle and release a DC. And Keith, you opened me the world of hand-editing meshes, which is making my texturing a lot better.
 
E

ex-orbinaut

Guest
:thumbup:

Got to be soooooooo careful. It always seems to be something like that. I have done it dozens of time over the last few weeks!

EDIT:
Just adding a quick note edit fashion as not to bump the post unduly, but for the benefit of anyone who might be having problems with LPCWSTR type errors when working with strings (for loading bmps, etcetera) who reads this post. I do not like leaving untied ends...

This problem kept rearing its head in other compile operations that used strings in VC++ 2008 Express (at least). The MAIN problem that causes this type of error is not the use of headers as much as it is a compiler configuration issue. Make sure the character set is not UNICODE (set it to Multi Byte character set in the compiler properties), and if needed, typecast the string to the required data type. Solves 99% of the problems, even if you are doing Windows API application development.

I repeat this edit in another thread where I address the same problem, just in case.
 
Last edited by a moderator:

agentgonzo

Grounded since '09
Addon Developer
Joined
Feb 8, 2008
Messages
1,649
Reaction score
4
Points
38
Location
Hampshire, UK
Website
orbiter.quorg.org
SOLVED!!!

As I thought, it was much simpler than expected - and I've been as stupid as a noob can be. The point is that I copied down the API Guide MFDMode code snippet which is

void MyVessel::MFDMode (...),

and I didn't notice that in the code samples it's actually

void::MyVessel::clbkMFDmode

until I went berserk with debugging and placed breakpoints all over the place, thus noticing that TriggerRedrawArea was never called.

So that's it. I'm grateful to all those who dedicated time to try and help me out, and want to apologize for what in the end turned out to be (another) stupid problem.

On the bright side, at least I've learned how to debug and properly get a handle and release a DC. And Keith, you opened me the world of hand-editing meshes, which is making my texturing a lot better.
Marvellous! You always learn a lot more from making mistakes than getting it right!
 

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
The point is that I copied down the API Guide MFDMode code snippet which is

void MyVessel::MFDMode (...),

and I didn't notice that in the code samples it's actually

void::MyVessel::clbkMFDmode
Thanks for letting me know. This will be fixed in the documentation, so that your trouble doesn't go to waste ... ;).
 
Top