www.digitalmars.com         C & C++   DMDScript  

D - How to include Win32 function

reply "Anatoliy Shevelev" <ixbase insyg.kiev.ua> writes:
How to include into progect the Win32 function:

ShowWindow()
MoveWindow()
GetWindowLong()
SetWindowText()
SendMessage()
EnumChildWindows()


Anatoliy Shevelev
http://esk.lgg.ru
Jun 07 2004
parent reply "Walter" <newshound digitalmars.com> writes:
import std.c.windows.windows;

"Anatoliy Shevelev" <ixbase insyg.kiev.ua> wrote in message
news:ca2hp6$11su$1 digitaldaemon.com...
 How to include into progect the Win32 function:

 ShowWindow()
 MoveWindow()
 GetWindowLong()
 SetWindowText()
 SendMessage()
 EnumChildWindows()


 Anatoliy Shevelev
 http://esk.lgg.ru

Jun 07 2004
parent reply "Anatoliy Shevelev" <ixbase insyg.kiev.ua> writes:
I'm use thise command at my project but  not all function work properly

"Walter" <newshound digitalmars.com> wrote in message
news:ca2lfa$17r5$2 digitaldaemon.com...
 import std.c.windows.windows;

 "Anatoliy Shevelev" <ixbase insyg.kiev.ua> wrote in message
 news:ca2hp6$11su$1 digitaldaemon.com...
 How to include into progect the Win32 function:

 ShowWindow()
 MoveWindow()
 GetWindowLong()
 SetWindowText()
 SendMessage()
 EnumChildWindows()


 Anatoliy Shevelev
 http://esk.lgg.ru


Jun 08 2004
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
Anatoliy Shevelev wrote:

 I'm use thise command at my project but  not all function work properly

Well, with no information of what you're trying to do, or what they're doing instead of working, none of us can help you. How about a code sample? Stewart. -- My e-mail is valid but not my primary mailbox, aside from its being the unfortunate victim of intensive mail-bombing at the moment. Please keep replies on the 'group where everyone may benefit.
Jun 09 2004
parent reply "Anatoliy Shevelev" <ixbase insyg.kiev.ua> writes:
I'm understand, if function missing to including it's to the project as

but appear a new problem with function

??          EnumChildWindows(hWnd, myProc, (LPARAM) &rcClient);
error




C:\dmd\samples\d>\dmd\bin\shell ixb.sh
shell 1.00
\dmd\bin\dmd ixbase.d gdi32.lib
ixbase.d(25): function myProc (HANDLE hwndChild,int lParam) does not match
argument types ()

--- errorlevel 1


//----------------------------------------------------

import std.c.windows.windows;
import std.c.stdio;
import std.date;
export
{
 LRESULT SendMessage(HWND ,UINT ,WPARAM , LPARAM );
 BOOL SetWindowTextA(HWND hWnd,LPCSTR lpString);
}
//-----------------------------------------------------------
const int IDC_BTNCLICK = 101;
const int IDC_BTNDONTCLICK = 102;

HWND   hW,ghStatBar,hE,hFRM,hSTA,hCUR;
int    sock,hS=0,nCurEle=0,ixH=16;

extern(Windows)
int WindowProc(HWND hWnd, uint uMsg, WPARAM wParam, LPARAM lParam)
{
    switch (uMsg)
    {
 case WM_SIZE:
        {
          RECT rcClient;
          GetClientRect(hWnd, &rcClient);
??          EnumChildWindows(hWnd, myProc, (LPARAM) &rcClient);
        } break;
 case WM_KEYDOWN:
 {
         char [64] s;

          sprintf(s,"%3d",wParam);
          MaxRow();
         _X_STA("keyDown",s);
 } break;
 default:
  break;
 }
 return DefWindowProcA(hWnd, uMsg, wParam, lParam);
}
//--------------------------------------------------------

bool myProc(HWND hwndChild, LPARAM lParam)
{
    LPRECT rcParent;
    int i, idChild;

//    idChild = GetWindowLong(hwndChild, GWL_ID);
    rcParent = (LPRECT) lParam;

          if (idChild == 101){
//    MoveWindow(hwndChild,30,0,rcParent.right,16,TRUE);
    }else if (idChild == 102){
     i=0;
//     MoveWindow(hwndChild,0,40,rcParent->right,rcParent->bottom-56,TRUE);
    }else if (idChild == 1001){
//     MoveWindow(hwndChild,192,20,rcParent->right-340,16,TRUE);
    }else
        i = 2;
    ShowWindow(hwndChild, 1);
    return TRUE;
}


Anatoliy
Jun 09 2004
parent reply "Carlos Santander B." <carlos8294 msn.com> writes:
"Anatoliy Shevelev" <ixbase insyg.kiev.ua> escribió en el mensaje
news:ca7jdc$689$1 digitaldaemon.com
| I'm understand, if function missing to including it's to the project as
|
| but appear a new problem with function
|
| ??          EnumChildWindows(hWnd, myProc, (LPARAM) &rcClient);
| error
|
|
|
|
| C:\dmd\samples\d>\dmd\bin\shell ixb.sh
| shell 1.00
| \dmd\bin\dmd ixbase.d gdi32.lib
| ixbase.d(25): function myProc (HANDLE hwndChild,int lParam) does not match
| argument types ()
|
| --- errorlevel 1
|
| ...
|

You need an & before myProc:

EnumChildWindows(hWnd, &myProc, (LPARAM) &rcClient);

-----------------------
Carlos Santander Bernal
Jun 09 2004
parent reply "Anatoliy Shevelev" <ixbase insyg.kiev.ua> writes:
Thanks Carlos,
and last version
          EnumChildWindows(hWnd,(WNDENUMPROC) &IxbProc, (LPARAM) &rcClient);

Anatoliy

 EnumChildWindows(hWnd, &myProc, (LPARAM) &rcClient);

 -----------------------
 Carlos Santander Bernal

Jun 10 2004
parent reply "Carlos Santander B." <carlos8294 msn.com> writes:
"Anatoliy Shevelev" <ixbase insyg.kiev.ua> escribió en el mensaje
news:caa0s1$sgn$1 digitaldaemon.com
| Thanks Carlos,
| and last version
|           EnumChildWindows(hWnd,(WNDENUMPROC) &IxbProc, (LPARAM)
&rcClient);
|
| Anatoliy
|

Finally, you'll want to change those C-style casts to D-style.

-----------------------
Carlos Santander Bernal
Jun 10 2004
parent reply "Anatoliy Shevelev" <ixbase insyg.kiev.ua> writes:
I'm will but can't solve the problem with, for example

export void InitCommonControls(void);

error
C:\dmd\samples\d>\dmd\bin\shell ixb.sh
shell 1.00
\dmd\bin\dmd ixbase.d gdi32.lib
C:\dmd\bin\..\src\phobos\std\c\windows\windows.d(1818): cannot have
parameter of type void

--- errorlevel 1

Anatoliy

 Finally, you'll want to change those C-style casts to D-style.

 -----------------------
 Carlos Santander Bernal

Jun 11 2004
parent reply Sean Kelly <sean f4.ca> writes:
In article <cacsa7$22uv$1 digitaldaemon.com>, Anatoliy Shevelev says...
I'm will but can't solve the problem with, for example

export void InitCommonControls(void);

change it to: export void InitCommonControls(); A void parameter is optional in C++ but forbidden in D. Sean Kelly
Jun 11 2004
next sibling parent reply "Matthew" <matthew.hat stlsoft.dot.org> writes:
"Sean Kelly" <sean f4.ca> wrote in message
news:cact6g$2440$1 digitaldaemon.com...
 In article <cacsa7$22uv$1 digitaldaemon.com>, Anatoliy Shevelev says...
I'm will but can't solve the problem with, for example

export void InitCommonControls(void);

change it to: export void InitCommonControls(); A void parameter is optional in C++ but forbidden in D.

You forgot "Is necessary in C, " :)
Jun 11 2004
parent reply Sean Kelly <sean f4.ca> writes:
In article <cae6m3$ug5$1 digitaldaemon.com>, Matthew says...
You forgot "Is necessary in C, "

That requirement is still in place? I was hoping it had been removed in C99 :) Sean
Jun 12 2004
parent "The Dr ... who?" <matthew.hat stlsoft.dot.org> writes:
Interesting point. I have to say I can't imagine that to be the case - too much
back compat - but you never know.

If I was sufficiently motivated I'd boot up Acrobat and have a scour, but I'm
not. Maybe I'll just try it with Comeau and --strict. (But Walter might bite me
for not trusting DMC++!! <G>)

"Sean Kelly" <sean f4.ca> wrote in message
news:caf79o$2je6$1 digitaldaemon.com...
 In article <cae6m3$ug5$1 digitaldaemon.com>, Matthew says...
You forgot "Is necessary in C, "

That requirement is still in place? I was hoping it had been removed in C99 :) Sean

Jun 12 2004
prev sibling parent reply "Anatoliy Shevelev" <ixbase insyg.kiev.ua> writes:
change
 but next error
export void InitCommonControls(void);
to
export void InitCommonControls();
but next error

C:\dmd\bin\..\lib\phobos.lib(dmain2)
 Error 42: Symbol Undefined _InitCommonControls 0
--- errorlevel 1

Anatoliy
Jun 12 2004
parent J C Calvarese <jcc7 cox.net> writes:
Anatoliy Shevelev wrote:
 change
  but next error
 export void InitCommonControls(void);
 to
 export void InitCommonControls();
 but next error
 
 C:\dmd\bin\..\lib\phobos.lib(dmain2)
  Error 42: Symbol Undefined _InitCommonControls 0
 --- errorlevel 1
 
 Anatoliy

You need to add a lib to the compile command on the command line. I think you need to use "comctl32.lib", but I'm not certain. -- Justin (a/k/a jcc7) http://jcc_7.tripod.com/d/
Jun 21 2004