0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Windows 環境 AEGP_MemHandle で取得した文字列の使い方

Posted at

AEGP_GetProjectPath でプロジェクトのフルパスを取得しようとすると、UTF16 の文字列が
指定した AEGP_MemHandle に格納されます。

このままだと文字列すら取得できないので手順を踏む必要があります。

AEGP_LockMemHandle でメモリの先頭アドレスを取得


AEGP_MemHandle mem;
A_UTF16Char *path;
suites.MemorySuite1()->AEGP_LockMemHandle(mem, (void**)&path);

UTF16 から SJIS に変換

MAC だと、デフォルトが UTF16 らしいので変換の必要が無いらしい。未確認

int    out_size;
A_char	proj_path[MAX_PATH + 16];
out_size = WideCharToMultiByte(CP_ACP, 0, (OLECHAR*)path, -1,NULL, 0, NULL, NULL);
WideCharToMultiByte(CP_ACP, 0, (OLECHAR*)path, -1, proj_path,out_size, NULL, NULL);

参考サイト
http://d.hatena.ne.jp/sirocco/20130418/1366253252

後片付け


suites.MemorySuite1()->AEGP_UnlockMemHandle(mem);
suites.MemorySuite1()->AEGP_FreeMemHandle(mem);

その他

  • 文字列の長さチェックとか、変換失敗は考慮していません
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?