Printer()->PrinterIndex[EAccess Violation] |
尚未結案
|
white
一般會員 發表:18 回覆:7 積分:5 註冊:2003-02-17 發送簡訊給我 |
請各位大大幫幫忙,底下這段究竟錯在那?
偶的用意只是要強制使用某台印表機.但如果在PrintDialog內選到例如index=2,如果我再用Printer()->PrinterIndex=1(1,2都是存在且正常的),馬上就發生AV有時程式還會強迫被Terminate.如果沒被Terminate,繼續多試個幾次,OS內的印表機會變不見.錯誤訊息由EAccess Violation變成Printer selected is not valid.(因為不見了) void __fastcall TForm1::Button1Click(TObject *Sender)
{
if(PrintDialog1->Execute())
{
try
{
Printer()->PrinterIndex=1;
ShowMessage(IntToStr(Printer()->PageHeight));
}catch(Exception &exception){Application->ShowException(&exception);}
}
} 程式只有一個from,PrintDialog1,還有一個button.
如果只有
Printer()->PrinterIndex=2;
Printer()->PrinterIndex=1;
也是AV
如果
Printer()->PrinterIndex=1;
Printer()->PrinterIndex=2;
卻不會,傷透腦筋. white
------
white |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |