- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I useDigital Visual Fortran 6.0 (and Compaq Visual Fortran 6.5)
I write a win32 application using win api functions. Some functions calls successfully,
but function LoadImage doesn't want to be called. I have a error:
Error: This name does not have a type, and must have an explicit type.[LOADIMAGE]
Bitmap = LoadImage(0,&
-------------^
It seems to me that this function didn't declare in Fortran's libraries.
Iwrite the prototype of function below:
The LoadImage function loads an icon, cursor, or bitmap.
HANDLE LoadImage(
HINSTANCE hinst, // handle of the instance that contains the image
LPCTSTR lpszName,// name or identifier of image
UINT uType,// type of image
int cxDesired,// desired width
int cyDesired,// desired height
UINT fuLoad// load flags
);
And my part of code that I try to compile
integer(2) Bitmap
LoadImage("img.bmp"C,0,0)
Bitmap = LoadImage(0, &
"img.bmp"C, &
IMAGE_BITMAP, &
0, &
0, &
IOR(LR_DEFAULTSIZE, LR_LOADFROMFILE) &
)
May be it needs to call this function orsomehow stdcall it...
I need help.
Link Copied
- « Previous
-
- 1
- 2
- Next »
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
to write the intensity of each pixel in file as a nubmer. And after data handling I have a matrix of
intensity in .txt file.
I've made in delphi useng WinApi. But I want to make it in Fortran.
I've written in Fortran a part of code and try to compile it.
In "A Fortran 90 Tutorial" by Zane Dodsony I found such construction:
type ExtendedInteger
type( UnsignedExtendedInteger ), pointer :: number
end type ExtendedInteger
type( ExtendedInteger ) sum
If I understood correctly this thung can be applied to the arrays.
And I made so...
type Parr
type(T_RGB), pointer :: arr(100)
end type Parr
type(Parr) p
But it's wrong..
type T_RGB
byte b,r,g
end type T_RGB
type(T_RGB), allocatable:: my_array(:)
......
allocate(my_array(100))
brg = my_array(1)%r
And there is no error while linking. Is it right method to do what I described
above (in pascal and c++) ?
Then I try to make so.
INTEGER(1) FUNCTION GETRVALUE(RGB) ! //result type is byte
REAL*8 RGB ! // DWORD
GetRValue = IAND(rgb,#FF)
END FUNCTION GETRVALUE
REAL*8 brg
............
brg = 0.3*GetRValue(my_array(1)%r)
But during the linking I have:
Warning: Arguments' data types are incompatible with intrinsic procedure, assume EXTERNAL.
[IAND]
GetRValue = IAND(rgb,#FF)
---------------^
Error: The intrinsic data types of the arguments must be the same. [IAND]
GetRValue = IAND(rgb,#FF)
--------------------------^
Error: The type of the actual argument differs from the type of the dummy argument.
brg = 0.3*GetRValue(my_array(1)%r)
------------------------------------------^
I think it is because Argument Type in procedure IAND must be integer....
There is no source code for GetRValue and how it was already written by Mr.tim18 and
Mr. Paul Curtis I made it but DVF don't want to link withut errors...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why have you declared RGB to be REAL*8? That makes no sense to me. It is usually an integer type, which is why the compiler is complaining.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I try to write the intensity of pixels in .txt file.
There are problems with:
1) Pointer to lpBits
2) How to convert float number to string (I try to use function convertFtoCstring)..
Now the problems occured:
Error: The type of the actual argument differs from the type of the dummy argument.
IsWrite = WriteFile(hFile, s, lstrlen(s), dwBytes, lpOverlap)
-----------------------------------^
Error: This passed length character name has been used in an invalid context.
CHARACTER*(*) s
----------------------^
[cpp] TYPE (T_RGB), ALLOCATABLE :: P(:)
type (T_RGBTRIPLE), pointer :: lpBits
INTEGER*4 hFile REAL*8 brg integer*4 dwBytes INTEGER(2) WRD LOGICAL IsWrite LOGICAL IsClosed type(T_SECURITY_ATTRIBUTES) lpSecAttr type(T_OVERLAPPED) lpOverlap CHARACTER*(*) s INTEGER*4 FloatToStr //!.............. ALLOCATE(P(10000)) //! P = LOC(lpBits) !// Pointer to lpBits hFile = CreateFile("dataW.txt", GENERIC_WRITE, FILE_SHARE_READ, lpSecAttr, & CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,NULL) WRD = IOR(ISHL(10,8),13) //! division of string DO j=0,H-1 DO i=0,W-1 BRG = 0.3*(P(i+w*j)%r)+0.59*(P(i+w* j)%g)+0.11*(P(i+w*j)%b) // !FloatToStr = convertFtoCstring(s,BRG) !Conver number to string
IsWrite = WriteFile(hFile, s, lstrlen(s), dwBytes, lpOverlap)
S = ' ' //! separator of numbers in file
IsWrite = WriteFile(hFile, s, lstrlen(s), dwBytes, lpOverlap)
END DO !I IsWrite = WriteFile(hFile, WRD, SizeOf(WRD), dwBytes, lpOverlap) END DO !J IsClosed = CloseHandle(hFile) DEALLOCATE(P)
[/cpp]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you show the smallest possible routine that gets this error?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you show the smallest possible routine that gets this error?
I made an attachment of my project
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Find the declarations of the Win32 API routines in the CVF "Include" folder and compare them to what you are passing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
[cpp] implicit none type T_RGB byte b,r,g end type T_RGB TYPE (T_RGB), ALLOCATABLE :: P(:) integer*4 hInstance integer*4 hPrevInstance integer*4 lpszCmdLine integer*4 nCmdShow integer(HANDLE) Bitmap integer(HANDLE) bmDIB integer(HANDLE) DC integer*4 i, j integer*4 GtObj integer*4 Gtbit integer*4 W, H integer(HANDLE) hBDC integer(HANDLE) sobj include 'opp.fi' ! Variables type (T_WNDCLASS) wc type (T_MSG) mesg type (T_DIBSECTION) bmInfo type (T_BITMAPINFO) bmiInfo ! integer(LPVOID) bmiInfo type (T_RGBTRIPLE), pointer :: lpBits ! type (T_RGBTRIPLE) lpBits !------------------------------------------ INTEGER*4 hFile REAL*8 brg integer*4 dwBytes INTEGER(2) WRD !Word; LOGICAL IsWrite LOGICAL IsClosed type(T_SECURITY_ATTRIBUTES) lpSecAttr type(T_OVERLAPPED) lpOverlap ! CHARACTER*(*) s INTEGER*4 FloatToStr ............ !------------------------------------------------------------------------------------ DC = GetDC(ghwndMain) Bitmap = LoadImage(0, & "IMG.BMP"C, & cIMAGE_BITMAP, & 0, & 0, & IOR(cLR_DEFAULTSIZE, cLR_LOADFROMFILE) & ) GtObj=GetObject(Bitmap,SizeOf(bmInfo),LOC(bmInfo)) W = bmInfo%dsBm%bmWidth H = bmInfo%dsBm%bmHeight hBDC = CreateCompatibleDC(dc) sobj = SelectObject(hBDC, Bitmap) sobj = BitBlt(dc, 0, 0, w, h, hBDC, 0, 0, SRCCOPY) bmiInfo%bmiHeader%biWidth=W ! // Width bmiInfo%bmiHeader%biHeight=H ! // Height bmiInfo%bmiHeader%biPlanes=1 ! // always 1 bmiInfo%bmiHeader%biBitCount=24 ! // 3 byutes per pixel bmiInfo%bmiHeader%biCompression=BI_RGB ! // no conpression bmiInfo%bmiHeader%biSizeImage=0 ! // size iz unknown bmiInfo%bmiHeader%biXPelsPerMeter=2834 ! // pixels per meter,X. bmiInfo%bmiHeader%biYPelsPerMeter=2834 ! // pixels per meter,Y. bmiInfo%bmiHeader%biClrUsed=0 ! // bmiInfo%bmiHeader%biClrImportant=0 ! // bmiInfo%bmiHeader%biSize=SizeOf(bmiInfo%bmiHeader) !// bmDIB = CreateDIBSection(DC,bmiInfo,DIB_RGB_COLORS,LOC(lpBits),0,0) ! bmiInfo%bmiHeader%biWidth=W !// ! bmiInfo%bmiHeader%biHeight=H !// ! bmiInfo%bmiHeader%biPlanes=1 !// ! bmiInfo%bmiHeader%biBitCount=24 !// ! bmiInfo%bmiHeader%biCompression=BI_RGB !// ! bmiInfo%bmiHeader%biSize=SizeOf(bmiInfo%bmiHeader) ! ALLOCATE(P(1000)) P = LOC(lpBits) ! Pointer to lpBits hFile = CreateFile("dataW.txt", GENERIC_WRITE, FILE_SHARE_READ, lpSecAttr, & CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL,NULL) WRD = IOR(ISHL(10,8),13) ! division of string !//Writing matrix of pixel intensity in .txt file DO j=0,H-1 DO i=0,W-1 BRG = 0.3*(P(i+w*j)%r)+0.59*(P(i+w* j)%g)+0.11*(P(i+w*j)%b) !Intensity of Pixel FloatToStr = convertFtoCstring(s,BRG) !Conver number to string IsWrite = WriteFile(hFile, s, lstrlen(s), dwBytes, lpOverlap) S = ' ' ! separator between numbers in .txt file IsWrite = WriteFile(hFile, s, lstrlen(s), dwBytes, lpOverlap) END DO !I IsWrite = WriteFile(hFile, WRD, SizeOf(WRD), dwBytes, lpOverlap) !goto next line (write a symbol ofline division ) END DO !J IsClosed = CloseHandle(hFile) DEALLOCATE(P) !------------------------------------------------------------------------------------ [/cpp]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- « Previous
-
- 1
- 2
- Next »