当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: 如题 ......
    摘要: 比如 create index idx_customersid on customers(customersid) 再用如下的查询 select customerid, customername from customers where customerid like %csdn% 这样在sql server2000中上面的那个索引是否有效? ......


不使用用VCL怎么显示图片

我在做一个不使用VCL的程序,有没有简单的办法在我的窗口里显示图片?

NO.1   作者: plainsong

program   NoVCL2;0D  
  uses  
      windows,Messages,Activex;  
   
  {$R   *.RES}  
  function   OleLoadPictureFile(varFileName:OleVariant;  
                    var   lplpdispPicture:IDispatch):HResult;stdcall;external   OleAut32.dll   index   422;  
  //ActiveX单元中的声明有错误,这里要自己声明一个。  
  type  
      PRect=^TRect;  
  var  
  hwndMain:   HWND   ;  
  msg   :   TMSG   ;  
  wc:   TWNDCLASS   ;  
  i:Integer;  
   
  DispPic:IDispatch;  
  aPic:IPicture;  
  PicW,PicH:LongInt;  
      function   MainProc(   hwndMe:HWND;uMsg,wParam,lParam:Integer):LongInt;stdcall;  
      var  
          aDC:HDC;  
          ps:TPaintStruct;  
          ClientRect:TRect;  
      begin  
          case   uMsg   of  
              WM_CREATE:  
              begin  
                  if   OleLoadPictureFile(e:\test1.gif,DispPic)   <   0   then  
                      MessageBox(hwndMe,Load   Picture   Error!,nil,MB_OK)  
                  else  
                  begin  
                      aPic   :=   DispPic   as   IPicture;  
                      aPic.get_Width(PicW);  
                      aPic.get_Height(PicH);  
                  end;  
              end;  
              WM_PAINT:  
              begin  
                  GetClientRect(hwndMe,ClientRect);  
                  aDC   :=   BeginPaint(hwndMe,ps);  
                  aPic.Render(adc,0,0,ClientRect.Right,ClientRect.Bottom,0,PicH-1,PicW,-PicH,PRect(Nil)^);  
                  EndPaint(hwndMe,ps);0D             end;  
              WM_DESTROY:  
                  PostQuitMessage(0);  
              WM_LBUTTONDOWN:  
              begin  
                  WinExec(PChar(C:\WINNT\explorer.exe),SW_NORMAL);0D             end;  
          end;  
          Result   :=   DefWindowProc(hwndMe,uMsg,wParam,lParam);  
      end;  
   
  begin  
      CoInitialize(nil);  
      wc.style   :=   CS_VREDRAW   or   CS_HREDRAW;  
  0A     wc.lpfnWndProc   :=   @MainProc;  
      wc.cbClsExtra   :=   0;  
      wc.cbWndExtra   :=   0;  
      wc.hInstance   :=   hInstance;  
      wc.hIcon   :=   LoadIcon(0,   IDI_APPLICATION);  
      wc.hCursor   :=   LoadCursor(0,   IDC_ARROW);  
  0A     wc.hbrBackground   :=   0;//GetStockObject(GRAY_BRUSH);  
      wc.lpszMenuName   :=     nil;  
      wc.lpszClassName   :=   MainWndClass;  
      if   (RegisterClass(wc)   =   0)   then  
          exit;  
      hwndMain   :=   CreateWindow(MainWndClass,   Sample,  
          WS_OVERLAPPEDWINDOW,   CW_USEDEFAULT,   CW_USEDEFAULT,  
          CW_USEDEFAULT,   CW_USEDEFAULT,   0,  
          0,   HInstance,   nil);  
      if   (hwndMain   =0)   then  
          exit;  
      ShowWindow(hwndMain,   SW_NORMAL);  
      UpdateWindow(hwndMain);  
  0A  
      while   (GetMessage(msg,   0,   0,   0))     do  
      begin  
          TranslateMessage(msg);  
  0A         DispatchMessage(msg);  
  0A     end;  
      CoUninitialize;  
  end.  
   
            轻风又伤心了:2002-06-04  
            ____           ____  
            \   p   \       /   g   /  
              \   l   \_/   n   /  
                \   a       o   /  
                  \   i   s   /  
                    \   n   /  
                      \_/  
 


    摘要: 我编写的是扫描程序,可是当我扫描一个不存在的主机的时候,我的程序会等待很久才告 诉我超时了,请问怎么解决? ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE