Jump to content

Call for ProjectWizard Template code


Roland
 Share

Recommended Posts

 

 

 

Your LEO, Framework, c++ example complies with an error

 

1>.\Kattemaksu.cpp(13) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [29]' to 'LPCWSTR'
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>.\Kattemaksu.cpp(22) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [29]' to 'LPCWSTR'
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

AMD Phenom II x6 1100T - 16GB RAM - ATI 5870 HD - OCZ Vertex 2 60GB SSD

76561197984667096.png

Link to comment
Share on other sites

Your LEO, Framework, c++ example complies with an error

 

1>.\Kattemaksu.cpp(13) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [29]' to 'LPCWSTR'
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>.\Kattemaksu.cpp(22) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [29]' to 'LPCWSTR'
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

 

I have noticed that also.

Its fixed in my templates

 

#include "leo.h"
using namespace LEO ;

#if defined( _WINDOWS )
void ErrOut( const char* pstrMessage ) { MessageBoxA(0, pstrMessage, "Error", 0 ); }
int WINAPI WinMain( HINSTANCE hInstance,
					HINSTANCE hPrevInstance,
					LPSTR lpCmdLine,
					int nShowCmd ) 
#else
void ErrOut( const std::string& message ) { puts( message.c_str()); }
int main( int argn, char* argv[] )
#endif
{
   // Set graphics mode        
Engine engine("Example - LEO with Framework",1024,768);        
if( !engine.IsValid() )        
{                
	ErrOut( "Failed to set graphics mode.");
	return 1;        
}        

// Create framework object and set it to a global object so other scripts can access it        
Framework fw;        
fw.Create();                
if( NULL == fw )        
{               
	ErrOut( "Failed to initialize engine." );
	return 1;        
}        

// Set Lua framework object        
engine.SetObject( "fw", fw );                

// Set Lua framework variable        
Lua lua;        
lua.Create();        
lua.PushObject( fw );        
lua.SetGlobal( "fw" );        
lua.Pop( 1 );        

// Get framework main camera        
fw.main.camera.SetPosition( Vec3(0,0,-2) );        

Material material( "abstract::cobblestones.mat" );        
Cube mesh( CREATENOW );        
mesh.Paint( material );        

Cube ground( CREATENOW );        
ground.Scale( Vec3(10,1,10) );        
ground.SetPosition( Vec3(0,-2,0) );        
ground.Paint( material );        

DirectionalLight light( CREATENOW );        
light.SetRotation( Vec3(45) );        

while( !engine.IsTerminated() )        
{                
	mesh.Turn( Vec3( AppSpeed()*0.5f ) );                        
	fw.Update();                
	fw.Render();                
	engine.Flip( 0 );        
}                

return engine.Free();
}

Roland Strålberg
Website: https://rstralberg.com

Link to comment
Share on other sites

I think a better way to fix the MessageBox problem is to set character set: "not set" in the project properties.

Else you run into the same problem with all other Windows functions too.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

I think a better way to fix the MessageBox problem is to set character set: "not set" in the project properties.

Else you run into the same problem with all other Windows functions too.

 

Yes. Thats will have same effect as MessageBoxA.

So my the sample will then use MessageBox for Windows (compiled non-unicode)

and puts for Console (I might in fact use std::cerr instead).

Roland Strålberg
Website: https://rstralberg.com

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...