Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / WinAPI - Loading icon and placing it on button

Author
Message
dj chainz
20
Years of Service
User Offline
Joined: 25th Sep 2004
Location: England
Posted: 11th Jul 2005 01:04 Edited at: 11th Jul 2005 04:30
Using WinAPI:
I have my 32x32 button working, and I believe I know how to place the icon on the button. I have nearly got an icon to load through the windows API... but it doesnt except my null-terminated string! It keeps telling me the file is not found...

sorry 'bout messy code but it will neatified when it works!


I am the lead programmer at red spark studios
http://www.redsparkstudios.co.uk
Three Score
20
Years of Service
User Offline
Joined: 18th Jun 2004
Location: behind you
Posted: 11th Jul 2005 01:46
Quote: "sorry 'bout messy code but it will neatified when it works!"

what if u made a silly mistake that u cant see because of messy code

n00bs will be shot on spot...
It only gets more logical from here(sigh)
dj chainz
20
Years of Service
User Offline
Joined: 25th Sep 2004
Location: England
Posted: 11th Jul 2005 04:24
Its still readable - just not yet in functions!

I am the lead programmer at red spark studios
http://www.redsparkstudios.co.uk
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 11th Jul 2005 05:04
You can strip out all the memblock stuff and just pass a string to the dll.

empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 11th Jul 2005 06:01
Yep, should work with
call dll(1,"LoadImageA",dbpwinHWND,IconName$,im,32,32,lr)
provided you got the constants set correctly.
To place that icon on your button you need to send the message BM_SETIMAGE ($F7 I believe) with the icon handle to it.


Play Nice! Play Basic! Version 1.073
dj chainz
20
Years of Service
User Offline
Joined: 25th Sep 2004
Location: England
Posted: 11th Jul 2005 17:11
I have the constants set correctly from dev-c++, and have tried passing the string across on its own - all the time it gives me err161!!!!!

I am the lead programmer at red spark studios
http://www.redsparkstudios.co.uk
Sayan Master
19
Years of Service
User Offline
Joined: 24th Jun 2005
Location:
Posted: 11th Jul 2005 19:34
Hello,
Sorry not being able to answer your question but how did you create your button ? (CreateWindowExA ?)
Otherwise have you the helpfile "Win32API.hlp" ? because it's very useful

Power is everything
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 11th Jul 2005 21:42
Perhaps you icon is damaged?


Play Nice! Play Basic! Version 1.073
Sayan Master
19
Years of Service
User Offline
Joined: 24th Jun 2005
Location:
Posted: 12th Jul 2005 22:23
Hello,
Sorry to ask you this but how did you manage to display a button in DBPro window ???
I tried myself with CreateWindowExA but it won't work
(if you want to keep it secret it's okay )

Power is everything
dj chainz
20
Years of Service
User Offline
Joined: 25th Sep 2004
Location: England
Posted: 12th Jul 2005 22:40 Edited at: 12th Jul 2005 22:58
It now loads!!! I just reverted back to entering the string rather than the long way of making a pointer myself, and it now returns an icon handle.

The only problem now is that I can't place the icon on a button - it simply doesnt want to work! I have set the style to include BS_ICON and then try sending the message BM_SETIMAGE. I have the parameters correct as far as I am aware - are there any problems anyone knows of about this?

edit:
just found this in winAPI reference...


It says I must create the button as an icon button... BlueGUI does not do this!!! Because a WinAPI call to createwindow needs more than 9 parameters and dbpro cannot pass more than 9 parameters, how can this be done?!!

I am the lead programmer at red spark studios
http://www.redsparkstudios.co.uk
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 13th Jul 2005 00:21 Edited at: 13th Jul 2005 00:37
I don't have BlueGUI but IIRC from the docs hasn't it a SetButtonImage command?
If that fails, you can change the style of the buttom to BS_ICON (it works quite well in Delphi):



untested but it should work.


Play Nice! Play Basic! Version 1.073
dj chainz
20
Years of Service
User Offline
Joined: 25th Sep 2004
Location: England
Posted: 17th Jul 2005 17:41
Yes!

That method above works - just you have to get the return value from the second call DLL.

I am the lead programmer at red spark studios
http://www.redsparkstudios.co.uk

Login to post a reply

Server time is: 2024-11-23 09:56:15
Your offset time is: 2024-11-23 09:56:15