Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2007
    Posts
    56

    kernel32.dll, CreateFileW, Unicode, help anyone?

    Hi Gang,

    This is probably a question for the more experienced C/C++ programmers
    here..

    There's a game/simulator I play every now and again, and it has files that
    can be edited by the end user to accomplish certain things. So, I thought
    it would be nice to create a program that could create these files so it
    would be faster and easier for me to do what I want to do.

    Anyway, so I create my little application in AMS6, everything seems to
    work great, except the files I create and import into the game/sim give
    me the old file is corrupt error message, then the game/sim shuts down.

    Well, it took my brain a little while to kick in, but it finally dawns on me
    that the files that we can import and use for this game need to be in
    Unicode format, and I think "Well, my little app is not exporting in Unicode."

    So, after doing about a weeks worth of searching and research, I have come
    to the conclusion that I need to be using the Windows kernel32.dll dynamic
    link library to export my files in Unicode format.

    The closest I can come to finding any useful information on using the
    functions in this file (I think specifically CreateFileW) are from this website:

    http://source.winehq.org/WineAPI/CreateFileW.html
    http://source.winehq.org/WineAPI/kernel32.html

    That's really as far as I can get. I cannot find a website or information for
    the really dumb (speaking of myself) to understand how in the world to
    implement this into my AMS6 program and export a file in Unicode format.

    Is there anyone kind enough to give me a small example of getting this to
    work in my app?

    Any help would be greatly appreciated.
    Patrick

  2. #2
    Join Date
    Mar 2005
    Posts
    187
    Hi coderanger,

    This may help you out...

  3. #3
    Join Date
    Jan 2007
    Posts
    56
    Thanks Buffman,

    I'm not having any luck with that, I'm not sure I'm using it properly though..
    Here's what's supplied in that program:

    Code:
    --[[ The function inside of the DLL is ANSUNI.  The only argument is the "string" you suppy to get converted
    Try this out and let me know if it works properly, if you would.  I ported it from another language for AMS users to use]]
    
    result = DLL.CallFunction("AutoPlay\\Docs\\DLLANSI2UNI.dll", "ANSUNI", "PUT_YOUR_ANSI_STRING_HERE", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
    So, I added this just to test it out..

    Code:
    TextFile.WriteFromString("C:\\MyGameCodeFile.txt", result, false);
    The file I get is unreadable.. In fact, it's only one character, this: 0

    So, I'm either doing something wrong, or it's not working as it should. The
    only instructions I've got to go on are the ones supplied with the help
    docs.

    Any help would be appreciated.

    Thanks,
    Patrick

  4. #4
    Join Date
    Jan 2007
    Posts
    56
    Just tried this too, and it didn't work:

    Code:
    tProperties = {};
    tProperties.Enabled = true;
    tProperties.Visible = true;
    tProperties.FontScript = 0; --Apparently, setting this to 0 sets the text to ANSI
    tProperties.Text = Input.GetText("Input1");
    -- Set the properties of an input object
    Input.SetProperties("Input1", tProperties);
    result = Input.GetText("Input1");
    result = DLL.CallFunction("AutoPlay\\Docs\\DLLANSI2UNI.dll", "ANSUNI", result, DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL);
    TextFile.WriteFromString("C:\\MyGameCodeFile.txt", result, false);
    Patrick

Similar Threads

  1. DLLANSI2UNI - ANSI to UNICODE - Intrigued
    By Intrigued in forum AutoPlay Media Studio 6.0
    Replies: 9
    Last Post: 08-17-2007, 04:37 AM
  2. Unicode doesn't work
    By Jim Heisig in forum AutoPlay Media Studio 6.0
    Replies: 5
    Last Post: 12-24-2005, 09:38 AM
  3. Unicode INI file, read on NT 4 crashes app
    By jlm13 in forum AutoPlay Media Studio 4.0
    Replies: 2
    Last Post: 08-07-2003, 09:08 AM
  4. Unicode support ?
    By mtway in forum AutoPlay Media Studio 4.0
    Replies: 0
    Last Post: 12-17-2002, 12:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts