delphi-7

Access Violation ShellExecute in delphi7

旧巷老猫 提交于 2020-01-06 14:05:30
问题 I am using ShellExecute the same way given below, to open a txt file in Delphi7, it gives me access violation in module BORdbk70.dll . Not sure what this issue is? I have added ShellApi in uses list. //sAddr := 'www.google.com'; Above line does not gives any error but also not redirect to browser and ShellExecute returns result as "5 = Windows 95 only: The operating system denied access to the specified file" sAddr := 'c:\text\info.txt'; res := ShellExecute(Handle, nil, PChar(sAddr), nil, nil

TPanel color is black no matter what

无人久伴 提交于 2020-01-06 04:53:48
问题 I just activated the themes in my Windows XP (usually I work using the classic Win9x look) and I have seen that two panels are pure black. Other panels are ok (color = clBtnFace). What these 2 panels have in common is their parent. Both are placed directly on a TForm. If I move them to a different parent (another panel for example) the have the appropriate color. Delphi 7, win xp pro 回答1: This is another grandiose Delphi bug. I started do delete stuff from my project and recompile the project

Empty string in Delphi / Windows combo box causes access exception

自闭症网瘾萝莉.ら 提交于 2020-01-05 03:23:09
问题 I've got a Delphi 7.0 application that throws a memory access exception / message box every time it writeln's an empty string from the string list associated with a combo box: csvstrlst := combobox1.Items; csvstrlst.clear; csvstrlst.add(''); //problem csvstrlst.add('a'); //no problem csvstrlst.add(''); //problem csvstrlst.add('b'); //no problem //throws memory access messages (I think the writeln writes a line though) for n := 1 to csvstrlst.Count do begin writeln(out_file,csvstrlst.strings[n

TRichEdit and URL highlighting problems

孤人 提交于 2020-01-04 06:19:12
问题 I am using the current code to highlight URLs on a TRichEdit: procedure TForm1.WndProc(var Message: TMessage); var p: TENLink; strURL: string; begin if (Message.Msg = WM_NOTIFY) then begin if (PNMHDR(Message.lParam).code = EN_LINK) then begin p := TENLink(Pointer(TWMNotify(Message).NMHdr)^); if (p.Msg = WM_LBUTTONDOWN) then begin SendMessage(RichEdit1.Handle, EM_EXSETSEL, 0, Longint(@(p.chrg))); strURL := RichEdit1.SelText; ShellExecute(Handle, 'open', PChar(strURL), 0, 0, SW_SHOWNORMAL); end

TRichEdit and URL highlighting problems

微笑、不失礼 提交于 2020-01-04 06:19:06
问题 I am using the current code to highlight URLs on a TRichEdit: procedure TForm1.WndProc(var Message: TMessage); var p: TENLink; strURL: string; begin if (Message.Msg = WM_NOTIFY) then begin if (PNMHDR(Message.lParam).code = EN_LINK) then begin p := TENLink(Pointer(TWMNotify(Message).NMHdr)^); if (p.Msg = WM_LBUTTONDOWN) then begin SendMessage(RichEdit1.Handle, EM_EXSETSEL, 0, Longint(@(p.chrg))); strURL := RichEdit1.SelText; ShellExecute(Handle, 'open', PChar(strURL), 0, 0, SW_SHOWNORMAL); end

delphi textrect wordwrap

萝らか妹 提交于 2020-01-03 20:48:09
问题 I am using Canvas.TextRect in Delphi 7 to output something on the screen. I need my text to be word wrapped in the rectangle. 回答1: You need to use DrawText (or DrawTextEx) with the DT_WORDBREAK flag. See the sample in this thread. 回答2: Use DrawText( hdc, pchar(s), length(s), rcRect, DT_NOPREFIX or DT_WORDBREAK); where s : string to print rcRect : TRect the rect wherein the string should be printed. 来源: https://stackoverflow.com/questions/1648277/delphi-textrect-wordwrap

EnumerateTraceGuids returns “The parameter is incorrect” (87)

懵懂的女人 提交于 2020-01-03 15:42:20
问题 i am trying to call the Windows API function EnumerateTraceGuids: ULONG EnumerateTraceGuids( __inout PTRACE_GUID_PROPERTIES *GuidPropertiesArray, __in ULONG PropertyArrayCount, __out PULONG GuidCount ); Starting from the code sample on MSDN: ULONG status = ERROR_SUCCESS; PTRACE_GUID_PROPERTIES *pProviders = NULL; ULONG RegisteredProviderCount = 0; ULONG ProviderCount = 0; pProviders = (PTRACE_GUID_PROPERTIES *) malloc(sizeof(PTRACE_GUID_PROPERTIES)); status = EnumerateTraceGuids(pProviders,

How to select all root or all child nodes in VirtualStringTree?

一曲冷凌霜 提交于 2020-01-03 15:15:53
问题 I would like to select either all root nodes or all child nodes (not all nodes in a VirtualTreeView). I've tried to use this code to select all root nodes: procedure SelectAllRoots; var Node: PVirtualNode; begin Form1.VirtualStringTree1.BeginUpdate; Node := Form1.VirtualStringTree1.GetFirst; while True do begin if Node = nil then Break; if not (vsSelected in Node.States) then Node.States := Node.States + [vsSelected]; Node := Form1.VirtualStringTree1.GetNext(Node); end; Form1

Word 2010 automation: 'goto bookmark'

纵饮孤独 提交于 2020-01-03 11:02:14
问题 I have a program written in Delphi-7 which opens a new Word document which is based on a template. Once the document is open, the automation jumps to a bookmark (predefined in the template) and adds some text there. The following code works fine in Word 2003 but causes a invalid variant operation error message in Word 2010 (I have omitted try/except blocks for the sake of clarity) . wrdapp:= CreateOleObject ('Word.Application'); wrdDoc:= wrdapp.documents.add (wrdApp.Options.DefaultFilePath

Word 2010 automation: 'goto bookmark'

a 夏天 提交于 2020-01-03 11:02:10
问题 I have a program written in Delphi-7 which opens a new Word document which is based on a template. Once the document is open, the automation jumps to a bookmark (predefined in the template) and adds some text there. The following code works fine in Word 2003 but causes a invalid variant operation error message in Word 2010 (I have omitted try/except blocks for the sake of clarity) . wrdapp:= CreateOleObject ('Word.Application'); wrdDoc:= wrdapp.documents.add (wrdApp.Options.DefaultFilePath