当前位置:首页 » 多媒体相关

如何在vb中实现对显示属性中颜色和屏幕区域的监测?


我写的界面是在1024*768,32位真彩下的,我想在程序启动的时候监测显示属性是不是1024*768,32位,如果是,程序运行,不是提示用户修改,请高手指点如何实现。

推荐阅读

  • 魅族全面升级 M6se M3se多功能曝光魅族 meizu miniplayer 4G闪存MP3 [详细内容]
  • 诺基亚3108节约内存的技巧 [详细内容]
  • 关于大家关心的待机问题 [详细内容]
  • 不过299元10款廉价高性价比MP3选购纽曼 精音王N08 512M选购指南 [详细内容]
  • 《罗马:全面战争》操作技巧 [详细内容]
  • 现买现卖:老菜鸟与新菜鸟略话小I的蓝牙使用 [详细内容]
  • 项上致命心动 海尔MAF-N30仅299元行情速递 [详细内容]
  • 网友回答:
    网友:cuizm

    那得用api函数了!!

    网友:liul17

    const   spi_getworkarea   =   48  
      private   declare   function   systemparametersinfo   lib   "user32"   alias   "systemparametersinfoa"   (byval   uaction   as   long,   byval   uparam   as   long,   lpvparam   as   any,   byval   fuwinini   as   long)   as   long  
      private   declare   function   lstrcpy   lib   "kernel32"   alias   "lstrcpya"   (lpstring1   as   any,   lpstring2   as   any)   as   long  
      const   cchdevicename   =   32  
      const   cchformname   =   32  
      const   dm_pelswidth   =   &h80000  
      const   dm_pelsheight   =   &h100000  
      const   dm_bitsperpel   =   &h40000  
       
      private   type   winmode  
              dmdevicename   as   string   *   cchdevicename  
              dmspecversion   as   integer  
              dmdriverversion   as   integer  
              dmsize   as   integer  
              dmdriverextra   as   integer  
              dmfields   as   long  
              dmorientation   as   integer  
              dmpapersize   as   integer  
              dmpaperlength   as   integer  
              dmpaperwidth   as   integer  
              dmscale   as   integer  
              dmcopies   as   integer  
              dmdefaultsource   as   integer  
              dmprintquality   as   integer  
              dmcolor   as   integer  
              dmduplex   as   integer  
              dmyresolution   as   integer  
              dmttoption   as   integer  
              dmcollate   as   integer  
              dmformname   as   string   *   cchformname  
              dmunusedpadding   as   integer  
              dmbitsperpel   as   integer  
              dmpelswidth   as   long  
              dmpelsheight   as   long  
              dmdisplayflags   as   long  
              dmdisplayfrequency   as   long  
      end   type  
      private   declare   function   changedisplaysettings   lib   "user32"   alias   "changedisplaysettingsa"   (byval   lpwinmode   as   long,   byval   dwflags   as   long)   as   long  
       
      public   function   setdisplaymode(width   as   integer,   height   as   integer,   color   as   integer)   as   long  
              dim   newwinmode   as   winmode  
              dim   p   as   long  
              with   newwinmode  
                      .dmsize   =   122  
                      if   color   =   -1   then  
                              .dmfields   =   dm_pelswidth   or   dm_pelsheight  
                      else  
                              .dmfields   =   dm_pelswidth   or   _  
                              dm_pelsheight   or   dm_bitsperpel  
                      end   if  
                      .dmpelswidth   =   width  
                      .dmpelsheight   =   height  
                       
                      if   color   <>   -1   then  
                              .dmbitsperpel   =   color  
                      end   if  
              end   with  
              p   =   lstrcpy(newwinmode,   newwinmode)  
              setdisplaymode   =   changedisplaysettings(p,   0)  
      end   function  
     

    .

    讨论区

    Login