Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
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.
29285 Discussions

convert C return statement to Fortran?

intelandmicrosoft
841 Views
How do I translate a C return to a Fortran return in a a case statement? return CDRF_NOTIFYITEMDRAW; -> FORTRAN CODE???

C Code is as follows:
case WM_NOTIFY:
{
switch(LOWORD(wParam)) {
case IDC_LIST:
LPNMLISTVIEW pnm = (LPNMLISTVIEW)lParam;
if(pnm->hdr.hwndFrom == hCon &&pnm->hdr.code == NM_CUSTOMDRAW) {
LPNMLVCUSTOMDRAW lplvcd = (LPNMLVCUSTOMDRAW)lParam;

switch(lplvcd->nmcd.dwDrawStage)
{
case CDDS_PREPAINT :
return CDRF_NOTIFYITEMDRAW;
}
}}}

Fortran translation that I have so far:
TYPE(T_NM_LISTVIEW):: nm; POINTER (pnm,nm)
TYPE(T_NMHDR):: hdr; POINTER (phdr,hdr)
TYPE(T_NMLVCUSTOMDRAW):: lvcd; POINTER(lplvcd,lvcd)
TYPE(T_NMCUSTOMDRAW):: nmcd; POINTER(pnmcd,nmcd)

CASE ( WM_NOTIFY )
phdr = lParam

IF (wParam .EQ. IDC_LIST) THEN
pnm = lParam !not sure why because i never use it?

IF (hdr%hwndFrom.EQ.hCon.AND.hdr%code.EQ.NM_CUSTOMDRAW) THEN

pnmcd = lParam
lplvcd = lParam ! not sure why because i never use it?
IF (nmcd%dwDrawStage .EQ. CDDS_PREPAINT) THEN
RETURN CDRF_NOTIFYITEMDRAW !??? no good ???
END IF
END IF
END IF

Also Can I just do lvcd%nmcd%dwDrawStage and nm%hdr%hwndFrom and not declare phdr = lParam and pnmcd = lParam?
0 Kudos
1 Reply
intelandmicrosoft
841 Views
Never mind I answered my own question.

MainWndProc = CDRF_NOTIFYITEMDRAW
and
lvcd%nmcd%dwDrawStage .EQ. CDDS_PREPAINT works just fine.
0 Kudos
Reply