1. machine exception
- Posted by coconut Aug 02, 2012
- 1232 views
I get this error when calling Win32 API TextOut():
A machine-level exception occurred during execution of this statement (signal 5) hDC = 1476465858 left = 10 top = 10 text = {116't',101'e',115's',116't'} pUnicode = 36167784 result = <no value>
global constant iGetDC=define_c_func(user32lib,"GetDC",{C_UINT},C_UINT) global function GetDC(atom hWnd) return c_func(iGetDC,{hWnd}) end function global constant iReleaseDC=define_c_func(user32lib,"ReleaseDC",{C_UINT,C_UINT},C_UINT) global procedure ReleaseDC(atom hwnd,atom hDC) object fnVal fnVal = c_func(iReleaseDC,{hwnd,hDC}) end procedure constant iTextOut=define_c_func(gdi32lib,"TextOutW",{C_UINT,C_INT,C_INT,C_POINTER,C_INT},C_UINT) /* ref: http://msdn.microsoft.com/en-us/library/windows/desktop/dd145133(v=vs.85).aspx writes a character string at the specified location, using the currently selected font, background color, and text color. input: hDC, handle of display context left, x coordinate top, y coordinate text, text to write */ public procedure TextOut(atom hDC, integer left, integer top, sequence text) atom pUnicode, result pUnicode = allocate_unicode(text) result = c_func(iTextOut,{hDC, pUnicode,left,top,length(text)}) free(pUnicode) end procedure -- TextOut -- main file code atom hDC = GetDC(hWnd) TextOut(hDC,10,10,"test") ReleaseDC(hWnd,hDC)
ajout: curieusement si j'utilise DrawText() au lieu de TextOut() je n'ai pas de problème...
Jacques
2. Re: machine exception
- Posted by ne1uno Aug 02, 2012
- 1190 views
coconut said...
I get this error when calling Win32 API TextOut():
A machine-level exception occurred during execution of this statement (signal 5) hDC = 1476465858 left = 10 top = 10 text = {116't',101'e',115's',116't'} pUnicode = 36167784 result = <no value>
public procedure TextOut(atom hDC, integer left, integer top, sequence text) atom pUnicode, result pUnicode = allocate_unicode(text) result = c_func(iTextOut,{hDC, pUnicode,left,top,length(text)})
should that be?:
result = c_func(iTextOut,{hDC, left,top,pUnicode,length(text)})
3. Re: machine exception
- Posted by coconut Aug 03, 2012
- 1148 views
ne1uno said...
coconut said...
I get this error when calling Win32 API TextOut():
A machine-level exception occurred during execution of this statement (signal 5) hDC = 1476465858 left = 10 top = 10 text = {116't',101'e',115's',116't'} pUnicode = 36167784 result = <no value>
public procedure TextOut(atom hDC, integer left, integer top, sequence text) atom pUnicode, result pUnicode = allocate_unicode(text) result = c_func(iTextOut,{hDC, pUnicode,left,top,length(text)})
should that be?:
result = c_func(iTextOut,{hDC, left,top,pUnicode,length(text)})
That's right! Sometimes I have the nose to close on it to see the obvious mistake. Thanks!
Jacques