RE: [OT] - Help with routine name in .dll

new topic     » goto parent     » topic index » view thread      » older message » newer message

Matt,

Appreciate the help!  I've included the full implementation of this 
function:

global atom xcwbUN_DisplayCommandPrompter
    xcwbUN_DisplayCommandPrompter = define_c_func(cwbunapi, 
"_cwbUN_DisplayCommandPrompter@20",
                    {C_ULONG, C_ULONG, C_POINTER, C_POINTER, C_POINTER}, 
C_ULONG)
global function cwbUN_DisplayCommandPrompter(atom system_handle, atom 
prompt,
                                            sequence command)
    atom xcommand, xdate_format, date_format, xbatch, batch
    xcommand = allocate(32000)
    mem_set(xcommand, ' ', 32000)
    poke(xcommand, command)
    poke(xcommand + length(command), #00)
    xdate_format = allocate(4)
    poke(xdate_format, 0)
    date_format = 0
    xbatch = allocate(4)
    poke(xbatch, 0)
    batch = 0
    cwbUN_EURtnCode = c_func(xcwbUN_DisplayCommandPrompter,
                                {system_handle, prompt, xcommand,
                                xdate_format, xbatch})
    if cwbUN_EURtnCode = CWB_OK then
        command = peek_string(xcommand)
        date_format = peek4u(xdate_format)
        batch = peek4u(xbatch)
    end if
    free(xcommand)
    free(xdate_format)
    free(xbatch)

    return {cwbUN_EURtnCode, command, date_format, batch}

end function

and is called as:

        command = "crtrpgpgm pgm(jtemple/test)"
        rtn_seq = cwbUN_DisplayCommandPrompter(system_handle, 
CWBUN_PROMPT_INTERACTIVE, command)

The window appears and everything in the window works *until* I attempt 
to close the window, either by clicking Okay, Cancel or the system close 
box.  I think the window is written in Java, though.  

Does the WINAPI in the C declaration have anything to do with the 
problem?

Thanks again!

Jonas
Matt Lewis wrote:
> > Now a follow-up question.  I'm getting the command prompter 
> > as expected but when I close the dialog I'm getting a
> > machine error on the function call.  Is there anything in
> > the following C declaration that might cause this?
> > 
> > --CWBAPI unsigned int WINAPI cwbUN_DisplayCommandPrompter(
> > --				cwbCO_SysHandle systemHandle,
> > --				UINT promptFlags,
> > --				LPSTR commandString,
> > --				UINT * dateFormat,
> > --				BOOL * batchCommand);
> 
> My guess would be a pad parameter.  Not sure what a cwbCO_SysHandle is, 
> but
> commandString, dateFormat and batchCommand are all pointers.  Did you 
> pass a
> value instead of a pointer for dateFormat or batchCommand?  Or, perhaps 
> some
> initialization didn't take place before calling 
> cwbUN_DisplayCommandPrompter
> (like in the creation of systemHandle?).
> 
> Matt Lewis
>

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu