Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

NAKAGAWA Masaki http://d.hatena.ne.jp/ikasam_a/

« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS 

デフォルトのMIMEタイプを追加する

// PNGの場合

import javax.activation.FileTypeMap;
import javax.activation.MimetypesFileTypeMap;

public void setMimeType() {
    String mimeType = "image/png    png PNG";
    MimetypesFileTypeMap map = new MimetypesFileTypeMap();
    map.addMimeTypes(mimeType);
    FileTypeMap.setDefaultFileTypeMap(map);
}

MFCでレジストリの代わりにINIファイルを使う

#include <shlwapi.h>

BOOL CMyApp::InitInstance()
{
  // ... 

  TCHAR szIniPath[MAX_PATH];
  VERIFY(::GetModuleFileName(::AfxGetInstanceHandle(), szIniPath, MAX_PATH) != 0);
  VERIFY(::PathRenameExtension(szIniPath, _T(".ini")) != FALSE);
  ::free(static_cast<LPVOID>(const_cast<LPTSTR>(m_pszProfileName)));
  m_pszProfileName = ::_tcsdup(szIniPath);

  // ...

  return TRUE;
}

モジュールのパスを調べる

perldoc -ml Module::Name::Here
« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS