|
Hi,
How do I initilaize an array whose size will be determined by an user input(For example from a edit box ?
I tried this but they didnt work...
numsamples = m_numsamp;
const long arr = numsamples;
ULONG x[arr];
ULONG y[arr];
They returned error 2057 and 2466.
Thanks!
Deepak Samuel.
|
|
|
|
|
You need to dynamically allocate your array. This is where pointers comes very handy!
ULONG* arrA = NULL;
int nSize;
<font color=green>
..
<font color=green>
arrA = new ULONG[nSize];
if(NULL != arrA)
{
<font color=green>
arrA[0] = 1234;
cout << _T("yeah baby!") << arrA[0] << endl;
<font color=green>
delete [] arrA;
{
I Dream of Absolute Zero
|
|
|
|
|
Hello,
Does anybody know if you can 'disable' the beep when calling an AfxMessageBox? This is quite annoying.
tnx!!
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
I don't think you can switch it off programmatically from the ::MessageBox() function.
Have a look in your Control Panel, under 'Sounds, Speech, and Audio Devices'. You can control the WAV associated with a windows event, including the message box sound(Default Beep). You can even choose to switch it off from there.
I Dream of Absolute Zero
|
|
|
|
|
I have an application which starts another application, but I dont need to see the dialog window of this other program. The user can maximise it if required.
I have tried the following to hide the dialog window in the program:-
this->OnShowWindow (FALSE, 0);
<br />
and this->ShowWindow (SW_HIDE);
but the dialog wind is still visable.
I start the program via CreateProcess (see below):-
::ZeroMemory(&si[0], sizeofsi[0])); <br />
GetStartupInfo(&si[0]);<br />
si[0].dwX = 0;<br />
si[0].dwY = 0;<br />
si[0].dwFlags = STARTF_USEPOSITION;<br />
CreateProcess( NULL, <br />
"c:\\Program Files\\Joystick\\MSCPP.exe",
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si[0],
&pi[0]);
Any comments please as I am sure a simple solution exists.
|
|
|
|
|
Just change your startup information:
sweep123 wrote:
si[0].dwFlags = STARTF_USEPOSITION;
Try this:
si[0].dwFlags = STARTF_USEPOSITION | STARTF_USESHOWWINDOW;<br />
si[0].wShowWindow = SW_MINIMIZE;
cheers,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proff programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
Thanks, but no luck.
The program window is NOT minimised.
|
|
|
|
|
try ShellExecute
Last parameter set it to SW_HIDE
or ShellExecuteEx
or LoadModule()
gabby
|
|
|
|
|
Does the dialog have a minimise button? If it doesn't, you can't minimise it.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hello...
I need to run an external program, suspend at some offset, retrieve register values(like ebx) and continue running external app.
That is the problem
How do run-time patchers work?
P.S.: Please reply to ths@smtp.ru
Thanks...
|
|
|
|
|
Hi Guys,
I'm sure this is a very easy question, but i'm damned if i can find the answer. I've just started using VS.NET instead of VC6- but still for unmanaged, MFC development.
In VC6, I could very simply use classwizard to create an override of CDialog::OnInitDialog, and have VC6 generate a stub function for me (which called the base class implementation).
How do you do this is Visual C++ .NET ? Surely there must be a way.
Thanks
Jon
#include <beer.h>
|
|
|
|
|
In the class view select the appropriate class that you want to add the handler for. In the properties window, click on the overrides button (little green boxy looking icon). Scroll down to onInitDialog, click in the right hand column, click on the drop down box, select on '<<add>> OnInitDialog', the code should have been added.
You add WM_* event handlers in the same way, except you click on the messages button first.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Wow, thankyou. Bizarrely, i'd not noticed the Overrides and Messages buttons!. I expected there to be either a mechanism for overrides on the Add Method dialog, or maybe something on the context menu you get when right clicking a method in the base class. But no.
Thanks
Jon
#include <beer.h>
|
|
|
|
|
Hi,
Is there a way of sending character keys to other apps (eg Notepad)?
Currently I can get the hwnd for the notepad window, and I can close it down by do ::PostMessage (hwnd, WM_QUIT, 0, 0) . Thus I know I have the correct hwnd. However when I send WM_CHAR no characters appear. Any ideas?
Also, is it possible to post keys that correspond with menu items (eg 'ALT-F' (for file) then 'S' (for save))?
cheers,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proff programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
Hi,
To send file messages use this code:
#define NOTEPAD_FILE_NEW 9
#define NOTEPAD_FILE_OPEN 10
#define NOTEPAD_FILE_SAVE 1
#define NOTEPAD_FILE_SAVEAS 2
::PostMessage(hwnd,WM_COMMAND,NOTEPAD_FILE_OPEN);
To send key message use:
::PostMessage(hwnd,WM_KEYDOWN, 'm', 0);
Ivan Cachicatari
www.latindevelopers.com
|
|
|
|
|
I just encountered this "this" in a sample code. Can anyone explain what it means?.
_param->_this = this;
Is the "this" an operator?
Thanks.
Deepak Samuel
|
|
|
|
|
The this pointer refers to the object in which it is invoked.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
this is the current object instance.
you can do stuff like that...
class CClass
{
int i;
void Method();
}
void CClass::Method()
{
this->i = 1;
i = 1;
}
or if you you want to pass yourself to another class or method :
...
CPaintDC dc(this);
...
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
"this" is introduced so the compiler could make the difference between members of the class and members of another object.
eg. if you would do this:
<br />
public void SetSomeInt(int input){<br />
input = input;<br />
}<br />
then the compiler probably would complain. which one is the parameter and which one is the variable of the class?
if you do this:
<br />
public void SetSomeInt(int input){<br />
this->input = input;<br />
}<br />
it will probably work.
It's just a pointer to the Object itself.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
"this" is introduced so the compiler could make the difference between members of the class and members of another object.
eg. if you would do this:
<br />
public void SetSomeInt(int input){<br />
input = input;<br />
}<br />
then the compiler probably would complain. which one is the parameter and which one is the variable of the class?
if you do this:
<br />
public void SetSomeInt(int input){<br />
this->input = input;<br />
}<br />
it will probably work.
It's just a pointer to the Object itself. (and that's the reason why you can't use it in static functions)
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
I would advise that you *DO NOT* use the same naming convention for local function variables and member variables. It can, and will, always lead to confusion and mistakes.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
Quite true.
Just to have no misunderstandings : "I do not do that" , but the example just explains nicely what 'this' means.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Antony M Kancidrowski wrote:
I would advise that you *DO NOT* use the same naming convention for local function variables and member variables. It can, and will, always lead to confusion and mistakes.
That's why they invented m_
Michael
CP Blog [^]
|
|
|
|
|
you've been having many good answers, so i won't add more about the this pointer you're asking for.
i'd just like to tell you that this is an important part of the C++ language, and you'd so better get a reference of the language to learn about it...
there are many books on the subject, and also the MSDN treats about it.
cheers,
TOXCCT >>> GEII power
|
|
|
|
|
If I use GetSysColour to get a system RGB value, then create a brush using that value and then draw a rectangle, the colour of the rectangle is different?
I'm puzzled by this, under 2000 you can see this all over the place, i.e menu bars. If you get the system colour then you get back the value C3C3C3, if you paint to the screen with this colour you get C6C3C3, you can verify this by reading back the pixel.
I've only noticed this because I'm implementing a VS.NET style gui and I couldn't figure out the luminance values, once I'd realised that the colours are actually different to what you request it all fell into place.
Adrian
|
|
|
|