Sign in to follow this  

[C++]Some questions (please help)

This topic is 4189 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm sorry post this thread here but it is not connected with a game programming. Can sombody help with some problems. 1. I want to handle additional parameters in my application. For example if I write (in cmd.exe) MyApp.exe -a the application do one thing, if I write MyApp.exe -b the application do another thing. 2. I have a problem with a dialogs. I add DS_3DLOOK style but nothing changes. My OS is MS Win XP SP2 and I using MS Visual studio 8.0. Also If I add to a dialog RichEdit Control it fails to show it. PLS Help [help][help][help]

Share this post


Link to post
Share on other sites
Quote:
Original post by Illuminate
1. I want to handle additional parameters in my application. For example if I write (in cmd.exe) MyApp.exe -a the application do one thing, if I write MyApp.exe -b the application do another thing.


Well, the way to do this is to decode the command line. Change your main function so that it looks like:
int main( int argc, char** argv )

When you run your program, the operating system will fill in the arguments argc and argv. argc is the number of command line arguments (including the program name). argv is an array of argc C-strings. In your example, argc will be 2, argv[0] will be "MyApp.exe" and argv[1] will be "-a" or "-b". From this point it is just a matter of testing the value of argv[1] and deciding what to do.

Hope that helps.

[edit]
Sorry about the AP ahead, my connection froze up...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Illuminate
1. I want to handle additional parameters in my application. For example if I write (in cmd.exe) MyApp.exe -a the application do one thing, if I write MyApp.exe -b the application do another thing.


Well, the way to do this is to decode the command line. Change your main function so that it looks like:
int main( int argc, char** argv )
When you run your program, the operating system will fill in the arguments argc and argv. argc is the number of command line arguments (including the program name). argv is an array of argc C-strings. In your example, argc will be 2, argv[0] will be "MyApp.exe" and argv[1] will be "-a" or "-b". From this point it is just a matter of testing the value of argv[1] and deciding what to do.

Hope that helps.

Share this post


Link to post
Share on other sites
OK, I understand. In WinMain lpCmdLine contains "-a" and "-b"
I have just one more question. How can I create a custom look window (for example - window skins in WinAmp where the titlebar is not blue and have different height and width and the "X" button is not red and also have defferent have and width and so on)?

Share this post


Link to post
Share on other sites
To draw stuff in the title bar you need to process the WM_NCPAINT message. Look at MSDN for more information. Also to handle mouse messages for the title bar you need to handle WM_NC* messages.

The reason the richedit control is not showing is because you haven't loaded RICHED32.DLL or RICHED20.DLL into memory.

Share this post


Link to post
Share on other sites
Quote:
Original post by Marcus Speight
To draw stuff in the title bar you need to process the WM_NCPAINT message. Look at MSDN for more information. Also to handle mouse messages for the title bar you need to handle WM_NC* messages.

The reason the richedit control is not showing is because you haven't loaded RICHED32.DLL or RICHED20.DLL into memory.


After install MS Visual Studio it add additional DLL directories, also I added some libraries including RICHED20.DLL in C:\Windows\System32 so it is 100% sure that RICHED32.DLL is loaded in memory! But even now it isn't show RichEdit20A class.

I have a problem loading DLL for Console solution in debug version. I have an mainfest file but it show an error R6034 try to load DLL without mainfest file. In release version it did not show any error!

Share this post


Link to post
Share on other sites
To load the RICHED20.DLL file, you need to call AfxInitRichEdit2() when your application starts up (i.e., just put the call in CMyApp::InitInstance). If you have a dialog box with a rich edit control in it and you omit this call, the dialog's creation will fail - if you specify the "No Fail Create" property for the dialog, the dialog will show up, but the rich edit control won't.

Share this post


Link to post
Share on other sites

This topic is 4189 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this