LibFunc and Windows API

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Aleu
Newbie
Posts: 8
Joined: Mon Aug 20, 2007 2:51 am

LibFunc and Windows API

Post by Aleu » Fri Sep 07, 2007 1:24 am

First I'd like to thank mtettmar for the helpful reply. It's some strange I can't reply to my last post, so I open a new.

LibFunc is really useful! I wonder whether MS can call all the Windows API functions?

I tried another api to paste one bmp file on another:
LibFunc>gdi32.dll,BitBlt,r,c:\1.bmp,x,y,320,240,c:\2.bmp,0,0,SRCCOPY

Here's the function definition:
BOOL BitBlt (HDC hdcDest,int nXDest,int nYDest,int nWidth,int nHeight,HDC hdcSrc,int nXSrc,int nYSrc,DWORD dwRop)

What am I wrong?

p.s. MS seems not so powerful dealing with pictures. ImageMagick is. Is it possible for MS to use ImageMagick function?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Re: LibFunc and Windows API

Post by Me_again » Fri Sep 07, 2007 1:47 am

Aleu wrote:p.s. MS seems not so powerful dealing with pictures. ImageMagick is. Is it possible for MS to use ImageMagick function?
Yes, MacroScheduler + ImageMagick is a great combination, I use it a lot.

I think I have posted some examples on this forum, one is in this thread.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Sep 07, 2007 7:08 am

I tried another api to paste one bmp file on another:
LibFunc>gdi32.dll,BitBlt,r,c:\1.bmp,x,y,320,240,c:\2.bmp,0,0,SRCCOPY

Here's the function definition:
BOOL BitBlt (HDC hdcDest,int nXDest,int nYDest,int nWidth,int nHeight,HDC hdcSrc,int nXSrc,int nYSrc,DWORD dwRop)

What am I wrong?
That function is saying it wants a handle to a device context (HDC) for the destination and the source. But you are specifying a filename.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Aleu
Newbie
Posts: 8
Joined: Mon Aug 20, 2007 2:51 am

Handle

Post by Aleu » Wed Sep 12, 2007 4:03 am

Ok, to get a file's handle:

LibFunc>kernel32.dll,CreateFile,FileHandle,C:\1.bmp,GENERIC_WRITE,NULL,NULL,OPEN_EXISTING,FILE_FLAG_OVERLAPPED,NULL
Message>FileHandle

Again it didn't work! It said the dll can't be loaded. How the hell can I get the file's handle?

p.s. I agree ImageMagick is wonderful. XP also has powerful API function for pictures, but quite complicated. If you don't want to rely on the third-party software, use these funtions.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Wed Sep 12, 2007 6:39 am

1. The function alias is CreateFileA - there's no such export as CreateFile
2. Have you declared the values for GENERIC_WRITE, NULL, OPEN_EXISTING and FILE_FLAG_OVERLAPPED - these are not Macro Scheduler variables and you don't appear to have given them any values in your script so these are just literal strings and will cause the function to crash.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts