edit1:=CreateWindowEx(0,'edit','asds',ws_Child or ws_Visible or
ws_Border or bs_PushButton,
0,0,160,30,hWnd,id_edit1,hInstance,nil);SetWindowPos(GetDlgItem(hWnd,id_edit1),0,Rect.Right div 2-250,
Rect.Bottom -200,0,0,swp_NoZOrder or swp_NoSize);
这样创建后,请问该如何对其进行读写?
解决方案 »
- vc里的guid在delphi里怎么表示?
- cxGrid显示数据时的全局扫描如何禁止?
- 为什么用SENDTEXT发过去的串,客户端收到的有时是乱码?用SEDNBUF有时也是乱码?谢谢!
- 求做报表的源代码
- 怎样在DELPHI中屏蔽键盘口!急急急!!!
- 请各位仁兄指点,非常感谢!关于SQLServer数据库的发布问题!
- 哪边有delphi7和interbase7可以下载,请各位大侠告诉咱一下,急!急!急!急!
- 请问DELPHI中有没有类如中HashTable表示键/值对的集合的类(现成数据结构)?
- 如何在SQL里访问不在当前目录下的表?
- 寻找类似于OutLook的日历风格。
- 急!!!关于实现用Delphi查询Excel文件中的数据的问题
- 请问哪里有单独的Delphi 2007帮助文件下载?
ws_Border or bs_PushButton,
0,0,160,30,hWnd,id_edit1,hInstance,nil);SetWindowPos(GetDlgItem(hWnd,id_edit1),0,Rect.Right div 2-250,
Rect.Bottom -200,0,0,swp_NoZOrder or swp_NoSize);
.//SendMessage(Edit1,WM_SetText,0,Integer(pchar('this is Edit')));
讀換成 WM_GetText
wm_Command:
begin
case LoWord(wParam) of
id_Button3:
begin
if HiWord(wParam)=bn_Clicked then
SendMessage(edit2,WM_SetText,0,Integer(pchar('this is Edit')));
end;
我是用BUTTON按键触发 EDIT显示 ,但是无法显示,getlasterror 返回值为 1400 无效的窗口句柄。edit2 我是用 THandle 定义的,不知道哪里出了问题?
把代碼貼全點。除非你的 Edit2 == 0 ??至於多行可以通過 SetwindowLong 來設置
function PlainWinProc(hWnd:THandle; nMsg:UINT;
wParam,lParam:Cardinal):Cardinal;export;stdcall;
var
Rect:TRect;
edit1,edit2,edit3:THandle;
begin
result:=0; case nMsg of
wm_Create:
begin
CreateWindowEx(0,'Button','&HELLO',ws_Child or ws_Visible or
ws_Border or bs_PushButton,
0,0,80,30,hWnd,id_Button1,hInstance,nil);
CreateWindowEx(0,'Button','&退出',ws_Child or ws_Visible or
ws_Border or bs_PushButton,
0,0,80,30,hWnd,id_Button2,hInstance,nil);
CreateWindowEx(0,'Button','&安装服务',ws_Child or ws_Visible or
ws_Border or bs_PushButton,
0,0,80,30,hWnd,id_Button3,hInstance,nil);
CreateWindowEx(0,'Button','&启动服务',ws_Child or ws_Visible or
ws_Border or bs_PushButton,
0,0,80,30,hWnd,id_Button4,hInstance,nil);
CreateWindowEx(0,'Button','&停止服务',ws_Child or ws_Visible or
ws_Border or bs_PushButton,
0,0,80,30,hWnd,id_Button5,hInstance,nil);
CreateWindowEx(0,'Button','&卸载服务',ws_Child or ws_Visible or
ws_Border or bs_PushButton,
0,0,80,30,hWnd,id_Button6,hInstance,nil);
CreateWindowEx(0,'Button','&发送消息',ws_Child or ws_Visible or
ws_Border or bs_PushButton,
0,0,80,30,hWnd,id_Button7,hInstance,nil);
edit1:=CreateWindowEx(0,'edit','1',ws_Child or ws_Visible or
ws_Border ,
0,0,30,30,hWnd,id_edit1,hInstance,nil);
edit2:=CreateWindowEx(0,'edit','',ws_Child or ws_Visible or
ws_Border ,
0,0,160,30,hWnd,id_edit2,hInstance,nil);
edit3:=CreateWindowEx(0,'edit','',ws_Child or ws_Visible or
ws_Border ,
0,0,160,300,hWnd,id_edit3,hInstance,nil);
end;
wm_Size:
begin
GetClientRect(hWnd,Rect);
SetWindowPos(GetDlgItem(hWnd,id_Button1),0,Rect.Right div 2-300,
Rect.Bottom div 2-50,0,0,swp_NoZOrder or swp_NoSize);
SetWindowPos(GetDlgItem(hWnd,id_Button2),0,Rect.Right div 2-200,
Rect.Bottom div 2-50,0,0,swp_NoZOrder or swp_NoSize);
SetWindowPos(GetDlgItem(hWnd,id_Button3),0,Rect.Right div 2-300,
Rect.Bottom div 2-10,0,0,swp_NoZOrder or swp_NoSize);
SetWindowPos(GetDlgItem(hWnd,id_Button4),0,Rect.Right div 2-200,
Rect.Bottom div 2-10,0,0,swp_NoZOrder or swp_NoSize);
SetWindowPos(GetDlgItem(hWnd,id_Button5),0,Rect.Right div 2-100,
Rect.Bottom div 2-10,0,0,swp_NoZOrder or swp_NoSize);
SetWindowPos(GetDlgItem(hWnd,id_Button6),0,Rect.Right div 2-100,
Rect.Bottom div 2-50,0,0,swp_NoZOrder or swp_NoSize);
SetWindowPos(GetDlgItem(hWnd,id_Button7),0,Rect.Right div 2-200,
Rect.Bottom - 150,0,0,swp_NoZOrder or swp_NoSize);
SetWindowPos(GetDlgItem(hWnd,id_edit1),0,Rect.Right div 2-300,
Rect.Bottom -200,0,0,swp_NoZOrder or swp_NoSize);
SetWindowPos(GetDlgItem(hWnd,id_edit2),0,Rect.Right div 2-250,
Rect.Bottom -200,0,0,swp_NoZOrder or swp_NoSize);
SetWindowPos(GetDlgItem(hWnd,id_edit3),0,Rect.Right -300,
Rect.Bottom div 2-200,0,0,swp_NoZOrder or swp_NoSize);
end; wm_Command:
begin case LoWord(wParam) of
id_Button1:
begin
if HiWord(wParam)=bn_Clicked then
MessageBox(hWnd,'OK','Demo',MB_OK);
end;
id_Button2:
begin
if HiWord(wParam)=bn_Clicked then
Halt;
end;
id_Button3: //安装
begin
if HiWord(wParam)=bn_Clicked then
ShellExecute(hWnd, 'open','DemoSrv.exe','/install','', SW_SHOWNORMAL);
SendMessage(edit2,WM_SetText,0,Integer(pchar('安装服务...')));
showmessage(inttostr(getlasterror()));
end;
id_Button4: //启动
begin
if HiWord(wParam)=bn_Clicked then
StartClick;
end;
id_Button5: //停止
begin
if HiWord(wParam)=bn_Clicked then
StopClick;
end;
id_Button6: //卸载
begin
if HiWord(wParam)=bn_Clicked then
ShellExecute(hWnd, 'open','DemoSrv.exe','/remove','', SW_SHOWNORMAL);
end;
id_Button7: //消息
begin
if HiWord(wParam)=bn_Clicked then
PipeInstanceProc ;
end;
end;
end; wm_DropFiles:
begin
MessageBox(hWnd,'Drop File','Plain API',MB_OK);
DragFinish(wParam);
end; wm_Destroy:
PostQuitMessage(0);
else
result:=DefWindowProc(hWnd,nMsg,wParam,lParam);
end;
end;