我正在使用VB6,我需要为多维数组做一个ReDim Preserve:
Dim n, m As Integer
n = 1
m = 0
Dim arrCity() As String
ReDim arrCity(n, m)
n = n + 1
m = m + 1
ReDim Preserve arrCity(n, m)
Run Code Online (Sandbox Code Playgroud)
每当我写它时,我都会收到以下错误:
运行时错误9:下标超出范围
因为我只能更改最后一个数组维度,所以在我的任务中我必须更改整个数组(在我的示例中为2维)!
有没有解决方法或其他解决方案?
我是新手,所以我已经尝试了几个小时(我正在使用XE4),
我有一个简单的线程
type
TSendThread = class(TThread)
private
public
procedure proc(const s : string);
protected
procedure Execute; override;
end;
procedure TSendThread.proc(const S: String);
begin
showmessage(s);
end;
Run Code Online (Sandbox Code Playgroud)
现在,在我的主要表单中,我想用"proc"来表示:
procedure TForm1.Button1Click(Sender: TObject);
var
t : TSendThread;
begin
t := TSendThread.create(true);
t.Synchronize(nil, t.proc('foo'));
end;
Run Code Online (Sandbox Code Playgroud)
但每当我尝试编译,我得到:
没有可以使用这些参数调用的"Synchronize"的重载版本
这对我来说没有意义,因为当我从"proc"中删除"S"参数时,它工作正常.
如何在 chrome.tabs.create 之后获取新创建的选项卡 ID?如果同时创建多个选项卡呢?
谢谢你。
如您所知,我们可以通过谷歌聊天向任何手机发送短信,那么我们可以在delphi程序中使用此功能吗?我们可以用delphi发送短信吗?
我试图在一个线程中放置一个indy TIdHttp,我试过这个:
type
TSendThread = class(TThread)
private
{ Private declarations }
protected
procedure Execute; override;
public
http : TIdHTTP;
URL : String;
Method : String;
property ReturnValue;
end;
procedure TSendThread.Execute;
begin
form1.Memo1.lines.Add(http.Get(URL));
ReturnValue := 1;
end;
Run Code Online (Sandbox Code Playgroud)
主要是:
procedure TForm1.Button1Click(Sender: TObject);
var t : TSendThread;
begin
t := TSendThread.Create(true);
t.URL := 'http://www.url.com/';
t.http := http;
t.Start;
showmessage(IntToStr(t.ReturnValue));
end;
Run Code Online (Sandbox Code Playgroud)
我的问题是下一条指令被执行(showmessage)而不等待线程完成,我试图使用"WaitFor"但它冻结了应用程序.
还有其他解决方法吗?
谢谢.
想法是从数据库(文本和图片)中检索日期,然后将这些数据添加到另一张图片(如ID表格)中,然后保存新图片.
怎么能在delphi中完成?
谢谢
如你所知,在Windows中使用getch()时,应用程序会等到你按下一个键,
如何在不冻结程序的情况下读取密钥,例如:
void main(){
char c;
while(1){
printf("hello\n");
if (c=getch()) {
.
.
.
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢.
我正在尝试使用gcc编译器在Linux下编译此代码:
static inline unsigned long get_current(void)
{
unsigned long current;
asm volatile (
" movl %%esp, %%eax;"
" andl %1, %%eax;"
" movl (%%eax), %0;"
: "=r" (current)
: "i" (0xfffff000)
);
return current;
}
Run Code Online (Sandbox Code Playgroud)
但我收到此错误:
program.c: Assembler messages: program.c:455: Error: incorrect
register `%rbx' used with `l' suffix
Run Code Online (Sandbox Code Playgroud)
这是怎么了?
我刚开始使用JSF,在提交index.xhtml时遇到了这个问题:
/index.xhtml @ 11,65 value ="#{user.name}":目标无法访问,标识符'User'已解析为null
这是我的3个文件:index.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<title>Facelet Title</title>
</h:head>
<h:body>
Hello from Facelets
<h:form>
<h:inputText id="inputText" value="#{user.name}" />
<h:commandButton id="submit" value="Submit" action="home"/>
</h:form>
</h:body>
</html>
Run Code Online (Sandbox Code Playgroud)
home.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html">
<h:head>
<title>Home</title>
</h:head>
<h:body>
Welcome.
<h:form>
<h4>#{user.name}</h4>
</h:form>
</h:body>
</html>
Run Code Online (Sandbox Code Playgroud)
User.java
package com.jsf;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
@ManagedBean(name = "user")
@SessionScoped
public …Run Code Online (Sandbox Code Playgroud) 我试图将图像(比方说黑白)转换为矩阵(其中0 =黑色,1 =白色)
我试过这个代码:
procedure TForm1.Button1Click(Sender: TObject);
type
tab = array[1..1000,1..1000] of byte;
var i,j: integer;
s : string;
image : TBitmap;
t : tab;
begin
image := TBitmap.Create;
image.LoadFromFile('c:\image.bmp');
s := '';
for i := 0 to image.Height do
begin
for j := 0 to image.Width do
begin
if image.Canvas.Pixels[i,j] = clWhite then
t[i,j] := 0
else
t[i,j] := 1;
end;
end;
for i := 0 to image.Height do
begin
for j := 0 to image.Width do
begin
s:=s …Run Code Online (Sandbox Code Playgroud)