블로그 이미지
fiadot_old

칼퇴근을 위한 게임 서버 개발 방법론에 대한 심도있는 고찰 및 성찰을 위한 블로그!

Rss feed Tistory
Technical Article/펌 2005. 8. 25. 15:49

Linker Tools Warning LNK4070 발생시

Linker Tools Warning LNK4070
/OUT:filename directive in .EXP differs from output filename "filename"; ignoring directive

The filename specified in the NAME or LIBRARY statement when the .EXP file was created differs from the output filename that was either assumed by default or specified with the /OUT option.

A client program that uses the resulting DLL might encounter problems.


--------------------------------------------------------------------------------
Send feedback to MSDN.Look here for MSDN Online resources.


DLL을 생성할때 release 모드와 debug모드일때 생성되는 DLL파일명을 다르게 하면 위와같은 경고가 발생한다.

단순 경고라고 무시하면 다른 프로젝트에서 import했을때 에러난다 ㅡㅡ;..

이에 대한 해결방법은

.def파일에 LIBRARY "DLL프로젝트명" 부분을 고쳐줘야 한다.

즉 def파일이 release모드일때와 debug모드일때 2개 있어야만 한다는 얘기...

예를 들여 LIBRARY "FiaAppDLL" 이고
디버그 모드일때는 FiaAppDLLd로 하고싶다면
LIBRARY "FiaAppDLLd" 로 수정하고

프로젝트 셋팅에서 링크탭에 /def:".\FiaAppDLLd.def" 로 수정하면

빌드해도 이상없이 작동한다.

흐흐흐....

아~ 그리고 dll만 바꿀게 아니라 output library명도

/implib:"Library/FiaAppDLLr.lib"

이렇게 바꿔줘야 한다.
,
Technical Article/펌 2005. 8. 25. 13:51

MFC에서 argc, argv 인자 받는방법

MFC내부 매크로
__argc
__argv
사용
,
Technical Article/펌 2005. 8. 4. 10:46

WIN32에서 MFC의 메모리 누수 체크기능을 써보자

http://msdn.microsoft.com/library/kor/default.asp?url=/library/KOR/vsdebug/html/vxconenablingmemoryleakdetection.asp

메모리 누수 탐지 기능 사용

메모리 누수를 탐지하는 데 사용하는 기본 도구는 디버거와 CRT 디버그 힙 함수입니다. 디버그 힙 함수를 사용하려면 다음 문이 프로그램에 포함되어 있어야 합니다.

#define CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
참고   #include 문은 위의 순서를 따라야 합니다. 순서를 변경하면 함수를 사용해도 제대로 작동하지 않습니다.

crtdbg.h를 포함하여, 메모리 할당과 할당 취소를 추적하는 해당 디버그 버전, _malloc_dbg 및 _free_dbg에 malloc와 free 함수를 매핑합니다. 이 매핑은 _DEBUG가 정의된 디버그 빌드에서만 발생합니다. 릴리스 빌드에서는 일반적인 malloc 함수와 free 함수가 사용됩니다.

#define 문은 CRT 힙 함수의 기본 버전을 해당 디버그 버전에 매핑합니다. 이 문을 반드시 사용할 필요는 없지만 사용하지 않으면 메모리 누수 덤프에 별로 유용하지 않은 정보가 포함될 수 있습니다.

위에서 설명한 문을 추가한 후 프로그램에 다음 문을 포함하여 메모리 누수 정보를 덤프할 수 있습니다.

_CrtDumpMemoryLeaks();

디버거에서 프로그램을 실행하면 _CrtDumpMemoryLeaks가 출력 창에 메모리 누수 정보를 표시합니다. 메모리 누수 정보가 다음과 같이 표시됩니다.

Detected memory leaks!
Dumping objects ->
C:\PROGRAM FILES\VISUAL STUDIO\MyProjects\leaktest\leaktest.cpp(20) : {18} 
normal block at 0x00780E80, 64 bytes long.
 Data: <                > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
Object dump complete.

#define _CRTDBG_MAP_ALLOC 문을 사용하지 않으면 메모리 누수 덤프가 다음과 같이 표시됩니다.

Detected memory leaks!
Dumping objects ->
{18} normal block at 0x00780E80, 64 bytes long.
 Data: <                > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD
Object dump complete.

_CRTDBG_MAP_ALLOC가 정의되지 않으면 다음 사항이 표시됩니다.

  • 메모리 할당 번호(중괄호 안에 표시)
  • 블록 형식(표준, 클라이언트 또는 CRT)
  • 16진수로 표기한 메모리 위치
  • 바이트로 표기한 블록 크기
  • 16진수로 표기한 처음 16바이트의 내용

_CRTDBG_MAP_ALLOC가 정의되면 누수된 메모리가 할당된 파일을 찾을 수 있습니다. 파일 이름 뒤에 오는 괄호 안의 숫자(예: 20)는 파일에서의 줄 번호입니다.

메모리가 할당된 소스 파일의 줄로 이동하려면

  • 출력 창에서 파일 이름과 줄 번호가 있는 줄을 두 번 클릭합니다.

    - 또는 -

  • 출력 창에서 파일 이름과 줄 번호가 있는 줄을 선택하고 F4 키를 누릅니다.

_CrtSetDbgFlag

프로그램이 항상 같은 위치에서 종료되는 경우에는 _CrtDumpMemoryLeaks를 쉽게 호출할 수 있습니다. 그러나 프로그램이 여러 위치에서 종료되는 경우를 생각해 보십시오. 종료할 수 있는 모든 위치에서 _CrtDumpMemoryLeaks를 호출하는 대신 프로그램 시작 부분에 다음 호출을 포함할 수 있습니다.

_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );

이 문은 프로그램이 종료될 때 자동으로 _CrtDumpMemoryLeaks를 호출합니다. 위의 예제와 같이 비트 필드 _CRTDBG_ALLOC_MEM_DF_CRTDBG_LEAK_CHECK_DF를 모두 설정해야 합니다.

CRT 보고서 모드 설정

기본적으로 _CrtDumpMemoryLeaks는 위에서 설명한 대로 출력 창의 디버그 창으로 메모리 누수 정보를 덤프합니다. _CrtSetReportMode를 사용해 다른 위치로 덤프하도록 다시 설정할 수 있습니다. 라이브러리를 사용할 경우 출력을 다른 위치로 다시 설정할 수 있습니다. 이 경우 다음 문을 사용하여 출력 위치를 출력 창으로 다시 설정할 수 있습니다.

_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_DEBUG );

_CrtSetReportMode를 사용하여 출력을 다른 위치로 보내는 방법은 _CrtSetReportMode를 참조하십시오.

참고 항목

메모리 누수 탐지 및 격리

,
Technical Article/펌 2005. 7. 29. 14:51

BSTR 관련 타입 변환 팁입니다.

:: BSTR 관련 타입 변환 팁입니다.



박성규 (2004-11-29 12:28:18, Hit: 492, Vote: 40)



출처 : http://www.codeguru.com/Cpp/Cpp/string/conversions/article.php/c5639/
-Robert Pittenger-


BSTR GetBSTR()
{
_bstr_t bstr1(_T("This is the test string."));
BSTR bstr;
bstr = bstr1.copy();
return bstr;
}

CComBSTR GetComBSTR()
{
CComBSTR bstr("This is the test string.");
return bstr;
}

void CVbsDlg::ShowBSTR(BSTR bstr)
{
_bstr_t bstrStart(bstr);
CString s;
s.Format(_T("%s"), (LPCTSTR)bstrStart);
AfxMessageBox(s);
}




1. BSTR 형을 _bstr_t 형으로 바꾸기
// BSTR to _bst_t
BSTR bstrStart = GetBSTR();
// use the constructor
_bstr_t bstrFinal(bstrStart);
ShowBSTR(bstrFinal);
// Use the = operator
bstrFinal = bstrStart;
ShowBSTR(bstrFinal);

2. _bstr_t 형을 BSTR 형으로 바꾸기
// _bstr_t to BSTR
_bstr_t bstrStart(_T("This is the test string."));
BSTR bstrFinish;
// use _bstr_t::copy member function
bstrFinish = bstrStart.copy();
ShowBSTR(bstrFinish);
// use = operator
bstrFinish = bstrStart;
ShowBSTR(bstrFinish);

3. CComBSTR 형을 BSTR 형으로 바꾸기
// CComBSTR to BSTR
CComBSTR bstrStart(_T("This is the test string."));
BSTR bstrFinish;
// use the = operator
bstrFinish = bstrStart;
ShowBSTR(bstrFinish);
// use the Copy member function
bstrFinish = bstrStart.Copy();
ShowBSTR(bstrFinish);

4. _bstr_t 형을 CComBSTR 형으로 바꾸기
// _bstr_t to CComBSTR
_bstr_t bstrStart(_T("This is the test string."));
CComBSTR bstrFinish;
bstrFinish.AppendBSTR(bstrStart);
ShowBSTR(bstrFinish);

5. BSTR 형을 CString 형으로 바꾸기
// BSTR to C String
BSTR bstrStart;
bstrStart = GetBSTR();
TCHAR szFinal[255];
// direct conversion from BSTR to LPCTSTR only works
// in Unicode
_stprintf(szFinal, _T("%s"), (LPCTSTR)bstrStart);
AfxMessageBox(szFinal);
_bstr_t bstrIntermediate(bstrStart); // convert to _bstr_t
CString strFinal;
// you have to go through _bstr_t to have it work in ANSI
// and Unicode
_stprintf(szFinal, _T("%s"), (LPCTSTR)bstrIntermediate);
// Or, using MFC
strFinal.Format(_T("%s"), (LPCTSTR)bstrIntermediate);
AfxMessageBox(strFinal);

6. _bstr_t 형을 CString 형으로 바꾸기
_bstr_t bstrStart(_T("This is the test string."));
TCHAR szFinal[255];
_stprintf(szFinal, _T("%s"), (LPCTSTR)bstrStart);
AfxMessageBox(szFinal);

7. CComBSTR 형을 LPCTSTR 형으로 바꾸기
// CComBSTR to C String
CComBSTR bstrStart("This is the test string.");
_bstr_t bstrIntermediate(bstrStart);
TCHAR szFinal[255];
_stprintf(szFinal, _T("%s"), (LPCTSTR)bstrIntermediate);
AfxMessageBox(szFinal);

8. LPCTSTR 형을 _bstr_t 형으로 바꾸기
// LPCTSTR to _bstr_t
LPCTSTR szStart = _T("This is the text string");
// Use the constructor
_bstr_t bstrFinal(szStart);
ShowBSTR(bstrFinal);
// or use = operator
bstrFinal = szStart;
ShowBSTR(bstrFinal);

9. LPCTSTR 형을 CComBSTR 형으로 바꾸기
// LPCTSTR to CComBSTR
// Use a constructor
LPCTSTR szStart = _T("This is the text string");
// Use the constructor
CComBSTR bstrFinal(szStart);
ShowBSTR(bstrFinal);
// Or use the Append function
bstrFinal.Empty();
bstrFinal.Append(szStart);
ShowBSTR(bstrFinal);



출처 : http://www.codeguru.com/Cpp/Cpp/string/conversions/article.php/c5639/
-Robert Pittenger-






null
(2005.05.24 14:37) 좋은 팁 감사~


현군
(2005.07.29 09:35) OLE2T 등의 매크로도 있습니다. (아시겠지만 -_-a)
BSTR -> TCHAR 등등 그런대로 편해요..
,
Technical Article/펌 2005. 7. 28. 10:02

MFC AppWizard(dll)로 About Dialog DLL만들기

MFC AppWizard(dll)로 About Dialog DLL만들기

[DLL만들기]

1. New - Project탭 - MFC AppWizard(dll) 선택
프로젝트명 FiaAbout

2. Regular DLL using shared MFC DLL 선택

3. dialog 추가~

4. Class Wizard(Ctrl+w)를 실행하면 Adding a Class 다이얼로그 뜬다.
Create a new class 선택 CFiaAboutDlg 클래스 생성

5. FiaAbout.cpp에서 다음 코드 삽입

void ShowFiaAboutDlg()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CFiaAboutDlg dlg;
dlg.DoModal();
}


6. FiaAbout.def파일에서 외부에서 참조할 함수명 추가(ShowFiaAboutdlg)

; FiaAbout.def : Declares the module parameters for the DLL.

LIBRARY "FiaAbout"
DESCRIPTION 'FiaAbout Windows Dynamic Link Library'

EXPORTS
; Explicit exports can go here
ShowFiaAboutDlg ; <= 요거


7. 빌드~ 하면 FiaAbout.dll과 FiaAbout.lib 생성됨



[DLL을 사용할 프로젝트에서 - 프로젝트명 Fia이며 다이얼로그 기반일때 ]

+ 프로젝트 생성시 About 체크해놓고 생성해야 수정하기 편함

1. 해당 프로젝트에 dll과 lib을 복사

2. Project Settings - Link(tab) - General(category) - Object/library modules에
FiaAbout.lib 추가후 OK

3. CFiaDlg.cpp에서

void CFiaDlg::OnSysCommand(UINT nID, LPARAM lParam) 찾아서

위에 다음 코드로 추가및 수정

extern __declspec(dllimport) void ShowFiaAboutDlg();

void CFiaDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
ShowFiaAboutDlg();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}


4. About관련 클래스 소스 및 리소스(IDD_ABOUT) 삭제.

5. 컴파일. 완료.
,
Technical Article/펌 2005. 7. 27. 17:04

Java 에서 전처리문 사용하기

제 목 Java 에서 전처리문 사용하기.. 7170 oselo79@nate.com 7170 0 0
작 성 자 oOOo(oselo79)
첨부
파일
작성시각 2005-07-26 오후 11:06:41 조 회 수 49
글 분 류 ETC

C++ 게시판에 Java 관련해서 올리니.. 좀 아이러니하네요.



그래도 C 의 전처리기를 이용해서, 각종 언어에 전처리문을 넣을 수 있는 것이니 괜찮겠죠^^?





Java 코딩을 할 때, 전처리문이 없기 때문에 불편한 점이 꽤 많습니다.

버전관리 할 때, 특히 그렇죠.





다음과 같이 *.bat 파일을 만들었습니다.



=====================

mkdir bak

copy *.java bak\

ren *.java *.c

cl.exe /P /EP

del *.c

ren *.i *.java

pause

=====================





cl.exe 가 없다는 에러가 나온다면, Visual Studio 가 설치되어 있는, bin 폴더에 보면 있습니다.

복사해서 사용하던지..

SET PATH = "%비주얼스투디오 설치된 곳%\bin

을 잴 위에 넣어줘도 되고요..











이렇게 하면,

#include "Define.h" // 제 경우, Define.h 에 모든 #define 문을 넣어놨습니다.

#if,#ifdef

등.. 전처리문을 쓸 수 있습니다.



특히,

#define 문이 없기 때문에.



public final int TVALUE = 10; // 이런식으로 상수를 만들었던 것을,

#define TVALUE 10 // 으로 대체 할 수 있기 때문에, 상당히 유용할 듯 합니다.





특히, 모바일 JAVA 할 때, 버전 관리에 유용하겠죠??
,
Technical Article/펌 2005. 7. 22. 17:43

getcwd => GetCurrentDirectory

char pszDirectory[512];
// _getcwd( pszDirectory, 512 );
// Windows2003에서는 \windows\system32 밑에 생성된다 ㅡㅡ; 이상하다~
GetCurrentDirectory(512, pszDirectory);




데브피아 추가 검색!! [070123]

프로그램 내에서 SetCurrentDirectory() 를 설정하세요.

여기에서 현재 디렉토리는 GetModuleFileName()에서 파싱해서 디렉토리만 가져오면 됩니다.

splitpath() 라는 함수도 있습니다.

이 함수 쓰면 알아서 파싱 해줍니다.

윗분 답변이 맞는거 같은데...

혹시 실행파일 소스가 없으신가요?

이 글에 평점 주기:  
       [답변]흠...  | 2006-12-14 오후 5:44:40
이광진 (mirjini)   이광진님께 메시지 보내기이광진님을 내 주소록에 추가합니다.이광진님의 개인게시판 가기 번호: 628208  / 평점: (-)  

네... GetCurrentDirectory 함수에 의해서는 현재 설정되어 있는 디렉토리 경로가 반환되니 당연한 결과겠지요...


그래서 GetCurrentDirectory 사용할 부분에 GetModuleFileName 함수를 이용해서 현재 실행되는 경로를 얻어서 사용하시라는 거였습니다.


GetCurrentDirectory 함수는 유동적으로 변경되는 것이기 때문에 실행 경로를 얻기에 적합한 함수는 아닙니다.

반드시 GetCurrentDirectory 함수를 사용하셔야만 하는 이유라도 있으신 건가요?


그렇지 않다면 제가 말씀드린 방법으로 해 보시기 바랍니다.


,
Technical Article/펌 2005. 7. 18. 16:54

[MB] Brew Debug Sequence Information

Debug Sequence Information

--------------------------------------------------------------------------------

Information on Debug Sequences:

Please note that all the Debug key sequences noted below are the default key sequences. These key sequences may be modified by the OEM.

###0: Turn Debugging off
This debug key sequence resets/toggles off all debug states.

###1: Memory Validation
On every heap access, BREW walks the heap to determine if the pointer is in valid range and will not over-write/over-read a heap node. An exception will be thrown if the heap access will cause corruption of a heap node.

###2: Net Debug Tool
The Net Debug Tool can be used to view the device's network (socket and PPP) states while your application is running. When the Net Debug Tool is turned on, a box will appear in the right hand corner and will display a series of codes that can be used to determine the state of your application's data call. The codes vary per BREW version and are shown below.

Network State Codes:

BREW 1.0:
'c' Socket Connecting
'C' Socket Connected
'x' Socket Closing
' ' Socket Closed
'I' Socket Idle
'R' Socket Read
'W' Socket Write
'd' PPP Opening
'D' PPP Open
'-' PPP Closing
'O' PPP Closed


BREW 1.1:
'c' Socket Connecting
'C' Socket Connected
'x' Socket Closing
'X' Socket Closed
'I' Socket Idle
'R' Socket Read
'W' Socket Write
'r' Socket RecvFrom
'w' Socket SendTo
'd' PPP Opening
'D' PPP Open
'z' PPP Closing
'Z' PPP Closed

BREW 2.0:
'c' Socket Connecting
'C' Socket Connected
'x' Socket Closing
'X' Socket Closed
'I' Socket Idle
'b' Socket Bind
'B' Socket Bound
'R' Socket Read
'W' Socket Write
'r' Socket RecvFrom
'w' Socket SendTo
'^' PPP Opening
'=' PPP Open
'v' PPP Closing
'#' PPP Closed
'<' PPP Sleeping
'~' PPP Asleep
'>' PPP Waking

###3: Largest Available Heap Block
Displays the maximum size block that can be allocated on the heap in the upper left corner of the screen.

###4: Debug Privileges
This debug sequence is not yet implemented.

###5: Debug Malloc – throws exception on MALLOC failure
Throws an exception on malloc failure.

###6: Debug Null – Every Nth MALLOC is failed
When this debug sequence is turned on, every Nth MALLOC will fail, even if RAM is available. Currently, N is set to 100.

###7: Sync/Async DBGPRINTF
This debug sequence toggles between two modes: synchronous DBGPRINTF and asynchronous DBFPRINTF. In synchronous DBGPRINTF mode, BREW waits for certain duration before returning from a DBGPRINTF statement in order to allow time for the DBGPRINTF message to be sent on the serial port. In the default, asynchronous mode, the DBGPRINTF returns immediately.

###8: Debug Dump Modules
This debug sequence is not yet implemented.

###9: Debug Dump Heap
Every time this sequence is pressed, heap and resource usage information is dumped on the emulator debug window or onto the Serial port.

The heap info consists of the number of bytes, the system that allocates it, an internally used index, the file name and line number, and whether the memory is locked (L) or unlocked(U).

Additional information is displayed on Allocated and Free RAM, and resource usage.
__________________
Max
BREW Support

mohlendo
View Public Profile
Send a private message to mohlendo
Visit mohlendo's homepage!
Find all posts by mohlendo
Add mohlendo to Your Buddy List

#2 03-19-2004, 03:09 AM
tyndal
Registered User Join Date: Dec 2002
Posts: 926

on the vx6000, the debug sequence is

**********

instead of

###

please post any other known debug sequences here.

-Tyndal

tyndal
View Public Profile
Send a private message to tyndal
Find all posts by tyndal
Add tyndal to Your Buddy List

#3 07-23-2004, 09:18 AM
KIRAN
Registered User Join Date: Jun 2004
Posts: 5

Thanks

--------------------------------------------------------------------------------

Many thanks for providing vital information regarding debug key sequences. This is indeed very much useful to developers.
Thanks once again,
Kiran.

KIRAN
View Public Profile
Send a private message to KIRAN
Send email to KIRAN
Find all posts by KIRAN
Add KIRAN to Your Buddy List

#4 07-28-2004, 06:08 AM
accolade
Registered User Join Date: Apr 2004
Posts: 153

###6: Debug Null – Every Nth MALLOC is failed
When this debug sequence is turned on, every Nth MALLOC will fail, even if RAM is available. Currently, N is set to 100.


How do we change N to 2 or 3 or 1 ?

Thanks,


Quote:
Originally Posted by mohlendo
Information on Debug Sequences:

Please note that all the Debug key sequences noted below are the default key sequences. These key sequences may be modified by the OEM.

###0: Turn Debugging off
This debug key sequence resets/toggles off all debug states.

###1: Memory Validation
On every heap access, BREW walks the heap to determine if the pointer is in valid range and will not over-write/over-read a heap node. An exception will be thrown if the heap access will cause corruption of a heap node.

###2: Net Debug Tool
The Net Debug Tool can be used to view the device's network (socket and PPP) states while your application is running. When the Net Debug Tool is turned on, a box will appear in the right hand corner and will display a series of codes that can be used to determine the state of your application's data call. The codes vary per BREW version and are shown below.

Network State Codes:

BREW 1.0:
'c' Socket Connecting
'C' Socket Connected
'x' Socket Closing
' ' Socket Closed
'I' Socket Idle
'R' Socket Read
'W' Socket Write
'd' PPP Opening
'D' PPP Open
'-' PPP Closing
'O' PPP Closed


BREW 1.1:
'c' Socket Connecting
'C' Socket Connected
'x' Socket Closing
'X' Socket Closed
'I' Socket Idle
'R' Socket Read
'W' Socket Write
'r' Socket RecvFrom
'w' Socket SendTo
'd' PPP Opening
'D' PPP Open
'z' PPP Closing
'Z' PPP Closed

BREW 2.0:
'c' Socket Connecting
'C' Socket Connected
'x' Socket Closing
'X' Socket Closed
'I' Socket Idle
'b' Socket Bind
'B' Socket Bound
'R' Socket Read
'W' Socket Write
'r' Socket RecvFrom
'w' Socket SendTo
'^' PPP Opening
'=' PPP Open
'v' PPP Closing
'#' PPP Closed
'<' PPP Sleeping
'~' PPP Asleep
'>' PPP Waking

###3: Largest Available Heap Block
Displays the maximum size block that can be allocated on the heap in the upper left corner of the screen.

###4: Debug Privileges
This debug sequence is not yet implemented.

###5: Debug Malloc – throws exception on MALLOC failure
Throws an exception on malloc failure.

###6: Debug Null – Every Nth MALLOC is failed
When this debug sequence is turned on, every Nth MALLOC will fail, even if RAM is available. Currently, N is set to 100.

###7: Sync/Async DBGPRINTF
This debug sequence toggles between two modes: synchronous DBGPRINTF and asynchronous DBFPRINTF. In synchronous DBGPRINTF mode, BREW waits for certain duration before returning from a DBGPRINTF statement in order to allow time for the DBGPRINTF message to be sent on the serial port. In the default, asynchronous mode, the DBGPRINTF returns immediately.

###8: Debug Dump Modules
This debug sequence is not yet implemented.

###9: Debug Dump Heap
Every time this sequence is pressed, heap and resource usage information is dumped on the emulator debug window or onto the Serial port.

The heap info consists of the number of bytes, the system that allocates it, an internally used index, the file name and line number, and whether the memory is locked (L) or unlocked(U).

Additional information is displayed on Allocated and Free RAM, and resource usage.


accolade
View Public Profile
Send a private message to accolade
Find all posts by accolade
Add accolade to Your Buddy List

#5 10-12-2004, 10:16 PM
ericF
Registered User Join Date: Apr 2004
Posts: 79

in fact, my handset is taking * instead of #.

ericF
View Public Profile
Send a private message to ericF
Find all posts by ericF
Add ericF to Your Buddy List

#6 10-12-2004, 10:40 PM
nparrish
Super Moderator Join Date: Apr 2004
Posts: 514

Some handsets deviate from the standard ###X sequence.

The LG VX6000/4500/4600 line, for example use **********X as the sequence.

The LG VX7000/8000, on the otherhand, use #######X.

This is typically documented on the known issues page for each device.
__________________
Nathan
BREW Support



nparrish
View Public Profile
Send a private message to nparrish
Send email to nparrish
Find all posts by nparrish
Add nparrish to Your Buddy List

#7 06-23-2005, 06:52 PM
pumasilk
Registered User Join Date: Jun 2005
Posts: 4

Debug sequence for my vx8000 is *******X ( '*' 7 times )

pumasilk
View Public Profile
Send a private message to pumasilk
Send email to pumasilk
Find all posts by pumasilk
Add pumasilk to Your Buddy List

#8 06-23-2005, 09:27 PM
Skavenger
Registered User Join Date: May 2004
Posts: 182

Is there anyway we can get this information put in the DDS's?
__________________
- Skavenger


출처 : 퀄컴 개발자 포럼
,
Technical Article/펌 2005. 7. 14. 10:39

트레이(tray)에 넣어보자

트레이(tray)에 넣어보자
작성자 : 이근호
작성이 : 2005.07.14 (최초작성일 2002년 2월)


1. CTrayIcon클래스를 생성.

CTrayIcon.h

// TrayIcon.h: interface for the CTrayIcon class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_TRAYICON_H__24E119DA_5ACC_44B5_A130_CA747C2359A5__INCLUDED_)
#define AFX_TRAYICON_H__24E119DA_5ACC_44B5_A130_CA747C2359A5__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CTrayIcon
{
private:
NOTIFYICONDATA m_tnd;

public:
CTrayIcon();
virtual ~CTrayIcon();
BOOL Create(CWnd* pWnd, UINT uCallbackMessage, LPCTSTR szToolTip, HICON icon, UINT uID);
BOOL SetIcon(HICON hIcon);
BOOL SetIcon(LPCTSTR lpszIconName);
BOOL SetIcon(UINT nIDResource);
void RemoveIcon();
};

#endif // !defined(AFX_TRAYICON_H__24E119DA_5ACC_44B5_A130_CA747C2359A5__INCLUDED_)



CTrayIcon.cpp

// TrayIcon.cpp: implementation of the CTrayIcon class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"

#include "TrayIcon.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CTrayIcon::CTrayIcon()
{

}

CTrayIcon::~CTrayIcon()
{

}


BOOL CTrayIcon::Create(CWnd* pWnd, UINT uCallbackMessage,
LPCTSTR szToolTip, HICON icon, UINT uID)
{

m_tnd.cbSize = sizeof(NOTIFYICONDATA);
m_tnd.hWnd = pWnd->GetSafeHwnd();
m_tnd.uID = uID;
m_tnd.hIcon = icon;
m_tnd.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;
m_tnd.uCallbackMessage = uCallbackMessage;
strcpy(m_tnd.szTip, szToolTip);

return Shell_NotifyIcon(NIM_ADD, &m_tnd);
}


BOOL CTrayIcon::SetIcon(HICON hIcon)
{
m_tnd.uFlags = NIF_ICON;
m_tnd.hIcon = hIcon;
return Shell_NotifyIcon(NIM_MODIFY, &m_tnd);
}

BOOL CTrayIcon::SetIcon(LPCTSTR lpszIconName)
{
HICON hIcon = AfxGetApp()->LoadIcon(lpszIconName);
return SetIcon(hIcon);
}

BOOL CTrayIcon::SetIcon(UINT nIDResource)
{
HICON hIcon = AfxGetApp()->LoadIcon(nIDResource);
return SetIcon(hIcon);
}

void CTrayIcon::RemoveIcon()
{
m_tnd.uFlags = 0;
Shell_NotifyIcon(NIM_DELETE, &m_tnd);
}




2. #include "TrayIcon.h"
다이얼로그 기반일때 XXXDlg.h에 삽입
SDI기반일때 MainFrm.h에 삽입



3. 멤버변수,함수 추가
CTrayIcon m_TrayIcon;
LRESULT OnTrayNotification(WPARAM wParam, LPARAM lParam);

기반에 따라 상동.

4. OnCreate() 오버라이딩
if ( !m_TrayIcon.Create(this, WM_ICON_NOTIFY, _T("Vin's Messenger"),NULL, IDR_MAINFRAME))
return -1;

m_TrayIcon.SetIcon(IDR_MAINFRAME);


5. DestroyWindow() 오버라이딩
m_TrayIcon.RemoveIcon();

6. 트레이 아이콘 이벤트 추가
cpp파일에서
#define WM_ICON_NOTIFY WM_USER+10
삽입


7. 이벤트 메세지 맵 추가

BEGIN_MESSAGE_MAP(COnDlg, CDialog)
//{{AFX_MSG_MAP(COnDlg)
ON_MESSAGE(WM_ICON_NOTIFY, OnTrayNotification)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()


8. 리소스에 메뉴 추가
여기서 임의의 아이디 IDR_MAINFRAME의 첫번째 메뉴에 해당.

LRESULT COnDlg::OnTrayNotification(WPARAM wParam, LPARAM lParam)
{
CMenu menu, *pSubMenu;

int nEvent = LOWORD(lParam);

switch ( nEvent )
{
case WM_RBUTTONUP:
{
if(!menu.LoadMenu(IDR_MENU1)) return 0;
if(!(pSubMenu = menu.GetSubMenu(0))) return 0;

CPoint pos;
GetCursorPos(&pos);

SetForegroundWindow();
pSubMenu->TrackPopupMenu(TPM_RIGHTALIGN, pos.x, pos.y, this);
menu.DestroyMenu();
break;
}
case WM_LBUTTONDBLCLK:
{
AfxGetMainWnd()->ShowWindow(SW_HIDE);
// SendMessage(WM_COMMAND, ID_APP_ABOUT);
break;
}
}

return 1;

}


8. 해당메뉴 이벤트 오버라이딩
이제 추가해줄거 추가해주면 끝~
,
Technical Article/펌 2005. 7. 13. 13:38

후킹(hook)관련 자료

링크들
http://dasomnetwork.com/~leedw/mywiki/moin.cgi/API_20Hooking


--------------------------------------------------------------------------------

Win32 global hooking UserPreferences

Welcome 동우의 HomePage 주제분류 추천사이트 방명록 RecentChanges WikisandBox

Written by 조경민(bro)


후크에는 두가지가 있다.
Local Hook - 하나의 스레드나 프로세스 안에서의 후킹
Global Hook - 전역 모든 윈도우들에 대한 후킹

후크를 하기 위해서는 기본적으로 두가지 자료형을 알아야 한다.
HHOOK - 후크 핸들 윈도우 시스템에서 한번 이벤트가
발생하면 후크 체인의 첫 후크핸들에게 이벤트를
넘긴다. 각 후크들은 다음 후크를 호출하여 후크체인에
있는 모든 후크 프로시져를 호출하게 된다.
HOOKPROC - 후크 프로시져로 후크시 호출되는 프로시져이다.
LRESULT CALLBACK fnHookProc(int nCode, WPARAM wParam, LPARAM lParam)
라는 자료형을 갖는다.

1. 로컬 후킹
SetWindowsHookEx를 이용하면 간단히 구현이 가능하다.
각 후크는 후크 타입이 있는데 아래와 같다.
WH_CALLWNDPROC - 윈도우 메세지가 목적지로 전달되기 전에
메세지를 후크할때 쓴다 (SendMessage)
CallWndProc라는 후크프로시져명의 도움말 참조한다.
WH_CALLWNDPROCRET - 윈도우 메세지가 목적지에 전달되어 처리
된 후 후크가 일어난다
CallWndRetProc함수명 도움말 참조
WH_CBT - computer-based training (CBT) application 에 유용한
후크 타입 CBTProc 함수 참조
WH_DEBUG - 디버깅에 유용한 후크 DebugProc 참조
WH_FOREGROUNDIDLE - Foreground상태있는 윈도우가 idle상태로 들어갈
때 생기는 후크 이는 idle시 낮은 우선순위
(low priority)를 줄때 유용하다 ForegroundIdleProc
WH_GETMESSAGE - 메세지가 Post된 후 후크됨 (PostMessage)
GetMsgProc 함수 참조
WH_JOURNALPLAYBACK - WH_JOURNALRECORD에 의해서 Record되기 전에
일어나는 후크 JournalPlaybackProc
WH_JOURNALRECORD - Input message가 시스템 메세지 큐로 들어가는것을
Record하는 후크 JournalRecordProc
WH_KEYBOARD - 등등이 있다.... -_- 도움말 참조..


--------------------- 로컬 후크 예제 ------------------------------
HHOOK hHook;
HOOKPROC hProc;
:
hProc = CallWndProc; // CallWndProc 후크 프로시져로 연결
hHook = ::SetWindowsHookEx( // 후크를 설치한다. ( 후크체인에 끼워넣는다 )
WH_CALLWNDPROC, // WH_CALLWNDPROC 후크 설치
hProc, // 후크차례가 오면 분기되는 콜백후크 프로시져
(HINSTANCE) NULL, // 전역 후크가 아닌 로컬 후크임을 말한다
dwTreadID); // 특정 스레드를 정한다 0 이면 현재 스레드


만일 여러 스레드중 한 HWND가 속한 스레드를 얻고 싶으면
DWORD dwProcessID = NULL;
DWORD dwTreadID = ::GetWindowThreadProcessId( hWnd, &dwProcessID );

if( dwProcessID )
{
:
후크 설치코드 맨 마지막인자에 dwThreadID를 넣으면 된다.
}

// 자세한 프로시져 도움말을 보면 자세히 알수 있다.
LRESULT WINAPI CallWndProc(int nCode, WPARAM wParam, LPARAM lParam)
{
CWPSTRUCT* lpWp = (CWPSTRUCT*)lParam;
//PMSG lpMsg = (PMSG)lParam;
if (nCode < 0 && hWnd == lpWp->hwnd ) // do not process message
return CallNextHookEx(m_stHookCallProc.hHook, nCode, wParam, lParam);

switch( lpWp->message )
{
case EM_REPLACESEL :
TRACE("CallWndProc EM_REPLACESEL %s\r\n ", (char*)lpWp->lParam );
break;

default :
break;
}
return CallNextHookEx(m_stHookCallProc.hHook, nCode,
wParam, lParam);
}

2 전역 후킹
전역 후킹을 하기 위해서는 후크 프로시져를 dll안에 넣어야 한다.



--------------------- 전역 후크 예제 --------------------------

testdll.dll 에서 ............

// dll에서 쓰는 자료는 dll공유를 했다.
// 이 후크 프로시져 dll은 내 프로그램에서 쓰이기도 하지만
// 시스템에 의해서 이 dll이 또 열리게 된다. ( dll의 참조카운트 증가
// 가 일어나지 않고 새로 dll이 생긴다. 따라서 두 dll은 자료가
// 분리되어 있는 셈이다. )
// 그러므로 부득이 하게 자료를 공유자료로 해야 한다.
#pragma data_seg(".shared")
HHOOK _hHook = NULL;
HWND _hTarget = NULL;
#pragma data_seg()
// 공유 자료로 했을 경우 아래처럼 링커 옵션도 주어야 한다.
#pragma comment(linker, "/SECTION:.shared,RWS")

// 자료 억세스 함수 마련...
extern "C" __declspec(dllexport) void fnSetHook( HHOOK hHook )
{
_hHook = hHook;
}

extern "C" __declspec(dllexport) void fnSetHWND( HWND hWnd )
{
_hTarget = hWnd;
char szBuf[20];
wsprintf( szBuf, "%lu", (ULONG)_hTarget );
MessageBox( NULL, szBuf, "fnSetHWND당시의 _hTarget값", MB_OK);
}

extern "C" __declspec(dllexport) HHOOK fnGetHook()
{
return _hHook;
}

// 콜백을 위한 CALLBACK 콜링컨벤션 키워드를 넣게 되면 나중에 GetAddressProc시
// NULL값을 리턴하므로 그냥 콜링컨벤션을 무시했다
//extern "C" __declspec(dllexport) LRESULT CALLBACK fnCallWndProc(int nCode, WPARAM wParam, LPARAM
lParam)
extern "C" __declspec(dllexport) LRESULT fnCallWndProc(int nCode, WPARAM wParam, LPARAM lParam)
{
CWPSTRUCT* lpWp = (CWPSTRUCT*)lParam;

if( nCode >= 0 ) //&& _hTarget == lpWp->hwnd ) // do not process message
{
switch( lpWp->message )
{
case EM_REPLACESEL :
if( _hTarget == lpWp->hwnd )
{
MessageBox( NULL, "EM_REPLACESEL 메세지 발쌩", "메세지 발쌩in
dll", MB_OK);
}
break;

default :
break;
}
}
return CallNextHookEx( _hHook, nCode, wParam, lParam);
}


내 프로그램에서 .........................
HINSTANCE hInstDll = NULL
HHOOK hHook = NULL;

// dll을 연다.
hInstDll = LoadLibrary("TestDll.dll");
if( hInstDll )
{
// 후크 프로시져를 찾아낸다.
LRESULT (*hHookDllProc)(int, WPARAM, LPARAM ) = (LRESULT (*)(int, WPARAM, LPARAM ))
GetProcAddress(hInstDll, "fnCallWndProc");
if( hHookDllProc ) // 있으면 후크를 설치한다.
hHook = SetWindowsHookEx( WH_CALLWNDPROC, (HOOKPROC)hHookDllProc, hInstDll, 0);

// dll내의 자료를 세팅한다. HHOOK와 HWND 값 세팅
void (*lpfnSetHook)(HHOOK) = (void (*)(HHOOK))GetProcAddress(hInstDll, "fnSetHook");
if( lpfnSetHook )
(*lpfnSetHook)( hHook );
void (*lpfnSetHWND)(HWND) = (void (*)(HWND))GetProcAddress
(hInstDll, "fnSetHWND");
if( lpfnSetHWND )
(*lpfnSetHWND)( m_hTarget );
}



--------------------------------------------------------------------------------
출처 : http://dasomnetwork.com/~leedw/mywiki/moin.cgi/Win32_20global_20hooking
,
TOTAL TODAY