|
it looks that is not working. i tried that but it doesn't respond.
i working on it tonight maybe be solved;
good luck
|
|
|
|
|
Cheers erfi
Let me know if you get anything.
Still reading up on it myself.
I really hate this darn machine;
I wish that they would sell it.
It won't do what I want it to,
but only what I tell it.
~Author Unknown
|
|
|
|
|
Basically, you want a central loop which calls these functions as you select options, then each time the main loop will display the menu again when your other code is done. I'm assuming this is a console program ? Someone else gave you code which assumed otherwise, BTW.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi christrian
yes i am working with a console program, i have wrote my first console app after starting with c++ last week, it generally invovled loops, file I/O, conditional processing. all the basic stuff really.
now i am trying a small project( well not that small for me as i am running into some difficulties ) based on the hangman game principles.
i am trying to break the program into various sections ( to make it easier for me to code )that involve areas such as the main menu, instructions, top scores and the game itself but am just having difficulties in linking one section to another when needed on menu choices input from the user. those such as going from instructions page back to main menu and then to the game itself etc... as user enters choices.
just finding this concept difficult to understand and wanted a general idea how to get started with it.
not too sure what you mean by central loops.
any ideas on the matter ??? would be greatful for some clarification as web searches not proving too good.
thanks in advance for any info !!!!
I really hate this darn machine;
I wish that they would sell it.
It won't do what I want it to,
but only what I tell it.
~Author Unknown
|
|
|
|
|
OK, I'm thinking something like this:
int main()
{
bool stop= false;
while(!stop)
{
//show menu
int choice;
cin >> choice;
switch(choice)
{
case 1:
ShowInstructions();
break;
case 2:
StartGame();
break;
case 1:
ShowScores();
break;
case 1:
stop= true;;
break;
}
}
}
Then you write functions to call to do the rest, the StartGame function would obviously have it's own loops and functions that IT calls.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
ahhh ok
so you just name each of the blocks of code with a "example ()" and then use that whenever you wish to return to that block of code.
ok will give that a try and see what happens. i tried something similar earlier today but was naming each of the sections of the code with eg: " int instruct_game () " as i was following the same rule as " int main () ".
so if i just use " instruct_game () " should that work ok ?????
thanks for your help christian, much appreciated
I really hate this darn machine;
I wish that they would sell it.
It won't do what I want it to,
but only what I tell it.
~Author Unknown
|
|
|
|
|
Your methods do not need to return anything, they can return void ( which means, they don't return anything ). shouldn't matter, just don't return anything if you don't need to.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Hi,
I am recording a .wav file using the headphones.The file gets saved but i get a clicking sound which is consistent along the the recorded voice.The Clicking sound starts when the recorded file is open and remains until the file is fully read.
Can any1 tell me how to go about in removing this clicking sound from the .wav file which is created.
I am doing coding using C in the VC++ environment.
Thanks...
Riz
|
|
|
|
|
sir,
I want to apply password to the existing files and folders with the help of my program.Please hekp me how to proceed.It may be a very long distance to accomplish the task .PLease help me .
Thanks and Ragards
Pankaj Garg
|
|
|
|
|
Use winzip. Or, if it's data, use the password as a key to encrypt your data.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I have the current date stored in:
COleDateTime date;
I want to pass this variable to a dialog class. I
I call my dialog class by using:
<br />
CEditDlg dlg(NULL, amount, date);<br />
And in the .h file of this dialog class I have:
<br />
public:<br />
CEditDlg(CWnd* pParent = NULL, CString amount = "", COleDateTime date = ""); <br />
If you look at the above line, COleDateTime date = "" is incorrect and I know its
incorrect. I tried making it COleDateTime date = NULL as well as COleDateTime
date(2006, 1, 1, 0, 0, 0) but nothing I have tried sets up this initial construction. I can make this work by passing a CString, but my big question is,
how can I properly write the standard constructor if Im passing a COleDateTime?
Please, any response any one can give me will be greatly appreciated.
Sincerely,
Danielle Brina
|
|
|
|
|
GDay everyone,
I'm a newbie in C programming.
Please help me if you're interested in.
How can I pass an array of characters in function 1 to function 2 in C.
Thanks in advance.
eric
|
|
|
|
|
eric_tran wrote: How can I pass an array of characters in function 1 to function 2 in C.
function2(char* array)
function1()
{
char arr[]="test";
function2(arr);
}
|
|
|
|
|
GDay everyone,
Well, I tried it but. It does not work.
Here is my code.
How can I fix my code(below) to output the buffer msg_cat in function A from function B ?
Please help if you're interested in.
I'd appreciate it.
void A(){
char *msg;
char msg_cat[100] = "";
msg = (char *)recvfromDST (&read_EP, sockMulti);
strcat(msg_cat, msg);
strcat(msg_cat, "\n");
}
void B(){
if (strncmp(KB_buff, "display", 7) == 0){
}
}
eric
|
|
|
|
|
eric_tran wrote: if (strncmp(KB_buff, "display", 7) == 0){ //output to screen here }
You want buffer from function A here ? Is it?
then make function A look like this,
char* A()
{
char *msg;
char* msg_cat= new char[100];
memset(cat,0,100)
msg = (char *)recvfromDST (&read_EP, sockMulti);
strcat(msg_cat, msg);
strcat(msg_cat, "\n");
return cat;
}
function B would be like this,
void B()
{
if (strncmp(KB_buff, "display", 7) == 0)
{
call A here, and delete pointer returned after use.
}
}
|
|
|
|
|
[EDITTED]
Got the answer in MSDN forum. It turns out I had a large global array, which I had defined earlier to test something and had forgotten about it! ah...bad programming practice!;P
[/EDITTED]
Hi,
I have a relatively small Visual C++ project using MFC which allocates
unusually hight amount of virtual memory as soon as the program
starts(roughly 280MB), even before hitting the internal MFC stuff. When I
debug them program in Visual Studio 2005 with a breakpoint at the beginning
of int _tmainCRTStartup(void) function in crt0.c Windows Task Manager shows
the following information:
Memory Usage: 5,620K
Peak Memory Usuage: 5,620K
Page Faults: 1,420
VM Size: 282,360 K
Paged Pool: 632K
NP Pool: 2K
Handles: 102
Threads: 1
GDI Object: 6
Running the program in release mode produces the same result. Also,
compiler/linker settings are almost set to default.
My question why the program allocates so much VM, before even its started
WinMain() function? Is it a Windows issue or Visual C++?
Any help appreciated!
- Rob
-- modified at 23:30 Saturday 16th September, 2006
|
|
|
|
|
This is neither a windows or VC++ issue since it's not normal for a "plain" app unless you are using extensive DLLs especially from third party.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I am only using one thirdparty DLL coded by myself. SO I will have to investigate that.
Thanks for the lead.
|
|
|
|
|
Hello,
i want to make my edit boxes and labels transparent to show my own bitmap;
can somene help me?
|
|
|
|
|
fx9200 wrote: i want to make my edit boxes and labels transparent to show my own bitmap;
Override the OnCtlColor method:
Ex:
if(pWnd->GetDlgCtrlID()==)
{
COLORREF clrStruct=RGB();
hbr = CreateSolidBrush(clrStruct);
pDC->SetBkColor(clrStruct);
pDC->SetTextColor(RGB(0,0,0));
}
You can do something like this.
Try this....
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I didn't find that method
it ssems it cannot be added by class wizard !
|
|
|
|
|
fx9200 wrote: I didn't find that method
What version of editor are you using. VS6.0 / VS .NET 2003 or something else.
fx9200 wrote: it ssems it cannot be added by class wizard !
You can also add the code with your hands
In the header file
HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
In the .cpp file
HBRUSH CadfDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// Add your code here
return hbr;
}
In Message map of your class
ON_WM_CTLCOLOR()
But avoid doing so...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
thanks,
it worked;
but with this i can't set a bitmap as a back round of the edit box;
|
|
|
|
|
HBRUSH CYourDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
CBrush m_Brush;
m_pBrush.CreateStockObject (NULL_BRUSH);
if(pWnd->GetDlgCtrlID()==IDC_STATIC1)
{
pDC->SetBkMode (1);
return (HBRUSH)mBrush;
}
return hbr;
}
I hope that your problem would be solved with this.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
if you use VS2003 you can use from property window for insert WM_CTLCOLOR yto your class.
|
|
|
|