SDK Question 'TextOutW'

gattispilot

Addon Developer
Addon Developer
Joined
Oct 17, 2007
Messages
10,540
Reaction score
4,371
Points
203
Location
Dallas, TX
I am converting my 2006 vessel to 2010p1. One issue in my code that worked great in 2006 but not in 2010p1 is 'TextOutW'

From Ummu2.0
Code:
{
    // draw the default HUD
    VESSEL2::clbkDrawHUD (mode, hps, hDC);

    // UMmu display messages
    if(dHudMessageDelay>0)
    {
//        TextOut (hDC,5,hps->H/60*15,cUmmuHudDisplay,strlen(cUmmuHudDisplay));
        dHudMessageDelay-=oapiGetSimStep();
        if(dHudMessageDelay<0)
            dHudMessageDelay=0;
    }
}

I had to comment the
Code:
TextOut (hDC,5,hps->H/60*15,cUmmuHudDisplay,strlen(cUmmuHudDisplay));

but now no UmmuHud Display

Also on the MBA is a hud that shows camera info which pad selected,....
Same issue
Code:
void MOONBASEALPHA1::HUD_Text(const HUDPAINTSPEC* pHPS, HDC hdc)    
    
{    
    char cbuf[128];
//  char cbuf2[128];
  int n, tx, ty, ty2, yoff, bs, ap,n1,ty3,ty4,ty5;
  double apd;
  GetTextMetrics(hdc, &tm);
  yoff = tm.tmHeight;
  tx = tm.tmAveCharWidth;
  ty4 = 15 * yoff;
  ty3 = 13 * yoff;
  ty = 15 * yoff;
  ty2 = 16 * yoff;
ty5 = 12 *yoff;
  //Rectangle (hdc, tx-2, ty-1, tx+120,ty+(yoff*7));
  SetTextColor (hdc, colRed);
  n3 = sprintf (cbuf, "PAD: %d", (PADSel));
  TextOut(hdc,tx,ty5,cbuf,n3 );


  n1 = sprintf (cbuf, "CAMERA: %d", (CAM));
  TextOut(hdc,tx,ty3,cbuf,n1 );

c:\orbiter2010p1\orbitersdk\samples\moonbasealpha1\moonbasealpha1.cpp(3421) : error C2664: 'TextOutW' : cannot convert parameter 4 from 'char [255]' to 'LPCWSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
c:\orbiter2010p1\orbitersdk\samples\moonbasealpha1\moonbasealpha1.cpp(3450) : error C2664: 'TextOutW' : cannot convert parameter 4 from 'char [128]' to 'LPCWSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
 
You have selected Unicode support in your project settings, which made all windows functions use the wide char (wchar_t, LPCWSTR) versions of the API functions.
 
Thanks. I selected Multi-Byte Character set and now no errors but now no hud Ou Ummu display

Works now I had the HUD off.
 
Last edited:
You need to select "Not Set" for your 'Character Set' option. That will use normal eight-bit characters instead of 16-bit characters.
 
Back
Top