Announcement

Collapse
No announcement yet.

DDT and Unicode?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • DDT and Unicode?

    Yeah, I'm still at this.

    I can get basic unicode working in PB now and I'm putting a new version of the win32api.inc together is I can ifdef "unicode" and use "W" rather than "A" versions of the API functions.

    My question is: Does DTT call the API through the win32api.inc file?? ie if in my ifdef unicode I have CreateWindowEx as CreateWindowExW rather than "A" will this have any bearing or are the API calls for DDT all made internally? That is to say, If I want to make a completely international version of an app should I use SDK programming and just chuck DDT?? I like DDT, but if it can't do the job...

    I have an example program done in DDT that takes a path from the command$ and if displayed in a messageboxW will work fine (for Kanji) but if I try to draw on a form with textoutW or DrawtextW the dialog does not even display in the firstplace till that line is commented out. I imagine that this is because the dialog was not created with unicode API's and I'm wondering if there is any way around this?



    ------------------

    Paul Dwyer
    Network Engineer
    Aussie in Tokyo
    (Paul282 at VB-World)

  • #2
    The DDT engine itself will use the Ansi API functions because PowerBASIC does not _natively_ support Unicode. Your use of Unicode API calls will not influence how DDT operates internally.

    I'm not quite sure I follow your other problem... is it MessageBoxW or DDT that does not display for you when Unicode is used? Maybe you should post the code, although I do not have Kanji support on my DEV PC to test this with, so maybe other here can help with this?

    For the lurkers: you can use Unicode strings with PowerBASIC if you implement any required Unicode string manipulation functions yourself (or use some of those provided by the API), and use a standard PowerBASIC dynamic or fixed-length string as the "container". It is possible to use ASCIIZ, however, the embedded NUL bytes (that are common in Unicode strings) add complications if you try to manipluate the string with native PowerBASIC functions.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    Lance
    mailto:[email protected]

    Comment


    • #3
      Thanks Lance,

      I'll clean up some of my test code and post it when I get home.
      The MessageboxW functions work fine, it's the Textout and Drawtext functions that fail.

      If I use the normal Textout (TextoutA) or DrawText (DrawtextA) the program "works" but obviously unicode is not displayed properly and the text is somewhat unreadable, however if I just change the calls to the unicode W versions (which are declared) the dialog will no longer load at all. Double clicking on the exe causes nothing to happen till the W is removed.

      I'll post some code later

      Cheers

      ------------------

      Paul Dwyer
      Network Engineer
      Aussie in Tokyo
      (Paul282 at VB-World)

      [This message has been edited by Paul Dwyer (edited December 10, 2000).]

      Comment


      • #4
        You are using NT or Win2k here? Because the Unicode support in Win95/98 is less than halfhearted...

        ------------------
        Tom Hanlin
        PowerBASIC Staff

        Comment


        • #5
          Win2k mainly!
          Winnt often,
          Win95&98 Japanese versions, for quite a few users

          I hate '98 worst of the lot.

          Anyone know if WinME has unicode support? I've not used it.

          ------------------

          Paul Dwyer
          Network Engineer
          Aussie in Tokyo
          (Paul282 at VB-World)

          Comment


          • #6
            very little support for Unicode in ME

            Yet another reason not to buy it. Win2k is definately for me

            ------------------

            Paul Dwyer
            Network Engineer
            Aussie in Tokyo
            (Paul282 at VB-World)

            Comment


            • #7
              Hang on! Something's very odd. I don't under stand this at all.

              In the skeleton app, I changed the win32api.inc to win32apiW.inc which is a changed version with all of the A functions changed with W functions.
              I tested the app and it still worked fine, so I added some unicode to the titlebar and it still displays ascii! Skeleton.bas is not DDT!

              I opened the exe in notepad to see the imports and it says:

              ADVAPI32.DLL KERNEL32.DLL OLEAUT32.DLL USER32.DLL GDI32.DLL COMCTL32.DLL CloseHandle CreateDialogIndirectParamA CreateDialogParamA CreateWindowExA DialogBoxIndirectParamA DispatchMessageA EndDialog ExitProcess FlushFileBuffers GetCommandLineA GetEnvironmentStringsA GetLastError GetModuleHandleA GetStartupInfoA GetSystemInfo GetVersionExA GetWindowLongA GetWindowTextA GlobalAlloc GlobalFree MessageBeep MessageBoxA PostQuitMessage ReadFile RegOpenKeyExA RegCloseKey SendMessageA SetEndOfFile SetErrorMode SetFilePointer SetLastError SetWindowTextA ShowWindow Sleep SysAllocStringByteLen SysFreeString SysStringByteLen TranslateMessage WriteFile DeleteObject GetStockObject MoveToEx DefWindowProcA DialogBoxParamA GetMessageA KillTimer LoadBitmapA LoadCursorA LoadIconA LoadMenuA LoadStringA RegisterClassExA SetTimer UpdateWindow InitCommonControls CreateToolbarEx CreateStatusWindowA

              None of the changes to the win32api file are affected! I even renamed the origional win32api file so it could only read mine. I expected some A's to remain for PB's native messagebox function etc but there are no W imports. Why??? A search of my winapi32W.inc shows that there is no "CreateWindowExA" in the file only a "CreateWindowExW"

              I think I'm really missing something here.

              ------------------

              Paul Dwyer
              Network Engineer
              Aussie in Tokyo
              (Paul282 at VB-World)

              [This message has been edited by Paul Dwyer (edited December 11, 2000).]

              Comment


              • #8
                Hey Hey!

                I got it to work (Sort of)

                I had to then name the win32apiW.inc file back to win32api.inc for PB to find it. The Japanese displays perfectly (but of course the icons all dissappeared and the other text is stuffed but I hadn't changed that to unicode yet!!

                I'm sure I'll be back soon with more whinges gripes and complaints (because I'm Australian )

                Stay tuned



                ------------------

                Paul Dwyer
                Network Engineer
                Aussie in Tokyo
                (Paul282 at VB-World)

                Comment


                • #9
                  Back again,

                  Anyone know how to change the font of settext or drawtext? or should I use a different API to output in a different font?

                  ------------------

                  Paul Dwyer
                  Network Engineer
                  Aussie in Tokyo
                  (Paul282 at VB-World)

                  Comment


                  • #10
                    Select the desired font (handle) into the device context you are using for the DrawText() function with the SelectObject() function.
                    If you try to make something idiot-proof, someone will invent a better idiot.

                    Comment

                    Working...
                    X
                    😀
                    🥰
                    🤢
                    😎
                    😡
                    👍
                    👎