Author Topic: Api Declaration  (Read 9917 times)

0 Members and 1 Guest are viewing this topic.

Peter

  • Guest
Api Declaration
« on: February 18, 2013, 12:08:29 PM »
Deleted
« Last Edit: May 07, 2015, 11:18:09 AM by Peter »

Aurel

  • Guest
Re: Api Declaration
« Reply #1 on: February 24, 2013, 12:56:52 AM »
Yes that is strange...
I am not sure that :
Public Declare Function GetCommandLine Lib "kernel32.dll" Alias "GetCommandLineA" () As String

that this work as espected,because when i run this api function this function return
exe name path without command line recieved ...is this normal  ???
Grrrr i must look into VB examples  >:(

Aurel

  • Guest
Re: Api Declaration
« Reply #2 on: February 24, 2013, 04:52:14 AM »
I know what type is returned and this is not a problem .
Problem is in what content is returned.
In case where there is no command line arguments given,
returned is full file path of exe from where is called GetCommandLine () function.
....so
when you or me send command line with ShellExecute()
recieved is not only sended filepath then first:
"C:\myfolder.myexe.exe" C:\myfolder2\myfile.txt
So there is a catch...
I have found that this recieved final string must be parsed (one VB and one EB example)
explain all .
In this examples is good because chr(34) " is used as marker for extracting needed string(filepath).

by the way i really don't get it what is wrong with latest oxygen.dll because i have constantly
problem with error that rect type is not defined !
But this is not true... >:(
So what i am do then remove latest oxygen.dll and use older which i found in some older examples.
And it is strange this not heapend one times them every time Charles release new release
old api things from includes simply don't work and constantly crush.,.. ::)

Charles Pegge

  • Guest
Re: Api Declaration
« Reply #3 on: February 24, 2013, 07:01:37 AM »
Hi Aurel,

Something mysterious going on here. I am checking awinh.inc (download 10 Feb)

I found that the RGB() function was missing but that is not the main cause of the problem.

Charles

JRS

  • Guest
Re: Api Declaration
« Reply #4 on: February 24, 2013, 09:51:36 AM »
Quote
I am working on a new Sdl library, everything without tricks ...

I was right! SW is a wrapper for SDL. I just started looking at sdlBasic source and how they integrated SDL into the language.

JRS

  • Guest
Re: Api Declaration
« Reply #5 on: February 24, 2013, 10:32:13 AM »
SDL is too much work for me when I have very little interest in this type of programming.

I'm looking forward to future releases of Simple Windows and hopefully it will work outside the O2 environment.


Aurel

  • Guest
Re: Api Declaration
« Reply #6 on: February 24, 2013, 01:31:02 PM »
Quote
Hi Aurel,

Something mysterious going on here. I am checking awinh.inc (download 10 Feb)

I found that the RGB() function was missing but that is not the main cause of the problem.

Charles

Hi Charles...
Yes it is really something mysterious.
I see some weird problems with global strings when they used inside subs...just
crush app in the second.

JRS

  • Guest
Re: Api Declaration
« Reply #7 on: February 24, 2013, 02:41:06 PM »
DLL bstr arguments.



Aurel

  • Guest
Re: Api Declaration
« Reply #8 on: February 24, 2013, 02:59:05 PM »
No it's you ;D

Aurel

  • Guest
Re: Api Declaration
« Reply #9 on: February 24, 2013, 03:08:25 PM »
Here is the latest awinh.inc
which work with older oxygen.dll for me.
Charles maybe you can compare them with new and see what is wrong.

X

Aurel

  • Guest
Re: Api Declaration
« Reply #10 on: February 24, 2013, 03:13:55 PM »
And here is part of code inside exe who respond on GetCommandLine()

'in global scope...
Code: [Select]
string fileName=""
fileName = GetCommandLine()
print fileName
LoadFromFile()

'then subroutine...
Code: [Select]
SUB LoadFromFile
string source="",fPath=""
INT qpos,sf
qpos=instr(1,filename,chr(34))
qpos=instr(qpos+1,filename,chr(34))

fPath = Mid(filename,(qpos+1),255)
SendMessage edit1,WM_SETTEXT,0,strptr(fpath)
fPath=Trim(fPath)

IF fPath = ""
   MsgBox fPath, "File NOT Found"
   RETURN
END IF
source =  GetFile fPath

SendMessage richedit1,WM_SETTEXT,0,strptr(source)

END SUB

And i found that string function Mid( in$,start,LEN(in$))
cose crush because LEN(in$) is somehow broken. ???

Charles Pegge

  • Guest
Re: Api Declaration
« Reply #11 on: February 24, 2013, 11:47:09 PM »
Hi Aurel,

Awinh is a mosaic of different coding styles, which is good for stress-testing oxygen :)

I found a sensitivity to variable names with _leading underscores, which I have now fixed.

Also the location of #lookahead needs to change. It should be located below equates and types. Preferably just before you functions and subs. I hope to make #lookahead more robust in future releases

#lookahead scans below, for subs and functions then generates declare statements, which may rely on type definitions defined previously.

See if this fixes the len() problem

Charles



X
« Last Edit: February 26, 2013, 10:51:56 AM by Charles Pegge »

Charles Pegge

  • Guest
Re: Api Declaration
« Reply #12 on: February 24, 2013, 11:59:20 PM »
Hi John,

I have now added Ascii/Wide String conversion to DLLC. You will also need the dreaded GUIDs for COM, and things like GDI+ image codecs, so I have added that as well.

Not quit sure how to handle COM calls yet. Without OOP infrastructure, they can be very nasty.

Charles.

PS: A diet of bstrings is not suitable for a skeleton. I recommend a large bowl of porridge for breakfast every day :)

JRS

  • Guest
Re: Api Declaration
« Reply #13 on: February 25, 2013, 12:44:03 AM »
WOW!

That really sounds awesome Charles.

Does DLLC stop the leaking with bstr's in SokoMouse? All that should be needed to test it is swap out the DYC calls in the SB version of sw.inc. The main program (SM.sbx) shouldn't have to be touched.

Quote
Not quit sure how to handle COM calls yet. Without OOP infrastructure, they can be very nasty.

Jose Roca has been doing COM/OLE Automation for years. (even before Zale changed his mind and stopped saying COM was bloatware) Can't we use Jose's direct calling method without the OOP style .dot. notation?

« Last Edit: February 25, 2013, 12:52:48 AM by JRS »

Charles Pegge

  • Guest
Re: Api Declaration
« Reply #14 on: February 25, 2013, 01:29:14 AM »
We can live without dot notation but the problem is how to reference all the calls available, without huge headers. Some COM interfaces  have dozens of the blighters.