Software Archive
Read-only legacy content
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
17060 Discussions

Passing Character Strings to WIN32

Intel_C_Intel
Employee
564 Views
I have a project that has a VB GUI and a FORTRAN DLL. I want to use SendMessage with SB_SETTEXT message to send some text to a status block in the VB GUI. I have tried all sorts of combinations of %REF, %VAL, etc without success. The following is an excerpt. Can anyone suggest what I may be missing. By the way the INTERFACE block declares all four arguments as INTEGER and invokes STDCALL. I have been successful using a SB_SIMPLE message that passes a logical*4 flag--so the VB is passing the correct HWND. The issue appears how to get the string passed as the specified INTEGER variable.

Integer*4 Function MYMESSAGE(myHWND)
CDEC$ ATTRIBUTES DLLEXPORT :: MYMESSAGE
CDEC$ ATTRIBUTES ALIAS: 'MYMESSAGEA' :: MYMESSAGE
USE DFWIN
INTEGER*4 myHWND, MSG, LPARAM, WPARAM,lreturn
Character*15 lstring
DATA lstring/'This is a test'C/
MSG=WM_USER+1
LPARAM=LOC(lstring)
WPARAM=0
lreturn = SendMessage(myHWND,MSG,WPARAM,LPARAM)
lreturn = UpdateWindow(myHWND)
mymessage = lreturn
RETURN
END FUNCTION MYMESSAGE

Thank you
0 Kudos
3 Replies
Intel_C_Intel
Employee
564 Views
Hi,

This is what you need:
lreturn = SendMessage(myHWND, SB_SETTEXT, SB_SIMPLEID, LPARAM)


For more info see http://msdn.microsoft.com/library/psdk/shellcc/commctls/Status/Messages/SB_SETTEXT.htm.

Oh, and since I had trouble finding it, SB_SIMPLEID is
integer, parameter :: SB_SIMPLEID = z'FF'

hth,
John
0 Kudos
Intel_C_Intel
Employee
564 Views
Hi
Thank you for your response. I was still unsuccessful. Since I have been able to do actions that happen immediately (e.g., SB_SIMPLE, PBM_SETBKCOLOR) but text and the progress bar doesn't appear, I've come to the realization that the problem has to do with the controls not repainting.
I've been able to accomplish what I needed through the use of callbacks passed to the DLL.
Thanks again for your help
0 Kudos
Intel_C_Intel
Employee
564 Views
Hi,

It worked for me in a test. Oh well, glad you have what you needed to get done. :-)

-John
0 Kudos
Reply