create_temp.cpp

本文介绍了一个简单的Windows应用程序实例,包括窗口类注册、消息处理和临时文件创建等关键步骤。该程序根据Windows版本的不同采取了不同的注册方式,并实现了基本的窗口创建与销毁流程。

  name="google_ads_frame" marginwidth="0" marginheight="0" src="http://pagead2.googlesyndication.com/pagead/ads?client=ca-pub-5572165936844014&dt=1194442938015&lmt=1194190197&format=336x280_as&output=html&correlator=1194442937843&url=file%3A%2F%2F%2FC%3A%2FDocuments%2520and%2520Settings%2Flhh1%2F%E6%A1%8C%E9%9D%A2%2FCLanguage.htm&color_bg=FFFFFF&color_text=000000&color_link=000000&color_url=FFFFFF&color_border=FFFFFF&ad_type=text&ga_vid=583001034.1194442938&ga_sid=1194442938&ga_hid=1942779085&flash=9&u_h=768&u_w=1024&u_ah=740&u_aw=1024&u_cd=32&u_tz=480&u_java=true" frameborder="0" width="336" scrolling="no" height="280" allowtransparency="allowtransparency"> 
#include <windows.h> 
#include "Create_Temp.h"


#if defined (WIN32)
 #define IS_WIN32 TRUE
#else
 #define IS_WIN32 FALSE
#endif

#define IS_NT      IS_WIN32 && (BOOL)(GetVersion() < 0x80000000)
#define IS_WIN32S  IS_WIN32 && (BOOL)(!(IS_NT) && (LOBYTE(LOWORD(GetVersion()))<4))
#define IS_WIN95   (BOOL)(!(IS_NT) && !(IS_WIN32S)) && IS_WIN32

HINSTANCE hInst;   // current instance

LPCTSTR lpszAppName  = "MyApp";
LPCTSTR lpszTitle    = "My Application";

BOOL RegisterWin95( CONST WNDCLASS* lpwc );

int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
                      LPTSTR lpCmdLine, int nCmdShow)
{
   MSG      msg;
   HWND     hWnd;
   WNDCLASS wc;

   // Register the main application window class.
   //............................................
   wc.style         = CS_HREDRAW | CS_VREDRAW;
   wc.lpfnWndProc   = (WNDPROC)WndProc;      
   wc.cbClsExtra    = 0;                     
   wc.cbWndExtra    = 0;                     
   wc.hInstance     = hInstance;             
   wc.hIcon         = LoadIcon( hInstance, lpszAppName );
   wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
   wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
   wc.lpszMenuName  = lpszAppName;             
   wc.lpszClassName = lpszAppName;             

   if ( IS_WIN95 )
   {
      if ( !RegisterWin95( &wc ) )
         return( FALSE );
   }
   else if ( !RegisterClass( &wc ) )
      return( FALSE );

   hInst = hInstance;

   // Create the main application window.
   //....................................
   hWnd = CreateWindow( lpszAppName,
                        lpszTitle,   
                        WS_OVERLAPPEDWINDOW,
                        CW_USEDEFAULT, 0,
                        CW_USEDEFAULT, 0, 
                        NULL,             
                        NULL,             
                        hInstance,        
                        NULL              
                      );

   if ( !hWnd )
      return( FALSE );

   ShowWindow( hWnd, nCmdShow );
   UpdateWindow( hWnd );        

   while( GetMessage( &msg, NULL, 0, 0) )  
   {
      TranslateMessage( &msg );
      DispatchMessage( &msg ); 
   }

   return( msg.wParam );
}


BOOL RegisterWin95( CONST WNDCLASS* lpwc )
{
   WNDCLASSEX wcex;

   wcex.style         = lpwc->style;
   wcex.lpfnWndProc   = lpwc->lpfnWndProc;
   wcex.cbClsExtra    = lpwc->cbClsExtra;
   wcex.cbWndExtra    = lpwc->cbWndExtra;
   wcex.hInstance     = lpwc->hInstance;
   wcex.hIcon         = lpwc->hIcon;
   wcex.hCursor       = lpwc->hCursor;
   wcex.hbrBackground = lpwc->hbrBackground;
   wcex.lpszMenuName  = lpwc->lpszMenuName;
   wcex.lpszClassName = lpwc->lpszClassName;

   // Added elements for Windows 95.
   //...............................
   wcex.cbSize = sizeof(WNDCLASSEX);
   wcex.hIconSm = LoadImage(wcex.hInstance, lpwc->lpszClassName,
                            IMAGE_ICON, 16, 16,
                            LR_DEFAULTCOLOR );
   
   return RegisterClassEx( &wcex );
}

LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
static HANDLE hFile;
static char   szTmpFile[MAX_PATH+1];

   switch( uMsg )
   {
      case WM_CREATE  :
              {
                 char szTmpPath[MAX_PATH+1];

                 // Get the temporary path and file name.
                 //......................................
                 GetTempPath( MAX_PATH, szTmpPath );
                 GetTempFileName( szTmpPath, "GEN", 0, szTmpFile );

                 // Create the new temporary file and open it.
                 //...........................................
                 hFile = CreateFile( szTmpFile, GENERIC_READ | GENERIC_WRITE,
                                     0, NULL, OPEN_ALWAYS,
                                     FILE_ATTRIBUTE_TEMPORARY, NULL );
              }
              break;  
               
      case WM_COMMAND :
              switch( LOWORD( wParam ) )
              {
                 case IDM_TEST :
                        break;

                 case IDM_ABOUT :
                        DialogBox( hInst, "AboutBox", hWnd, (DLGPROC)About );
                        break;

                 case IDM_EXIT :
                        DestroyWindow( hWnd );
                        break;
              }
              break;
     
      case WM_DESTROY :
              // If the file was created, delete it.
              //....................................
              if ( hFile )
              {
                 CloseHandle( hFile );
                 DeleteFile( szTmpFile );
              }

              PostQuitMessage(0);
              break;

      default :
            return( DefWindowProc( hWnd, uMsg, wParam, lParam ) );
   }

   return( 0L );
}


LRESULT CALLBACK About( HWND hDlg,          
                        UINT message,       
                        WPARAM wParam,      
                        LPARAM lParam)
{
   switch (message)
   {
       case WM_INITDIALOG:
               return (RUE);

       case WM_COMMAND:                             
               if (   LOWORD(wParam) == IDOK        
                   || LOWORD(wParam) == IDCANCEL)   
               {
                       EndDialog(hDlg, TRUE);       
                       return (TRUE);
               }
               break;
   }

   return (FALSE);
}

1g++ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -pthread -shared -B /home/zzh/anaconda3/envs/sghr6/compiler_compat -L/home/zzh/anaconda3/envs/sghr6/lib -Wl,-rpath=/home/zzh/anaconda3/envs/sghr6/lib -Wl,--no-as-needed -Wl,--sysroot=/ /home/zzh/framework2/SecondFeature/GeoFeature/build/temp.linux-x86_64-cpython-38/extensions/cpu/grid_subsampling/grid_subsampling.o /home/zzh/framework2/SecondFeature/GeoFeature/build/temp.linux-x86_64-cpython-38/extensions/cpu/grid_subsampling/grid_subsampling_cpu.o /home/zzh/framework2/SecondFeature/GeoFeature/build/temp.linux-x86_64-cpython-38/extensions/cpu/radius_neighbors/radius_neighbors.o /home/zzh/framework2/SecondFeature/GeoFeature/build/temp.linux-x86_64-cpython-38/extensions/cpu/radius_neighbors/radius_neighbors_cpu.o /home/zzh/framework2/SecondFeature/GeoFeature/build/temp.linux-x86_64-cpython-38/extensions/pybind.o -L/home/zzh/anaconda3/envs/sghr6/lib/python3.8/site-packages/torch/lib -L/usr/local/cuda-11.1/lib64 -lc10 -ltorch -ltorch_cpu -ltorch_python -lcudart -lc10_cuda -ltorch_cuda -o build/lib.linux-x86_64-cpython-38/GeoFeature/ext.cpython-38-x86_64-linux-gnu.so copying build/lib.linux-x86_64-cpython-38/GeoFeature/ext.cpython-38-x86_64-linux-gnu.so -> GeoFeature error: could not create 'GeoFeature/ext.cpython-38-x86_64-linux-gnu.so': No such file or directory setup( name='GeoFeature', version='1.0.0', ext_modules=[ CUDAExtension( name='GeoFeature.ext', sources=[ 'extensions/cpu/grid_subsampling/grid_subsampling.cpp', 'extensions/cpu/grid_subsampling/grid_subsampling_cpu.cpp', 'extensions/cpu/radius_neighbors/radius_neighbors.cpp', 'extensions/cpu/radius_neighbors/radius_neighbors_cpu.cpp', 'extensions/pybind.cpp', ], # 确保这里使用了正确的路径 build_l(setup源码),setup实在GeoFeature文件夹下的怎么解决
03-24
units real atom_style full boundary p p s timestep 1 neighbor 2.0 bin neigh_modify every 1 delay 0 check yes read_data NiCr-H2O-O2.data mass 3 58.69 # Ni mass 4 51.96 # Cr mass 1 16.00 # O mass 2 1.008 # H group Ni type 3 group Cr type 4 group O type 1 group H type 2 group alloy union Ni Cr group steam union O H group all union alloy steam pair_style reaxff NULL pair_coeff * * ffield.reax.CHOFeAlNiCuSCr O H Ni Cr velocity all create 300.0 98797 fix 1 all qeq/reax 1 0.0 10.0 1.0e-6 reaxff minimize 1.0e-4 1.0e-6 1000 10000 fix 2 all nvt temp 300 300 100.0 dump 2 all custom 100 relax.dump id type x y z dump_modify 2 element O H Ni Cr thermo 100 thermo_style custom step temp pe ke etotal press run 50000 1 by 1 by 1 MPI processor grid reading bonds ... 300 bonds reading angles ... 100 angles Finding 1-2 1-3 1-4 neighbors ... special bond factors lj: 0 0 0 special bond factors coul: 0 0 0 2 = max # of 1-2 neighbors 1 = max # of 1-3 neighbors 1 = max # of 1-4 neighbors 2 = max # of special neighbors special bonds CPU = 0.001 seconds read_data CPU = 0.023 seconds 2042 atoms in group Ni 874 atoms in group Cr 300 atoms in group O 200 atoms in group H 2916 atoms in group alloy 500 atoms in group steam 3416 atoms in group all WARNING: Changed valency_val to valency_boc for X (src/REAXFF/reaxff_ffield.cpp:300) CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE Your simulation uses code contributions which should be cited: - pair reaxff command: doi:10.1016/j.parco.2011.08.005 - fix qeq/reaxff command: doi:10.1016/j.parco.2011.08.005 The log file lists these citations in BibTeX format. CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE-CITE WARNING: Using a manybody potential with bonds/angles/dihedrals and special_bond exclusions (src/pair.cpp:244) WARNING: Bonds are defined but no bond style is set (src/force.cpp:197) WARNING: Likewise 1-2 special neighbor interactions != 1.0 (src/force.cpp:199) WARNING: Angles are defined but no angle style is set (src/force.cpp:202) WARNING: Likewise 1-3 special neighbor interactions != 1.0 (src/force.cpp:204) No /omp style for force computation currently active Neighbor list info ... update: every = 1 steps, delay = 0 steps, check = yes max neighbors/atom: 2000, page size: 100000 master list distance cutoff = 12 ghost atom cutoff = 12 binsize = 6, bins = 5 5 12 2 neighbor lists, perpetual/occasional/extra = 2 0 0 (1) pair reaxff, perpetual attributes: half, newton off, ghost, omp pair build: half/bin/newtoff/ghost/omp stencil: full/ghost/bin/3d bin: standard (2) fix qeq/reax, perpetual, copy from (1) attributes: half, newton off pair build: copy stencil: none bin: none Setting up cg style minimization ... Unit style : real Current step : 0 WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 0 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 0 (src/REAXFF/fix_qeq_reaxff.cpp:798) Per MPI rank memory allocation (min/avg/max) = 518.3 | 518.3 | 518.3 Mbytes Step Temp E_pair E_mol TotEng Press Volume 0 300 279680.55 0 282734.39 491600.17 63408.327 WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 1 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 1 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 2 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 2 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 2 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 2 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 2 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 2 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 3 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 3 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 3 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 3 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 4 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 4 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 4 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 4 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 4 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 4 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 5 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 5 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 5 (src/REAXFF/fix_qeq_reaxff.cpp:798) WARNING: Fix qeq/reaxff CG convergence failed after 200 iterations at step 5 (src/REAXFF/fix_qeq_reaxff.cpp:798) write_data relax_final.data上述程序出现错误
最新发布
12-02
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值