I'm having a problem with the menu section of my code (I think). I can compile and run it on my Win x64. It runs fine. The debug output is below. With the "menu" disabled, I still receive the same debug output.
QuoteStarting debug session...
Loading DLL: ntdll.dll
Loading DLL: C:\Windows\syswow64\kernel32.dll
Loading DLL: C:\Windows\syswow64\KERNELBASE.dll
Loading DLL: C:\Windows\syswow64\USER32.DLL
Loading DLL: C:\Windows\syswow64\GDI32.dll
Loading DLL: C:\Windows\syswow64\LPK.dll
Loading DLL: C:\Windows\syswow64\USP10.dll
Loading DLL: C:\Windows\syswow64\msvcrt.dll
Loading DLL: C:\Windows\syswow64\ADVAPI32.dll
Loading DLL: C:\Windows\SysWOW64\sechost.dll
Loading DLL: C:\Windows\syswow64\RPCRT4.dll
Loading DLL: C:\Windows\syswow64\SspiCli.dll
Loading DLL: C:\Windows\syswow64\CRYPTBASE.dll
Loading DLL: C:\Windows\syswow64\OLE32.DLL
Loading DLL: C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1dfw
Loading DLL: C:\Windows\syswow64\OLEAUT32.DLL
Loading DLL: C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b641w
Loading DLL: C:\Windows\SysWOW64\WINMM.DLL
Loading DLL: C:\Windows\syswow64\COMDLG32.DLL
Loading DLL: C:\Windows\syswow64\SHLWAPI.dll
Loading DLL: C:\Windows\syswow64\SHELL32.dll
Loading DLL: C:\Windows\SysWOW64\CRTDLL.DLL
Loading DLL: C:\Windows\SysWOW64\IMM32.DLL
Loading DLL: C:\Windows\syswow64\MSCTF.dll
Loading DLL: C:\Windows\SysWOW64\uxtheme.dll
Loading DLL: C:\Windows\SysWOW64\dwmapi.dll
Loading DLL: C:\Program Files (x86)\KatMouse\KatMouseS.dll
Loading DLL: C:\Windows\SysWOW64\ole32.dll
First chance exception: Address 0x0040AD6A Integer Divide by Zero
Loading DLL: C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b641w
But when I copy the exe file to another computer it generates an unrecoverable error. Debug output below. But when I remove my "menu", then it runs fine. It is receiving the Integer Divide by Zero, first chance on the first one, and first and last chance on the second one. How do I correct this.
QuoteDebug Context Display
Call stack:
Listen! <missing symbols>
Listen! <missing symbols>
Listen! <missing symbols>
Listen! <missing symbols>
USER32! GetDC + 109
USER32! GetDC + 335
USER32! DefWindowProcW + 384
USER32! DefWindowProcW + 460
ntdll! KiUserCallbackDispatcher + 19
USER32! DefWindowProcA + 170
uxtheme! <missing symbols>
uxtheme! GetThemeAppProperties + 80
USER32! SendInput + 28
Listen! <missing symbols>
USER32! GetDC + 109
USER32! UserLpkPSMTextOut + 460
USER32! DefWindowProcW + 384
USER32! UserLpkPSMTextOut + 534
ntdll! KiUserCallbackDispatcher + 19
Listen! <missing symbols>
Listen! <missing symbols>
kernel32! RegisterWaitForInputIdle + 73
Starting debug session...
Loading DLL: ntdll.dll
Loading DLL: C:\WINDOWS\system32\kernel32.dll
Loading DLL: C:\WINDOWS\system32\USER32.DLL
Loading DLL: C:\WINDOWS\system32\GDI32.dll
Loading DLL: C:\WINDOWS\system32\OLE32.DLL
Loading DLL: C:\WINDOWS\system32\ADVAPI32.dll
Loading DLL: C:\WINDOWS\system32\RPCRT4.dll
Loading DLL: C:\WINDOWS\system32\Secur32.dll
Loading DLL: C:\WINDOWS\system32\msvcrt.dll
Loading DLL: C:\WINDOWS\WinSxS\x86_Microsoft.Windows.GdiPlus_6595b64144ccf1dfW
Loading DLL: C:\WINDOWS\system32\OLEAUT32.DLL
Loading DLL: C:\WINDOWS\system32\COMCTL32.DLL
Loading DLL: C:\WINDOWS\system32\WINMM.DLL
Loading DLL: C:\WINDOWS\system32\COMDLG32.DLL
Loading DLL: C:\WINDOWS\system32\SHELL32.dll
Loading DLL: C:\WINDOWS\system32\SHLWAPI.dll
Loading DLL: C:\WINDOWS\system32\CRTDLL.DLL
Loading DLL: C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b641W
Loading DLL: C:\WINDOWS\system32\uxtheme.dll
Loading DLL: C:\Program Files\Common Files\Spigot\Search Settings\wth.dll
Loading DLL: C:\WINDOWS\system32\PSAPI.DLL
Loading DLL: C:\WINDOWS\WinSxS\x86_Microsoft.VC90.CRT_1fc8b3b9a1e18e3b_9.0.30V
First chance exception: Address 0x0040C164 Integer Divide by Zero
Final chance exception: Address 0x0040C164 Integer Divide by Zero
I found my problem. It was a divide by zero error in the ReDraw() and DrawPond() routine. Fixed it.
Later,
Clint
I would like to see what you did - I could get it to compile, but it fell over immediately,
with a message to send a greeting to Mr Gates!
Brian
Brian,
I just added a check for zero on the c and r variables toward the top of the ReDraw() and DrawPond() subs.
SUB ReDraw
INT rr,cc
GETCLIENTSIZE w1,l,t,w,h
'===== added this ===============
IF c=0 OR r=0
RETURN 0
ENDIF
'=============================
w=(w-(c-1)*10-40)/c
h=(h-(r-1)*10-40)/r
FOR rr=1 to r
FOR cc=1 TO c
DrawPond(rr,cc)
NEXT cc
NEXT rr
RETURN 0
ENDSUB
SUB DrawPond(int dr,int dc)
INT x,y,tw,th
STRING mTime,pTitle
GETCLIENTSIZE w1,l,t,w,h
'========== added this ============
IF c=0 or r=0
RETURN 0
ENDIF
'===============================
w=(w-(c-1)*10-40)/c
h=(h-(r-1)*10-40)/r
x=20+(dc-1)*(w+10)
y=20+(dr-1)*(h+10)
IF Index[dr,dc]<1 OR Index[dr,dc]>255
IF hideloc=0
RoundRectangle(w1,x,y,w,h,w*0.25,RGBA(160,160,160,255),RGBA(200,200,255,255),RGBA(200,200,255,255))
ENDIF
ELSE
IF PondInfo[Index[dr,dc]].Mute=1
RoundRectangle(w1,x,y,w,h,w*0.25,RGBA(0,0,0,255),RGBA(244,163,89,255),RGBA(244,118,4,255))'orange
FRONTPEN w1,RGB(255,255,255) 'white text
ELSE
IF PondData[Index[dr,dc]].Oxy<=PondInfo[Index[dr,dc]].OxyAlarm
'show pond in alarm, send email if not sent
RoundRectangle(w1,x,y,w,h,w*0.25,RGBA(0,0,0,255),AlarmColor1,AlarmColor2)'red
FRONTPEN w1,RGB(0,0,0) 'black text
IF AlarmSent[Index[dr,dc]]<6
IF PondData[Index[dr,dc]].Oxy=0
AlarmSent[Index[dr,dc]]++
ELSE
AlarmSent[Index[dr,dc]]=6
ENDIF
ENDIF
IF AlarmSent[Index[dr,dc]]=6 AND PondInfo[Index[dr,dc]].Mute=0
AlarmSent[Index[dr,dc]]++ '7 means alarm sent
SendEmailOut("OXYGEN ALERT",PondInfo[Index[dr,dc]].Name+" has a low Oxygen value of"+USING("###.#",PondData[Index[dr,dc]].Oxy))
ENDIF
ELSEIF PondData[Index[dr,dc]].Oxy<=PondInfo[Index[dr,dc]].OxyWarning
'show pond in warning, reset email flag if not reset
AlarmSent[Index[dr,dc]]=1 'clear alarm flag
RoundRectangle(w1,x,y,w,h,w*0.25,RGBA(0,0,0,255),RGBA(255,255,128,255),RGBA(192,128,0,255))'yellow
FRONTPEN w1,0 'black text
ELSE
'show normal pond, reset email flag if not reset
AlarmSent[Index[dr,dc]]=1 'clear alarm flag
RoundRectangle(w1,x,y,w,h,w*0.25,RGBA(0,0,0,255),RGBA(200,200,255,255),RGBA(128,128,255,255))
FRONTPEN w1,0 'black text
ENDIF
ENDIF
SETFONT w1,"Times New Roman",(w+h)/18,400
IF ShowID
pTitle=PondInfo[Index[dr,dc]].Name+" - "+LTRIM$(STR$(Index[dr,dc]))
ELSE
pTitle=PondInfo[Index[dr,dc]].Name
ENDIF
GETTEXTSIZE w1,PondInfo[Index[dr,dc]].Name,tw,th
DRAWMODE w1,@TRANSPARENT
PrintText(w1,pTitle,x+(w/2),y+(th/2)+2,2)
mTime=FormatSysTime(PondData[Index[dr,dc]].DateTime)
PrintText(w1,mTime,x+(w/2),y+h-(th/2)-2,2)
SETFONT w1,"Times New Roman",(w+h)/8,400
PrintText(w1,LTRIM$(USING("###.#",PondData[Index[dr,dc]].Oxy)),x+(w/2),y+(h/2),2)
DRAWMODE w1,@OPAQUE
ENDIF
RETURN 0
ENDSUB
Later,
Clint