Announcement

Collapse
No announcement yet.

Winmain with DDT

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Guest's Avatar
    Guest replied
    .....Hmmmmmmmmm!!!!!! Learn something new everyday.

    Adam

    ------------------

    Leave a comment:


  • Guest's Avatar
    Guest replied
    Code:
    Function ghInst() as Long
     Function = GetModuleHandle("")
    end function
    ------------------
    Kev G Peel
    KGP Software
    Bridgwater, UK.
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Guest's Avatar
    Guest replied
    I looked in the win32api.inc and found Gethinst() and it seems to work for me in my pbmain.

    ghInst = Gethinst()

    I use it; for example, to set the icon for my main dialog:

    dialog send hDlg,%WM_SETICON,%ICON_BIG,LoadIcon(ghInst, "PROGRAM")

    ...and it seems to do exactly what I want.
    Give it a "whirl" and see what it does for ya'.

    See ya',
    Adam


    ------------------

    Leave a comment:


  • Lance Edmonds
    replied
    PBMAIN functions in the same manner as WINMAIN() does.

    PBMAIN is just a "shortened" format that does not accept parameters. In truth, the actual EXE code always contains a "winmain" but the compiler handles the details for us in the actual EXE code it generates.

    Therefore, from a technical point of view, unless you specifically need the parameters passed to your app via WINMAIN, you can use PBMAIN instead, but either way produces the same result.

    I hope I made this clearer rather than more convoluted

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Jim Huguley
    replied
    Anand...

    You may use PBMAIN and retrieve the hInstance using
    Code:
    hInstance = GetWindowLong ( HDialog, %GWL_HINSTANCE )

    ------------------
    Jim..
    [email protected]

    Leave a comment:


  • Anand Kumar
    started a topic Winmain with DDT

    Winmain with DDT

    Dear Lance and Dave,

    Is it correct to program this way using winmain
    DefLng L, H
    %TextBox = 101
    Function Winmain (....) Export as Long

    Dialog New 0, "Win Main", , , 100, 100, %WS_SYSMENU TO HDialog
    Control Add TextBox, HDialog, %TextBox, "", 10, 10,
    Dialog Show Modal HDialog, Call CallBackProc to LResult

    End Function

    CallBack Function CallBackProc()

    End Function

    or should I use only API calls in winmain. I am using API calls which require hInstance and PBMAIN is not able to get the hInstance.


    -------------
    Anand Kumar
Working...
X