|
Is this what you are looking for ?
#include < iostream >
using std::cout;
using std::endl;
int main(int argc,char *argv[])
{
cout<<"argc = "<<argc<<endl;
for(int cnt=0;cnt < argc;++cnt)
cout<<"argv "<<cnt+1<<" = "<<argv[cnt]<<endl;
return 0;
}
Click Project->Settings..In Settings click Debug.Make sure your project is selected on the left. Go to Program Arguments and type in say "1 2 3" w/o the quotes. See the output.
From MSDN...
argc
An integer specifying how many arguments are passed to the program from the command line. Because the program name is considered an argument, argc is at least 1.
argv
An array of null-terminated strings.The first string (argv[0]) is the program name, and each following string is an argument passed to the program from the command line. The last pointer (argv[argc]) is NULL.
Atul
Sonork ID : 100.13714 netdiva
|
|
|
|
|
i just want someone to tell me what steps to follow to set the vc++ to read command lines.
here are the kind of instructions i want
i mean something like go to menu bar select " this option" then do this then do that
so that compiler know how to read the command lines without having to go to DOS mode.
i hope i made it clear this time.
|
|
|
|
|
That's what I have given
A small piece of code and settings in VC++ IDE to pass cmd line arguments...
Atul
|
|
|
|
|
I took this code directly from Tom Armstrongs book, Designing and Using ActiveX Controls.
I am trying to implement the 1st example. A COM/MFC Edit control. The code is meant to set the background and forground colors of the activex controls to that of its contanier.
The problem is it makes both color sets black. Any suggestions on how the code should be writen?
LRESULT CEEditCtrl::OnOcmCtlColor(WPARAM wParam, LPARAM lParam)
{
if(m_pBackBrush == NULL)
m_pBackBrush = new CBrush(TranslateColor(GetBackColor()));
CDC* pdc = CDC::FromHandle((HDC)wParam);
pdc->SetBkMode(TRANSPARENT);
pdc->SetBkColor(TranslateColor(GetBackColor()));
pdc->SetTextColor(TranslateColor(GetForeColor()));
HBRUSH far* hbr = (HBRUSH far*)m_pBackBrush->GetSafeHandle();
return (DWORD) hbr;
return NULL;
}
thank you
|
|
|
|
|
How can i compare 2 wav files?Can anyone show me or email me some code? (costexx@hotmail.com)I want to know if it's the same sound.
|
|
|
|
|
Do you want to know if they *sound* the same, or *are* a copy of the same file ?
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
Two entirely different things eh?
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Nish [BusterBoy] wrote:
Two entirely different things eh?
Nish you should move to Canada, your half way there already
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
HockeyDude wrote:
Nish [BusterBoy] wrote:
Two entirely different things eh?
Nish you should move to Canada, your half way there already
To be frank, though I understand that there is humor hidden there somewhere, I cannot find it
Will someone throw a light here please?
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Canadians are fond of saying "eh ?"
Check out the movie "Strange Brew" for amusing examples of stereotypical Canadian speech.
|
|
|
|
|
Rick York wrote:
Canadians are fond of saying "eh ?"
Oh! I dont say "eh" too often, but I do write "eh" sometimes. When I talk I replace "eh" with "huh". I think I have three or even four variations of "huh" according to the need of the situation.
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
That makes you closer to an american than a Canadian.
There are no small projects - only young ones.
|
|
|
|
|
Like CG, i dunno if you want binary comparison or I guess mathematical if you were checking for sound similarity.
Anywho, if you want binary...why not just use windiff...?
However you probably want sound cuz why would you be specific about wav files and not just generic and say files.
Sounds like the latter would be tricky.
Good luck!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
I've created a modal dialogbox using DialogBox(). The dialog has 2 editboxes and I want the text they contain to somehow be returned to the parent, so I can use them. I thought of using the returnvalue of DialogBox(), which is what I specify when I call EndDialog() from within the dialogbox procedure, and let it point so some structure with 2 strings. But is this the correct approach? I also do not want to use global variables.
Any good ideas?
Sprudling
PS! I'm not using MFC; just plain Win32 API stuff...
|
|
|
|
|
1. Make a struct that holds the data (pointers, std::strings, whatever you're using)
2. Use DialogBoxParam() and pass a pointer to that struct as the dwInitParam parameter.
3. In your dialog's window proc, the lParam sent with WM_INITDIALOG is that pointer. Save it with SetWindowLong(hwndDlg, DWL_USER, lParam);
4. Whenever you need to access that pointer again, use GetWindowLong().
--Mike--
#include "witty-sig.h"
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Just add 2 strings to your dialog box class. Either make them public or write accessor functions. After DoModal returns your dialog object is still valid and you get the values via dlg.GetValue1(), dlg.GetValue2().
A vast majority of our imports comes from outside the country.
George W. Bush
|
|
|
|
|
Where do I put the code that should react on pressing enter in a combobox?
The ComboBox is created in MainFrame.
Where should I do the messagemap?
Thanks in advance.
-- Kelthar :: icq9071676 :: http://www.bilbomb.com/ --
|
|
|
|
|
Do it whereever you find the resource id for the combobox in classwizard
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Can anyone tell me what exactly the export definition file is for?? In Visual studio i build this DLL which has a .def file in the workspace and it has two exports defined, everything compiles great. Now when i compile under Mingw i get an error that i dont have a .def file but that one will be created for me, but its got all sorts of functions and weird chars in it and its totally different from the one in VC++. So i tried to just copy the .def file cause its the same DLL and all but then when i try to compile with the .def file in my workspace (Dev-C++) i get some error saying "def file unused since linking not done" or something...
Can someone explain what the .def file is for, and if its even that necessary to include??
Thanks for any help.
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
It has to do with compiler mangling of function names. For example, take the function:
__declspec(dllexport) int __stdcall foo(int a, int b);
The complier mangles the function name into _foo@8 , where 8 is the number of bytes passed as parameters. If you try to link this function with another vendors compiler, it will look for foo (or whatever its compiler might mangle the function name into) instead of _foo@8 , and come to the conclusion that no such function exists in the dll. If you have provided an .def file with the line: "EXPORTS foo", the linker parses the file, and exports foo instead.
I don't know about the additional functions you get (exported from other linked modules?), but you probably need a .def file for the functions you export yourself.
/moliate
|
|
|
|
|
I am making an MFC dialog based application. I need to have edit boxes appear while the program is running. How do i do this?
|
|
|
|
|
Use ShowWindow(SW_SHOW) and ShowWindow(SW_HIDE) to show and hide controls on a dialog.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
Use CreateWindow() or CreateWindowEx() with "EDIT" as classname and with the WS_CHILD windowstyle to create the editbox.
Read about CreateWindowEx here.
Sprudling
|
|
|
|
|
Add CEdit member variables to your dialog class and call Create on them when you want to.
Nish
Nish was here, now Nish has gone;
He left his soul, to turn you on;
Those who knew Nish, knew him well;
Those who didn't, can go to hell.
I like to on the Code Project
Sonork ID 100.9786 voidmain
www.busterboy.org
|
|
|
|
|
Poor bloke. He got three equally accurate, but totally different, answers...
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|