www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - using windows api functions

reply lee <llee goucher.edu> writes:
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
next sibling parent "Stewart Gordon" <smjg_1998 yahoo.com> writes:
"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 01 2007
prev sibling parent reply yidabu <yidabu.nospam gmail.com> writes:
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
parent "Stewart Gordon" <smjg_1998 yahoo.com> writes:
"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.
May 02 2007