Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. I need use a file DLL

I need use a file DLL

Scheduled Pinned Locked Moved C / C++ / MFC
c++delphi
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Thangnc
    wrote on last edited by
    #1

    I creat a file DLL by MFC use VisualBasic. But Input and Ouput don't compatible: // C++ extern "C" void PASCAL EXPORT CCreatFile(char lptFileName[20],char lptPath[200]) { FILE *ptrFile; char lptstr[250]; strcpy(lptstr,lptPath); strcat(lptstr,lptFileName); strcat(lptstr,".ads"); if(lptstr ==NULL) { MessageBox(NULL," File NULL!!!","Adsoft !",MB_ICONWARNING|MB_OK); return; } ptrFile=fopen(lptstr,"wb"); if(ptrFile ==NULL) { MessageBox(NULL,"Can't creat File !","Adsoft warning !",MB_ICONWARNING|MB_OK); return; } fclose(ptrFile); } // VB Private Declare Sub CCreatFile Lib "AdsoftDLL.dll" (TenB1 As String, Tenb2 As String) Private Sub Form_Load() Dim fileName As String Dim PathName As String fileName = "KimDo" PathName = "C:\\" Call CCreatFile(fileName, PathName) End Sub result erroneous

    C 1 Reply Last reply
    0
    • T Thangnc

      I creat a file DLL by MFC use VisualBasic. But Input and Ouput don't compatible: // C++ extern "C" void PASCAL EXPORT CCreatFile(char lptFileName[20],char lptPath[200]) { FILE *ptrFile; char lptstr[250]; strcpy(lptstr,lptPath); strcat(lptstr,lptFileName); strcat(lptstr,".ads"); if(lptstr ==NULL) { MessageBox(NULL," File NULL!!!","Adsoft !",MB_ICONWARNING|MB_OK); return; } ptrFile=fopen(lptstr,"wb"); if(ptrFile ==NULL) { MessageBox(NULL,"Can't creat File !","Adsoft warning !",MB_ICONWARNING|MB_OK); return; } fclose(ptrFile); } // VB Private Declare Sub CCreatFile Lib "AdsoftDLL.dll" (TenB1 As String, Tenb2 As String) Private Sub Form_Load() Dim fileName As String Dim PathName As String fileName = "KimDo" PathName = "C:\\" Call CCreatFile(fileName, PathName) End Sub result erroneous

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      If I remember correctly, the parameters of the VB function (so the prototype) must use strings by val: Private Declare Sub CCreatFile Lib "AdsoftDLL.dll" (ByVal TenB1 As String, ByVal Tenb2 As String) Also, I'm not sure if that will work: Thangnc wrote: extern "C" void PASCAL EXPORT CCreatFile(char lptFileName[20],char lptPath[200]) I think you will need to change it to that: extern "C" void PASCAL EXPORT CCreatFile(char* lptFileName,char* lptPath) But for that point, I'm not sure at all. Hope this helps. If not, try to give more details about the errors (crash, error messages, ...)

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups