레이블이 mfc인 게시물을 표시합니다. 모든 게시물 표시
레이블이 mfc인 게시물을 표시합니다. 모든 게시물 표시

2013년 11월 4일 월요일

dumpbin - vs의 nm같은 tool

덤프빈 다운로드 / 

DumpBin execution version
DumpBin.zip download

사용법

아래처럼 옵션 다음에 실행파일의 path 를 적어주면 된다.
dumpbin /option exe_path
c:\>dumpbin /disasem c:\windows\notepad.exe

자세한 설명은 아래를 참고하자.

/EXPORTS

c:\>dumpbin /exports c:\windows\system32/ntdll.dll

이렇게 하면, export 하고 있는 함수의 리스트를 볼 수 있다.

Referenece

  1. http://originaldll.com/
  2. http://www.nodevice.com/dll/MSDIS110_DLL/item10670.html

2013년 7월 4일 목요일

create thread mfc

create thread in mfc


1. class member function thread

header

private: 
static DWORD TestThread(LPVOID lpParameter);

usage cpp

m_hTestThread = ::CreateThread(NULL,0, (LPTHREAD_START_ROUTINE) MpWatcherWnd::TestThread, (void*)(this), 0, &dwTestThread);

definition cpp


DWORD TestClass::TestThread(LPVOID lpParameter)
{
TestClass* pTest = (TestClass*)lpParameter;
if (pTest)
{
// work
}
else
{
// error!
}
return 0;
}


2. global thread


2013년 6월 24일 월요일

SetForegoundWindow without taskbar flashing(blinking, flickering)


ㅡ.ㅡ ::SetForegoundWindow() 가 호출은 정상으로 되나 동작을 이상하게 할때가 있음.

특히 #Windows7 일때.

그럴때 써볼만한 팁들 모음

1. How to bring window to top with SetForegroundWindow()

2. SetForegroundWindow Win32-API not always works on Windows-

void SetForegroundWindowInternal(HWND hWnd)
{
 if(!::IsWindow(hWnd)) return;

 //relation time of SetForegroundWindow lock
 DWORD lockTimeOut = 0;
 HWND  hCurrWnd = ::GetForegroundWindow();
 DWORD dwThisTID = ::GetCurrentThreadId(),
  dwCurrTID = ::GetWindowThreadProcessId(hCurrWnd,0);

 //we need to bypass some limitations from Microsoft :)
 if(dwThisTID != dwCurrTID)
 {
  ::AttachThreadInput(dwThisTID, dwCurrTID, TRUE);

  ::SystemParametersInfo(SPI_GETFOREGROUNDLOCKTIMEOUT,0,&lockTimeOut,0);
  ::SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,0,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);

  ::AllowSetForegroundWindow(ASFW_ANY);
 }

 ::SetForegroundWindow(hWnd);

 if(dwThisTID != dwCurrTID)
 {
  ::SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT,0,(PVOID)lockTimeOut,SPIF_SENDWININICHANGE | SPIF_UPDATEINIFILE);
  ::AttachThreadInput(dwThisTID, dwCurrTID, FALSE);
 }
}
















2012년 8월 22일 수요일

mfc path 관련 함수들

MFC의 path... 관련 함수들 정리

출저 : http://kkamagui.springnote.com/pages/790020
함 수 명
인  자
결  과
PathAddBackslash
c:\path1
c:\path1\
PathBuildRoot
0
A:\
PathCanonicalize
c:\path1\..\.\path1
c:\path1
PathCompactPath
c:\path1\path2\path3\file.txt
c:\path1\...\file.txt
PathFileExists
c:\path1\file.txt
파일의존재유무[T/F]
PathFindFileName
c:\path1\path2\file.txt
file.txt
PathIsDirectory
c:\path1\path2
디렉토리유무[T/F]
PathIsfileSpec
file.txt
순수파일이름인지[T/F]
PathMakePretty
C:\PATH1\FILE.TXT
C:\path1\file.txt
PathIsNetworkPath
\\YHKim\path1\file.txt
네트워크경로인지[T/F]
PathIsRoot
c:\
루트경로인지유무[T/F]
PathIsSystemFolder
c:\windows\System32
시스템폴더인지유무[T/F]
PathRemoveBackslash
c:\path1\path2\
c:\path1\path2
PathRemoveBlanks
“ c:\path1\path2 “
“c:\path1\path2”
PathRemoveExtension
c:\path1\path2\file.txt
c:\path1\path2\file
PathRemoveFileSpec
c:\path1\path2\file.txt
c:\path1\path2
PathRenameExtension
c:\path1\path2\file.txt
c:\path1\path2\file.changed
PathStripPath
c:\path1\path2\file.txt
file.txt


관련된 참고할 만한 MSDN Resource

Shell Function들 중 일부 함수들
http://msdn2.microsoft.com/en-us/library/bb776426(VS.85).aspx
Shell Lightweight Utility Functions중 Path와 관련된 함수들
http://msdn2.microsoft.com/en-us/library/bb773559(VS.85).aspx
User Profiles Function중 Path를 얻어 오는데 관련된 함수들
http://msdn2.microsoft.com/en-us/library/aa375109(VS.85).aspx
Q) 클라이언트 컴퓨터에 설치된 firefox의 경로를 찾고 싶은데 어떻게 하지? Firefox가 써 놓은 레지스터리값를 뒤져볼까? firefox의 기본 설치 경로에 exe 파일을 createfile해서 판단할까?
Ans) SearchPath를 이용하셔서 FullPath를 얻으시고, 얻은 FullPath를 PathFileExists로 검증하시면 됩니다.

ps. Path가 등록이된 파일을 찾고 싶다면, SearchPath를 이용하면 FullPath가 넘어 온다.