▼ 2008/6/23 (月) 23:31:13 kobake | |
Mozilla/5.0 (Windows; U; Windows NT 6.0; ja; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14 |
▼ なすこじさん
> 下記のようにすることで取りあえず落ちるのは回避できるんですが、真っ当な方法じゃないような気もします。
> m_ofn.nMaxFile = _MAX_PATH - 1;
> memset( m_ofn.lpstrFile, 0, _MAX_PATH ); // 最後2文字を0にするだけでもOK
>
> どうすべきでしょうか?
MSDNを見ましょう。
GetOpenFileName が FALSE を返したときは lpstrFile を見るのが真っ当な作法ではないでしょうか。確保すべき容量がわかるので、バッファを動的に確保して再試行すれば良いです。たぶん。
MSDN引用
> lpstrFile
> …(略)…
> If the buffer is too small, the function returns FALSE. In this case, the first two bytes of the lpstrFile buffer contain the required size, in bytes or characters.
|
|