نمایش نتایج 1 تا 9 از 9

نام تاپیک: طریقه نصب OCX در دلفی 2006

  1. #1
    کاربر دائمی
    تاریخ عضویت
    بهمن 1381
    محل زندگی
    ایران
    پست
    101

    Arrow طریقه نصب OCX در دلفی 2006

    با سلام
    چطور میشه تو محیط دلفی 2006 یک فایل OCX را نصب کرد و از اون در Delphi Win32 استفاده کرد ؟ ؟

  2. #2
    کاربر دائمی آواتار Valadi
    تاریخ عضویت
    فروردین 1385
    محل زندگی
    فعلا در خدمت شما
    پست
    1,344
    این هم کد ریجستر کردن OCX و DLL
    Registering DLL and ActiveX controls from code

    How to register (and unregister) OLE controls such as dynamic-link library (DLL) or ActiveX Controls (OCX) files from a Delphi application



    One of the features that make Delphi so popular is that when it comes to project deployment, you as a developer (in most cases) only need to send the executable file (exe) of your application.

    However, in some situations, for example when you import an ActiveX control into your project, you'll need to make sure that this ActiveX control is registered on your users machines. If the control is not registered there, an EOleSysError exception will be displayed to your user eyes.

    RegSvr32.exe
    The regsvr32.exe command-line tool registers dll and ActiveX controls on a system. You can manually use the Regsvr32.exe (Windows.Start - Run) to register and unregister OLE controls such as dynamic link library (DLL) or ActiveX Controls (OCX) files that are self-registerable.
    When you use Regsvr32.exe, it attempts to load the component and call its DLLSelfRegister function. If this attempt is successful, Regsvr32.exe displays a dialog indicating success.

    RegSvr32.exe has the following command-line options:

    Regsvr32 [/u] [/s] [/n] [/i[:cmdline]] dllname

    /s - Silent; display no message boxes

    /u - Unregister server

    /i - Call DllInstall passing it an optional [cmdline];

    when used with /u calls dll uninstall

    /n - do not call DllRegisterServer; this option must

    be used with /i

    From Delphi code

    To call the regsvr32 tool from within Delphi code, you'll need a function that can execute a file and wait for the execution to finish.

    This is how the 'RegisterOCX' procedure could look:

    procedure RegisterOCX;

    type

    TRegFunc = function : HResult; stdcall;

    var

    ARegFunc : TRegFunc;

    aHandle : THandle;

    ocxPath : string;

    begin

    try

    ocxPath := ExtractFilePath(Application.ExeName) + 'Flash.ocx';

    aHandle := LoadLibrary(PChar(ocxPath));

    if aHandle <> 0 then

    begin

    ARegFunc := GetProcAddress(aHandle,'DllRegisterServer');

    if Assigned(ARegFunc) then

    begin

    ExecAndWait('regsvr32','/s ' + ocxPath);

    end;

    FreeLibrary(aHandle);

    end;

    except

    ShowMessage(Format('Unable to register %s', [ocxPath]));

    end;

    end;

    Note: the ocxPath variable points to the 'Flash.ocx' Macromedia ActiveX control.

    To be able to register itself, an ActiveX control needs to implement the DllRegisterServer function. In simple words, this function creates registry entries for all the classes inside the control. We do not need to worry about the DllRegisterServer function we just want to make sure it is there. For the sake of simplicity, we've presumed that the ActiveX control (the *.ocx file) is located in the same folder as where your application is.

    The red line in the above code, does the job of calling the regsvr32 tool by passing the "/s" switch along with the full path to the ActiveX control. The function is ExecAndWait.

    uses shellapi;

    ...

    function ExecAndWait(const ExecuteFile, ParamString : string): boolean;

    var

    SEInfo: TShellExecuteInfo;

    ExitCode: DWORD;

    begin

    FillChar(SEInfo, SizeOf(SEInfo), 0);

    SEInfo.cbSize := SizeOf(TShellExecuteInfo);

    with SEInfo do begin

    fMask := SEE_MASK_NOCLOSEPROCESS;

    Wnd := Application.Handle;

    lpFile := PChar(ExecuteFile);

    lpParameters := PChar(ParamString);

    nShow := SW_HIDE;

    end;

    if ShellExecuteEx(@SEInfo) then

    begin

    repeat

    Application.ProcessMessages;

    GetExitCodeProcess(SEInfo.hProcess, ExitCode);

    until (ExitCode <> STILL_ACTIVE) or Application.Terminated;

    Result:=True;

    end

    else Result:=False;

    end;
    The above, ExecAndWait, function uses ShellExecuteEx API call to execute a file on a system. If you need more examples of executing any file from Delphi, check the Start from Delphi article

  3. #3
    کاربر دائمی
    تاریخ عضویت
    فروردین 1385
    محل زندگی
    آنجا سرای ابدی است
    پست
    2,011
    تو دلفی 7 که به این سختی نیست.

  4. #4
    کاربر دائمی
    تاریخ عضویت
    بهمن 1381
    محل زندگی
    ایران
    پست
    101
    ای آقا !!!!
    مثل اینکه منظور من را متوجه نشدید .
    OCX را میشود توی دلفی 2006 از طریق منوها نصب کرد ولی در بخش پالت کامپوننت ها چیزی به نام اکتیوایکس دیده نمیشود . !! . لطفا راهنمایی کنید ؟ . . .

  5. #5
    کاربر دائمی
    تاریخ عضویت
    فروردین 1385
    محل زندگی
    آنجا سرای ابدی است
    پست
    2,011
    نقل قول نوشته شده توسط b_mohammadpoor مشاهده تاپیک
    ای آقا !!!!
    خوب زیرش می زنه که تو کدوم پالت نصب می شه ! نمی زنه؟

  6. #6
    کاربر دائمی
    تاریخ عضویت
    بهمن 1381
    محل زندگی
    ایران
    پست
    101

    Smile

    نقل قول نوشته شده توسط dkhatibi مشاهده تاپیک
    خوب زیرش می زنه که تو کدوم پالت نصب می شه ! نمی زنه؟
    من که تو Win32 همچین چیزی پیدا نکردم ؟ میشه حداقل یک بار امتحان کنین و اگه ممکنه راهنمایی ....

  7. #7
    کاربر دائمی
    تاریخ عضویت
    فروردین 1385
    محل زندگی
    آنجا سرای ابدی است
    پست
    2,011
    نقل قول نوشته شده توسط b_mohammadpoor مشاهده تاپیک
    من که تو Win32 همچین چیزی پیدا نکردم ؟ میشه حداقل یک بار امتحان کنین و اگه ممکنه راهنمایی ....
    من بر اساس نمایی که دلفی 7 داره گفتم.
    خیلی وقته 2006 رو نصب نمی کنم. فقط دلفی 7

  8. #8
    کاربر دائمی
    تاریخ عضویت
    بهمن 1381
    محل زندگی
    ایران
    پست
    101
    یعنی کسی نیست که منو راهنمایی کنه ؟؟؟ !!!!

  9. #9
    کاربر دائمی
    تاریخ عضویت
    بهمن 1381
    محل زندگی
    ایران
    پست
    101
    واقعا کسی نمیدونه ؟

تاپیک های مشابه

  1. دلفی 2006
    نوشته شده توسط smt1383 در بخش کامپوننت های سایر شرکت ها، و توسعه کامپوننت
    پاسخ: 2
    آخرین پست: سه شنبه 27 شهریور 1386, 20:49 عصر
  2. گزارش گیری در دلفی 2006
    نوشته شده توسط H_T_O_A در بخش کامپوننت های سایر شرکت ها، و توسعه کامپوننت
    پاسخ: 4
    آخرین پست: دوشنبه 29 مرداد 1386, 16:26 عصر
  3. گزارش گیری در دلفی 2006
    نوشته شده توسط H_T_O_A در بخش ابزارهای گزارش سازی در دلفی
    پاسخ: 1
    آخرین پست: شنبه 27 مرداد 1386, 22:23 عصر
  4. نصب Delphi 2006 بدون نصب سایر ابزارهای BDS 2006
    نوشته شده توسط Mohammad_Mnt در بخش برنامه نویسی در Delphi
    پاسخ: 7
    آخرین پست: شنبه 09 دی 1385, 16:42 عصر
  5. سوالی در مورد کامپایل کردن فایل ها در دلفی 2006
    نوشته شده توسط blackbird در بخش برنامه نویسی در Delphi Prism
    پاسخ: 3
    آخرین پست: یک شنبه 23 مهر 1385, 12:29 عصر

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •