빌더에서 가끔 보면 디자인 패키지에는 컴포넌트가 있으나 디자인 팔레트가 나타나지 않을 경우가 있다.
이럴때 사용하고자 할때에는

.cpp에 추가할 내용
#pragma link "사용할_OCX"

.h에 추가할 내용
#include "사용할_OCX.h"

를 하고 해당 컴포넌트를 사용하면 사용 가능함..
[원문주소] http://cbuilder.borlandforum.com/impboard/impboard.dll/trackback?sn=97053
http://cbuilder.borlandforum.com/impboard/impboard.dll?action=read&db=bcb_faq&no=108
Delphi 로 된 Component 를 설치하다 보면 Dsgnintf.dcu 또는 Designintf.dcu 를 찾을 수 없다는
에러 메시지를 보게 됩니다. 이 에러 메시지가 나는 이유는 무엇일까요?

Component 에는 Design Time 에서 사용하기 쉽도록 Component Editor, Property Editor 가
포함되어 있는 경우가 있습니다. Delphi 에서 Design Time 에 필요한 Component Editor, Property Editor 를
사용하기 위해서는 uses 부분에 Designintf 또는 Dsgnintf 를 사용해야 합니다. 어떤 것을 사용할지는
Delphi 버전에 따라 다르겠지요. Delphi 6 이후부터는 Designintf 를 사용합니다.

C++Builder 에서 사용할 경우 약간 까다로운 문제가 발생합니다.
C++Builder 에는 Delphi Compiler 인 dcc32.exe 와 C++ Compiler 인 bcc32.exe 가 공존합니다.
따라서 패키지 파일인 bpk 파일에 두개의 컴파일러를 위한 옵션이 따로 있습니다.

bpk 를 텍스트 에디터로 열어서 그 내용을 보면 다음과 같은 항목이 있습니다.

<CFLAG1 value="-Od -H=$(BCB)\lib\vcl60.csm -Hc -Vx -Ve -X- -r- -a8 -b- -k -y -v -vi- -c
      -tWM"/>
<PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M"/>


CFLAG1 은 C++ Compiler 인 bcc32.exe 를 위한 옵션입니다.
PFLAGS 는 Delphi Compiler 인 dcc32.exe 를 위한 옵션입니다.

Component 를 C++Builder 로 만들었다면 PACKAGES value 값에 designide.bpi 가 포함됩니다.
<PACKAGES value="rtl.bpi ApLabel_bcb6.bpi designide.bpi vcl.bpi vcljpg.bpi"/>


Delphi 로 Component 를 만들었다면 문제가 발생합니다. Delphi Compiler 인 dcc32.exe 에
designide 패키지를 사용하겠다는 것을 알려주어야 됩니다. 그런데 얄밉게도 Builder 가 알아서
처리하지 못합니다. 따라서 사용자가 수동으로 처리를 해주어야 합니다.

dcc32.exe 의 옵션을 보면 -LU 라는 옵션이 있습니다. 패키지를 사용하겠다는 것을 알려주는
옵션입니다. 이 옵션을 사용자가 수동으로 지정해 줍니다. 다음과 같이 말입니다.

<PFLAGS value="-$YD -$W -$O- -$A8 -v -JPHNE -M -LUDesignIde"/>
이 에러는 디버거 모듈이 로드 되지 않았을때 나온다.. 업데이트 하다가 많이 발생했다..

이럴때는 이 모듈을 다시 등록해주면 된다..

regsvr32 bordbk105.dll
regsvr32 bordbk105n.dll


Open Dialog나 Save Dialog 사용시 보통 실행 시키면 화면 중앙에 위치하게 된다.

그런데, 원하는 특정 위치로 보내야할때가 있다..

이럴때는 해당 다이얼로그의 OnFolderChange의 이벤트에 다음과 같이 작성한다.
 
요약: When trying to creating a simple C++ designtime package that might refer to ‘DesignIntf’,’DesignEditors, the Delphi compiler complains that 'DesignIntf.dcu' and 'Proxies.dcu'cannot be found.

When trying to compile a C++ package that refers to DesignIntf, DesignEditors in say, a pascal unit you might see errors as follows:

[DCC Error] XXXX.pas(X): F1026 File not found: 'DesignIntf.dcu'


Or if you add the DesignEditors.pas location to the project’s "search path", the error is:

[DCC Error] DesignEditors.pas(609): F1026 File not found:'Proxies.dcu'

This issue is documented in readme for BDS2006. This is the note from BDS 2006's readme file:

 

C++ Notes
If you are creating a C++ Package that contains a Delphi unit thatuses the DesignIntf and DesignEditors tools, you must choose Project|Options|Pascal Compiler|Other Options and then add
"-LUDesignIDE" for the compiler to work correctly.

So in CB2007/RAD Studio 2007, all you need to do is:

Project|Options|Pascal Compiler|Other Options|"Use these packages when
compiling", then add "DesignIDE" in the combobox. 

Author: Roy Nelson


// 한번에 하는 방법은 ForceDirectories 함수를 이용하면 된다..

함수 설명은 아래와 같다..  반환값은 실패 성공 뿐이니까.. 실패 성공만 처리하면된다..
굳이 디렉토리가 존재하는지 확인 할 필요도 없다.
있으면 그냥 넘어가고 없으면 생성하게 된다.

ex) ForceDirectories("C:\\IT\\LOG");

Creates a new directory, including the creation of parent directories as needed.

Pascal
function ForceDirectories(const Dir: string): Boolean;
C++
Boolean ForceDirectories(string Dirconst);

FileCtrl

ForceDirectories creates a new directory as specified in Dir, which must be a fully-qualified path name. If the directories given in the path do not yet exist, ForceDirectories attempts to create them. 

ForceDirectories returns true if it successfully creates all necessary directories, false if it could not create a needed directory.

Warning: 
Important:Do not call ForceDirectories with an empty string. Doing so causes ForceDirectories to raise an exception.  
Note: 
The FileCtrl unit (Windows only) also contains a ForceDirectories function. However, the FileCtrl version is deprecated, and the SysUtils version preferred, even if the code does not need to be cross-platform.  

 


사용예) hDLL = LoadLibraryEx("Temp.dll", NULL,LOAD_LIBRARY_AS_DATAFILE);

#define DONT_RESOLVE_DLL_REFERENCES            0x00000001
#define LOAD_IGNORE_CODE_AUTHZ_LEVEL           0x00000010
#define LOAD_LIBRARY_AS_DATAFILE                     0x00000002
#define LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE   0x00000040
#define LOAD_LIBRARY_AS_IMAGE_RESOURCE       0x00000020
#define LOAD_WITH_ALTERED_SEARCH_PATH         0x00000008

참고
•DONT_RESOLVE_DLL_REFERENCES :
   이 옵션은 윈도우 NT에서만 사용할 수 있으며 DllEntryPoint를 부르지 않을 때 사용한다.     DllEntry와 DllExit 코드는 Dll Main을 설명할 때 함께 하기로 하고,  지금은 Dll의 Entry Point에서 명시된 코드를 실행하지 않을 때 이 옵션을 사용한다

•LOAD_LIBRARY_AS_DATAFILE :
    이 옵션은 DLL 파일을 하나의 단순한 데이터 파일로 이해하고 적재하도록 하는데 그 목적이 있다. 실행 코드가 전혀 없는 DLL들은 시스템에서 DLL의 실행을 위한 특별한 준비가 필요하지 않으므로 실행 시간을 절약할 수 있다.

•LOAD_WITH_ALTERED_SEARCH_PATH :
   이 옵션을 사용하면 위에서 언급한 DLL을 탐색하는 경로를 LoadLibraryex(LPTCSTR)에 명시된 대로 바꿀 수 있다

매일 사용하는 RAD STUDIO 화면이 가끔 지겨울때 하는 짓...

리소스 에디터로 조금 수정해서 사용...

약간은 외설(?)스럽다고 할지도 모르겠네...

근데.. 이건 미술품인데..
사용자 삽입 이미지

'1.소프트웨어 이야기 > 00.VCL(C++ Builder, Delphi)' 카테고리의 다른 글

LoadLibraryEx  (0) 2008.03.20
조합키를 사용법  (0) 2008.01.10
[팁]W8057이 보기 싫을때..  (0) 2008.01.10

+ Recent posts