Simple Win32 API call attempt

About Monkey 2 Forums Monkey 2 Programming Help Simple Win32 API call attempt

This topic contains 4 replies, has 2 voices, and was last updated by  DruggedBunny 1 year, 3 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #7997

    DruggedBunny
    Participant

    Hi all,

    Just having a little play with mx2, was hoping to get a really simple Win32 API call working, but it’s falling down somewhere… but I don’t know if I’m approaching it correctly…

    This fails with:

    After much playing about, I think it’s picking everything up, as in the import seems to be working (various alternatives gave import errors before), the Extern appears OK to me, assuming my Ints translate to the native parameters — which looks to be happening based on “MessageBoxA(0,bbCString(bbString(L”Test”,4)),bbCString(bbString(L”Test”,4)),bbInt(0));”.

    The error seems to suggest that Main can’t see MessageBoxA, which I don’t really understand.

    Can’t find any search results that cover this particular use of Extern…

    Not sure if this is a bug, or if I’m just missing something important/doing something stupid?

    #8007

    Mark Sibly
    Keymaster

    Close…you’re just missing  #Import “<windows.h>”, ie:

    #8018

    DruggedBunny
    Participant

    Ah, interesting! Thanks, Mark!

    #12719

    DruggedBunny
    Participant

    This no longer builds here (your code), gving a load of output I don’t really understand! Just ran into it while trying to do something else (around 6 hours trying to debug Ted2Go debugger crashes!)…

    I’m on latest dev, though last one fails too.

    #12732

    DruggedBunny
    Participant

    Got this working using Diffrenzy’s HWND hack here.

    I did try Aliasing it as Void Ptr, which I thought would work, as HWND is a HANDLE, which is a void pointer according to Windows Data Types

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.