473,785 Members | 2,327 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to call Win32 API functions ?

Hello

I would like to use php-cli as a sort of shell scripting language or
generic scripting language.

I have php 5.2 on WindowsXP and I would like to call Win32 API functions
like GetShortPathNam e.

How do I call API functions in PHP ? The documentation says there is an
extension called w32api, but if you read its documentation you find a
note stating the extension is now in PECL, and after browsing PECL you
find the extension is not there !

Apparently w32api used to work in PHP 4 but has not been ported to PHP5.

So how does one call API functions ? Nobody needs that ?

Can someone at least remove the w32api documentation from the php 5
manual ? Or keep only a note instead saying the extension has not been
ported ?

Thank you,
Timothy Madden,
Romania.
Jun 2 '08 #1
7 4192
NC
On May 18, 2:38 am, Timothy Madden <terminato...@g mail.comwrote:
>
So how does one call API functions ?
By writing custom PHP extensions in C/C++. In your particular case,
you will need to write an extension that would wrap around
kernel32.dll and expose its functions to PHP.

Alternatively, you can add PHP support to .Net and write your PHP
scripts in Visual Studio making use of everything available to a .Net
developer:

http://www.php-compiler.net/
Nobody needs that ?
Personally, I can't remember ever needing this. The built-in file
system functions have been adequate.
Can someone at least remove the w32api documentation from the php 5
manual ?
There is no such thing as "the PHP 5 manual". The PHP manual is not
version-specific and covers everything from the now-antiquated PHP 3
to the now-in-development PHP 6.

Cheers,
NC
Jun 2 '08 #2
NC wrote:
On May 18, 2:38 am, Timothy Madden <terminato...@g mail.comwrote:
>So how does one call API functions ?

By writing custom PHP extensions in C/C++.
[...]
Alternatively, you can add PHP support to .Net
[...]
>Nobody needs that ?

Personally, I can't remember ever needing this. The built-in file
system functions have been adequate.
>Can someone at least remove the w32api documentation from the php 5
manual ?

There is no such thing as "the PHP 5 manual". The PHP manual is not
version-specific and covers everything from the now-antiquated PHP 3
to the now-in-development PHP 6.
[...]

I do not want Microsoft, so I do not want .Net. As far as I know you
have to pay for it, while php is free.

It is easier to write the script I need, the one that uses
GetShortPathNam e, in C++ than to write a php extension.

I would like to know if there is anybody else who needed to call some
Win32 API function from php, maybe from php-cli.

Thank you
Timothy Madden,
Romania
Jun 2 '08 #3
Timothy Madden wrote:
NC wrote:
>On May 18, 2:38 am, Timothy Madden <terminato...@g mail.comwrote:
>>So how does one call API functions ?

By writing custom PHP extensions in C/C++.
[...]
>Alternativel y, you can add PHP support to .Net
[...]
>>Nobody needs that ?

Personally, I can't remember ever needing this. The built-in file
system functions have been adequate.
>>Can someone at least remove the w32api documentation from the php 5
manual ?

There is no such thing as "the PHP 5 manual". The PHP manual is not
version-specific and covers everything from the now-antiquated PHP 3
to the now-in-development PHP 6.
[...]

I do not want Microsoft, so I do not want .Net. As far as I know you
have to pay for it, while php is free.
I believe you can download the SDK for free.
It is easier to write the script I need, the one that uses
GetShortPathNam e, in C++ than to write a php extension.

I would like to know if there is anybody else who needed to call some
Win32 API function from php, maybe from php-cli.
If you really need that function, you could always call your program
within the php script:

<?php
$shortPath = exec('myproggy ' . escapeshellarg( $longPath));
?>

Curtis
Jun 2 '08 #4
Timothy Madden <te**********@g mail.comwrote:
>
I do not want Microsoft, so I do not want .Net.
What are you talking about? You said you were looking for the Win32 API.
Who do think created that? Apple?
>As far as I know you have to pay for it, while php is free.
The .NET runtime is a free download. In fact, it's probably one of the
options waiting for you in Windows Update, if you don't already have it.
And you can fetch a Visual Studio 2008 C# compiler for free as well.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jun 2 '08 #5
On 20 Mai, 07:06, Tim Roberts <t...@probo.com wrote:
Timothy Madden <terminato...@g mail.comwrote:
I do not want Microsoft, so I do not want .Net.

What are you talking about? You said you were looking for the Win32 API.
Who do think created that? Apple?
As far as I know you have to pay for it, while php is free.

The .NET runtime is a free download. In fact, it's probably one of the
options waiting for you in Windows Update, if you don't already have it.
And you can fetch a Visual Studio 2008 C# compiler for free as well.
--
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.
Well if you have their C++ compiler they will not give you the C#
compiler
or something like that, and the license limits you to evaluation use
only.

Anyway I found WinBinder and with it I could call GetShortPathNam e.
Timothy Madden,
Romania
Jun 2 '08 #6
Timothy Madden <te**********@g mail.comwrote:
>On 20 Mai, 07:06, Tim Roberts <t...@probo.com wrote:
>Timothy Madden <terminato...@g mail.comwrote:
>I do not want Microsoft, so I do not want .Net.

What are you talking about? You said you were looking for the Win32 API.
Who do think created that? Apple?
>As far as I know you have to pay for it, while php is free.

The .NET runtime is a free download. In fact, it's probably one of the
options waiting for you in Windows Update, if you don't already have it.
And you can fetch a Visual Studio 2008 C# compiler for free as well.

Well if you have their C++ compiler they will not give you the C#
compiler or something like that,
Complete and utter nonsense.
>and the license limits you to evaluation use only.
Also utter nonsense. The Express Edition doesn't include all of the extras
from the paid editions, but there are no additional restrictions on what
you can do with it.

There's plenty to dislike about Microsoft, but please take the time to find
out the truth before spreading rumors.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jun 2 '08 #7
Greetings, Timothy Madden.
In reply to Your message dated Tuesday, May 20, 2008, 11:58:28,
Well if you have their C++ compiler they will not give you the C#
compiler or something like that, and the license limits you to evaluation
use only.
I see it as a clear case of "RTFM or STFU"...
Really, why guess if you can just read?
They even released Visual Studio Express IDE for free.
Not just compiler. (Commandline compiler were *free* for ages)
Anyway I found WinBinder and with it I could call GetShortPathNam e.
Yes, that's what I was about to suggest. Glad you've discovered it first.
--
Sincerely Yours, AnrDaemon <an*******@free mail.ru>

Jun 27 '08 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2858
by: ZhangZQ | last post by:
Is it possible to dynamicaly to local and call a function in Win32 dll(not a ..net assembly dll) in C# at run time, for example, a C# program popup a dialogbox to let use input which Win32 dll to be loaded, which function to be called, and what are the parameters to call the function. Thank you very much!
5
2217
by: Bryan Parkoff | last post by:
Please provide me the information when it is not in the correct newsgroups. I have been using C and C++ language for a long time when it is time for me to learn Win32 API functions that they can be written in C and C++ language. Please give me an advice where I should post to discuss this topic to the correct newsgroups. Also, where can I obtain the best textbook to learn and understand how Win32 API functions work in C / C++ language. ...
0
2132
by: Veli-Pekka Tätilä | last post by:
Hi, My first post here. I've found some serious accessibility flaws in the Python 2.4 docs and wish they could be rectified over time. I'm very new to Python and initially contacted docs at python org, However, I haven't gotten a reply for a week or so, and figured out I could post here for a larger audience, then. Original message follows: Hello,
7
5906
by: Tim ffitch | last post by:
Hi I have created a VB dll file that contains common functions I use across various projects in VB, Access and Excel. Rather than have to code the functions in each I decided to use the dll route. The problem being that I can't call these functions from the query designer in Access. I decided that I would try the route of declaring the functions from the dll file the same way you would for the Windows API. Access then complains that...
6
1656
by: Mark Jerde | last post by:
I need to call a Win32 DLL. The API supports both Windows and Linux, but I'm only concerned with Windows. I'd like advice whether I can use C# or whether I'll have to dust off my old C++ books. I would prefer to learn C# rather than go back to C++. The API starts with #ifdef (WIN32) #define MyAPI __stdcall #else
5
6543
by: Kurt Van Campenhout | last post by:
Hi, I am trying to get/set Terminal server information in the active directory on a windows 2000 domain. Since the ADSI calls for TS don't work until W2K3, I need to do it myself. I'm fairly new to VB.NET, so I need some help. Here is a code snippit :
28
1953
by: Peter Olcott | last post by:
I want to double check my understanding about how the .NET framework works. From what I understand every call to the .NET framework is ultimately translated into one of more API calls, is this correct?
12
5798
by: leaf | last post by:
Hi, How to call function at runtime, based on a struct that contains the information for the function call: struct func_to_call { int function_id; // function id to call unsigned int nparams; // number of parameters unsigned long* parameter; // the parameter(s) to pass }
9
7010
by: Allen | last post by:
The arguments of function is variable. Given function address, argument type and data, how to dynamically call the function? The following is pseudo code. int count = 0; int offset = 0; char buffer; count = getcount(buffer, offset); void* pfun = getmethod(buffer, offset);
0
9491
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10357
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10104
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.