Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 7 of 7
  1. #1
    Join Date
    May 2006
    Posts
    5,380

    Weird Problem With PB DLL Calls

    i having a nightmare here,

    trying to make (yet another) dll and im having this strange error passing strings to the dll file,

    it seems that if i pass any more than 1 string to the dll it just gets lost, PB dosent seem to be reading it, iv gone through the PB forums and couldent find anything so i thought i would ask here.

    i made this quick demo to test there was nothing in my dll causing a problem

    Code:
    ProcedureDLL.s DatePickerDialog(Date$, WinTitle$, BannerText$, DateType, MonthType, DayType, hWnd)
    
      #EOL=Chr(10)+Chr(13)
      test$="WinTitle: "+ WinTitle$ +#EOL 
      test$+"SelDate: "+ Date$ +#EOL
      test$+"BannerText: "+ BannerText$ +#EOL
      test$+"DateType: "+Str(DateType)+#EOL
      test$+"MonthType: "+Str(MonthType)+#EOL
      test$+"DayType: "+Str(DayType)+#EOL
      test$+"hWnd: "+Str(hWnd)+#EOL
    
    
      MessageRequester("Recived Args",test$,0)
      
    EndProcedure

    and called it from AMS with
    Code:
    --Test
    WinTitle="Date Picker Test"
    SelDate="qwerty"
    BannerText="Bannet Text Test"
    DateType=1
    MonthType=1
    DayType=1
    hWnd=Application.GetWndHandle()
     
    Args="\""..WinTitle.."\", \""..SelDate.."\", \""..BannerText.."\", "..DateType..", "..MonthType..", "..DayType..", "..hWnd
    
    Dialog.Message("Sent Args", Args);
    
    result = DLL.CallFunction("AutoPlay\\Docs\\TEST.dll", "DatePickerDialog", Args, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL);
    
    Dialog.Message("Notice", result);
    only the 1st string gets passed, the 2nd and 3rd just seem to get lost, and the intergers also get passed (after the lost strings)

    has anyone else encountered this ?

    could someone please run the above code and tell me it works so i can take a hammer to this pc and have a excuse to get a new one for me BDay
    Open your eyes to Narcissism, Don't let her destroy your life!!

  2. #2
    Join Date
    May 2006
    Posts
    5,380
    well i kinda got round my problem by passing 1 single string and useing StringField to split it

    but this is not right, iv made dll's that accecpet 6 or 7 strings and they worked fine, why is this doing this now, virus, trojan, im starting to wonder, its got me beat
    Open your eyes to Narcissism, Don't let her destroy your life!!

  3. #3
    Join Date
    Dec 2007
    Location
    Missouri, United States
    Posts
    476
    Rizla,
    I ran into this problem as well when I made RegXmATCH. I also needed to pass 2 strings and 1 long to the dll. Here's how I got around it.

    Granted this is a global function from one of my projects but you should understand it, your far better wit ams then i. The variables and code that have to do with the dll are in red. [Notice how i had to escape the crap outta the string vars lol]

    Code:
    function GetFiles()
    sFile = File.Find(Shell.GetFolder(SHF_MYDOCUMENTS), "*.*", false, false, ShowSearchProgress, nil);
    	if sFile then
    		for i,v in sFile do
    		tbSplit = String.SplitPath(v);
    		name = tbSplit.Filename
    		ext = tbSplit.Extension
    			tblNodeData = {};
    			tblNodeData.Text = name..""..ext;
    			tblNodeData.Data = v;
    			text = "\""..ext.."\""
    			regex = "\"(.r\\d|.R\\d)(\\d)\""
    			match = 1
                params = text..","..regex..","..match
                regchk = DLL.CallFunction("AutoPlay\\Docs\\RegXmATCH.dll", "RegMatch", params, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL);
                if regchk == "1" then
                  tblNodeData.ImageIndex = 29
                end
                     Tree.InsertNode("Tree1", "0", tblNodeData);
    		end
    	end
    end

  4. #4
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    This is the way I set mine up. Define the parameters with the .s, .l, .d , etc... and then define your variables within the procedure too.

    Code:
    ProcedureDLL.s DatePickerDialog(date.s, WinTitle.s, BannerText.s, DateType.l, MonthType.l, DayType.l, hwnd.l)
      
      #EOL = Chr(10) + Chr(13)
      test.s = "WinTitle: " + WinTitle + #EOL 
      test = test + "SelDate: " + date +#EOL
      test = test + "BannerText: " + BannerText +#EOL
      test = test + "DateType: " + Str(DateType)+#EOL
      test = test + "MonthType: " + Str(MonthType)+#EOL
      test = test +"DayType: " + Str(DayType)+#EOL
      test=  test + "hWnd: " + Str(hwnd) + #EOL
      
      
      MessageRequester("Received Args",test,0)
      
    EndProcedure

  5. #5
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    I do it Worm's way, save for the #EOL (nice!)
    Intrigued

  6. #6
    Join Date
    May 2006
    Posts
    5,380
    ah, i discoverd what is causeing this!!!

    im making some more dll's for AMS and im passing strings to the dll, once again only the 1st string sent was being reviced by the dll but all numbers are ok

    spot the differance

    This one works fine
    Code:
    local Title="My Title"
    local Message="My Message"
    local Default=Shell.GetFolder(SHF_PROGRAMFILES).."\\";
    local X=-1
    local Y=-1
    local BackCol=0
    local FrontCol=255
    local args = "\""..Title.."\",\""..Message.."\",\""..Default.."\","..X..","..Y..","..BackCol..","..FrontCol..","..Application.GetWndHandle()
    result = DLL.CallFunction("AutoPlay\\Docs\\DialogEX.dll", "Open_FolderDlg", args, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL);
    this one the strings get lost
    Code:
    local Title="My Title"
    local Message="My Message"
    local Default=Shell.GetFolder(SHF_PROGRAMFILES).."\\";
    local X=-1
    local Y=-1
    local BackCol=0
    local FrontCol=255
    local args = "\""..Title.."\", \""..Message.."\", \""..Default.."\", "..X..","..Y..", "..BackCol..", "..FrontCol..", "..Application.GetWndHandle()
    result = DLL.CallFunction("AutoPlay\\Docs\\DialogEX.dll", "Open_FolderDlg", args, DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL);
    it seems adding a space between the string arguments was causeing PB not to read them, remove the space and it all works fine

    strange huh!!
    Open your eyes to Narcissism, Don't let her destroy your life!!

  7. #7
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Interesting find...
    Intrigued

Similar Threads

  1. VB Net DLL Problem
    By Buffman in forum AutoPlay Media Studio 6.0
    Replies: 8
    Last Post: 10-04-2006, 08:27 AM
  2. dll function problem (please)
    By gustavoAUDACES in forum Setup Factory 7.0
    Replies: 10
    Last Post: 05-04-2006, 08:18 AM
  3. Register ActiveX Dll problem
    By GregSS in forum Setup Factory 7.0
    Replies: 2
    Last Post: 06-07-2005, 10:42 AM
  4. Calling DLL problem
    By Willis in forum AutoPlay Media Studio 5.0
    Replies: 0
    Last Post: 05-11-2004, 03:57 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts