Thread overview
using windows api functions
May 01, 2007
lee
May 01, 2007
Stewart Gordon
May 02, 2007
yidabu
May 02, 2007
Stewart Gordon
May 01, 2007
I'm trying to call the OpenProcess() api function. I included std.c.windows.windows at the beginning of the file, but the compiler still does not recognize the function name. The function is defined in kernel32.dll . what am I doing wrong?
May 01, 2007
"lee" <llee@goucher.edu> wrote in message news:f17plf$26na$1@digitalmars.com...
> I'm trying to call the OpenProcess() api function.  I included
> std.c.windows.windows at the beginning of the file, but the
> compiler still does not recognize the function name.  The function
> is defined in kernel32.dll .  what am I doing wrong?

Using std.c.windows.windows.

The translation there is hopelessly incomplete, or at least was last time I looked.  A much more comprehensive translation is here:

http://www.prowiki.org/wiki4d/wiki.cgi?WindowsAPI

Stewart. 

May 02, 2007
lee Wrote:

> I'm trying to call the OpenProcess() api function. I included std.c.windows.windows at the beginning of the file, but the compiler still does not recognize the function name. The function is defined in kernel32.dll . what am I doing wrong?

you can call any window api like this:
import std.c.windows.windows;	//for WinExec
import std.windows.charset;	//for toMBSz

void main()
{
	// bbs.yidabu.com ×¢toMBSzº¯ÊýÊÇΪÁËÉú³Énull½áβ×Ö·û´®
	LPCSTR lpCmdLine = toMBSz(r"C:\Program Files\Internet Explorer\iexplore.exe http://bbs.yidabu.com/forum-10-1.html");
	UINT uCmdShow = SW_SHOWMAXIMIZED;
	WinExec(lpCmdLine,uCmdShow);
}

// bbs.yidabu.com ÏÂÃæ¾ÍÊǶ¨ÒåÒªµ÷ÓõÄwindows apiº¯Êý
extern (Windows)
{
	export {
		UINT WinExec(LPCSTR lpCmdLine,UINT uCmdShow);
	}
}

May 02, 2007
"yidabu" <yidabu.nospam@gmail.com> wrote in message news:f19qlq$27gh$1@digitalmars.com...
<snip>
> you can call any window api like this:
> import std.c.windows.windows; //for WinExec
> import std.windows.charset; //for toMBSz

Where do you get that idea from?  Firstly, only a tiny subset of Windows API functions are in std.c.windows.windows.  Secondly, the functions in std.windows.charset aren't part of the Windows API at all.

> void main()
> {
> // bbs.yidabu.com ×¢toMBSzº¯ÊýÊÇΪÁËÉú³Énull½áβ×Ö·û´®

Oh dear.  It would appear that the web interface is no good at letting you use non-ASCII characters.  At the moment I can't figure out what character encoding that was _meant_ to be!

Stewart.