Hi everyone

I am trying to open a com port for read write, the program compiles with no errors , but whn I invoke writefile & getLastError I get Error_Mod_Not_Found.

I did search the web for solution & found out that my Program cant find a dll file, I did test my program on a different computer & the same problem is there. Does any one know how to solve this Problem.:confused:

Thanx guys & have a nice day

Peace
Posted on 2004-02-03 14:14:53 by mistronr1
What .lib files do you link against? Do you have dependency walker installed on your machine?
Posted on 2004-02-03 20:57:47 by Mecurius
Hi Mecurius

here is my include section


include c:\masm32\include\kernel32.inc
include c:\masm32\include\user32.inc
include c:\masm32\include\Comctl32.inc
include c:\masm32\include\shell32.inc
include c:\masm32\include\MASM32.inc
include c:\masm32\include\windows.inc
includelib c:\masm32\lib\kernel32.lib
includelib c:\masm32\lib\user32.lib
includelib c:\masm32\lib\Comctl32.lib
includelib c:\masm32\lib\shell32.lib
includelib c:\masm32\lib\crtlib.lib
includelib c:\masm32\lib\MASM32.LIB


what is dependency walker?
Posted on 2004-02-04 04:28:18 by mistronr1
Dependency Walker is a Microsoft utility that allows you to graphically view the DLLs your program depends on. It will also display an icon if it cannot find a DLL so you can pinpoint your problem. It comes with Visual Studio and the Platform SDK as depends.exe.

As far as your imports go, nothing really stands out to me. If the machines you run this on are 95/98/NT, do they have Internet Explorer installed. The common control DLLs are part of IE.

Do you make any LoadLibrary or LoadLibraryEx calls in your program?
Posted on 2004-02-04 11:25:34 by Mecurius
when I run Dependency Walker I recive this message:

Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.

& it shows MPR.DLL to be the one with problem.

here is the part with problem :


.386
.model flat, stdcall ;32 bit memory model
option casemap :none ;case sensitive


include c:\masm32\include\kernel32.inc
include c:\masm32\include\user32.inc
include c:\masm32\include\Comctl32.inc
include c:\masm32\include\shell32.inc
include c:\masm32\include\MASM32.inc
include c:\masm32\include\windows.inc
includelib c:\masm32\lib\kernel32.lib
includelib c:\masm32\lib\user32.lib
includelib c:\masm32\lib\Comctl32.lib
includelib c:\masm32\lib\shell32.lib
includelib c:\masm32\lib\crtlib.lib
includelib c:\masm32\lib\MASM32.LIB




.data
m_dcb DCB <>
m_CommTimeouts COMMTIMEOUTS <>
OKmessage db "OK",0
comX2 db "COM2",0
command4 db 0FFh,030h,030h,0,0A0h,030h,0EFh,0
.data?
hcomm dd ?
n dd ?
.code

start:
invoke CreateFile,addr comX2,GENERIC_READ or GENERIC_WRITE,0,0,OPEN_EXISTING,0,0
mov hcomm,eax
mov m_dcb.DCBlength, sizeof m_dcb
invoke GetCommState,hcomm,addr m_dcb
mov m_dcb.BaudRate,19200
mov m_dcb.ByteSize,8
mov m_dcb.Parity,0
mov m_dcb.StopBits,1
invoke SetCommState,hcomm,addr m_dcb
invoke GetCommTimeouts,hcomm,addr m_CommTimeouts
mov m_CommTimeouts.ReadIntervalTimeout,MAXDWORD
mov m_CommTimeouts.ReadTotalTimeoutMultiplier,0
mov m_CommTimeouts.ReadTotalTimeoutConstant,0
mov m_CommTimeouts.WriteTotalTimeoutMultiplier,10
mov m_CommTimeouts.ReadTotalTimeoutConstant,1000 ;1 sek
invoke SetCommTimeouts,hcomm,addr m_CommTimeouts


invoke WriteFile,hcomm,addr command4,7,addr n,0
mov eax,offset n
test eax,eax
jz @F
invoke MessageBox,0,addr OKmessage,addr OKmessage,MB_OK

@@:
invoke CloseHandle, hcomm
mov eax,0
ret
end start
Posted on 2004-02-04 13:54:32 by mistronr1