|
|
while(sleep(0)
{
} solves all
[ It is possible to represent everything in this universe by using 0 and 1 ]
|
|
|
|
|
If the thread has noting to do, you are better of putting into a wait state and using an Event to get it going again.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi,
I created a dialog with the mfc app creator, then created a non modal dialog from within that dialog class with the extended style WS_EX_APPWINDOW applied on the initdialog like hmmm...
ModifyStyleEx(0, WS_EX_APPWINDOW);
This gives me a taskbar space for the new non-modal window.
BUT, when I minimize the main modal app dialog, it also minimizes the non-modal window. I tried catching the window messages to the non-modal with pretranslate message, but there is no message when it's minimized, or when it's restored. No WM_SIZE or nothing.
It's almost like MFC magic. I'm guessing this is some kind of wierd undocumented message mapping we can't see in the source SRC files???
So, how do i stop MFC from taking control of non-modal dialogs with the main dialog window in a dialog based app?
PS- I also tried setting the parent to null, but it did nothing.
hey
|
|
|
|
|
alternatively, does anybody out there have a doc with the internal message mapping of MFC dialogs i could take a look at?
I can't get why it doesn't so much as send a message to the 2nd dialog when it's magically minimized and the taskbar space is removed. It seems wrong.
hey
|
|
|
|
|
|
Try settings the parent to the desktop window, this should fix it
use GetDesktopWindow();
Ralph Varjabedian
Software Engineer
|
|
|
|
|
ModifyStyleEx(0, WS_EX_APPWINDOW);
SetParent(GetDesktopWindow());
Tried it this way in the non-modal initdialog.
No Go Senior! Thanks for the suggestion, but I knew it wasn't going to work because i had previously tried setting it to NULL.
The maindlg window of my dlg app is still minimizing it and removing the taskbar spot on minimization. And all the while sending No messages to the WndProc of the modeless dialog.
I have a feeling that this is some powerful MFC voodoo that can only be resolved deep within the cavernous realms of the microsoft building.
In other words unless somebody just knows, i don't know if it can be "figured out", since it's depriving any Wnd after the initial dialog of any type of messages about the altered window state
hey
|
|
|
|
|
Hi, I'm trying to create a dialogbox that popsup when a certan timer has run out. But, I want my dialog to be ontop of every window, and it should even popup when one is playing a Direct3D or OpenGL game. The problem i'm facing is when the window showsup, the game minimizes or the game loses keyboard focus. I think it's because the Window gains focus, so I was wondering, is there anyway to stop the window from getting focus?
thank you very much
|
|
|
|
|
hello
i want to create a slider but i meet a problem with const RECT& rect ,i have declared it at follow
<br />
<br />
typedef struct _RECT { <br />
LONG left; <br />
LONG top; <br />
LONG right; <br />
LONG bottom; <br />
} RECT; <br />
RECT Slider_position;<br />
<br />
Create( isible | TBS_ENABLESELRANGE,Slider_position, this, 1 );<br />
and it give this message error:
error C2664: 'Create' : cannot convert parameter 2 from 'struct CMainFrame::OnCreate::RECT' to 'const struct tagRECT &'
|
|
|
|
|
You don't need to redefine the RECT struct. Remove that definition and you should be all set.
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
there s already a RECT structure by windows, i suspect u just redefine that, just try to put another name.
[ It is possible to represent everything in this universe by using 0 and 1 ]
|
|
|
|
|
I've been studying the way Server.HTMLEncode works in ASP. Apparently, it encodes the ASCII characters differently depending on the codepage used. Thus, the ASCII char 210 (0xD2) is encoded as- Ê ( Ê ) using codepage 850 (OEM - Multilingual Latin I),
- Ď ( Ď ) using codepage 852 (OEM - Latin II),
- Φ ( Φ ) using codepage 869 (OEM - Modern Greek),
- ز ( ز ) using codepage 1256 (ANSI - Arabic)
etc. My (first) question is: how does Server.HTMLEncode do that? Does it use MultiByteToWideChar or what? Is there an API function that does anything remotely similar to this? I haven't found it and honestly don't quite know where to look.
An my second question: I know I can use _setmbcp( ) to change the current codepage. Is it possible to do this on a per-tread basis - similar to ::SetTreadLocale( ) can change the LCID of the current thread?
Home someone (Read: Mike Dunn) can help me ...
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
Hello.
Are this all features those makes differentiated between Visual C++ 6.0 Standard and Visual C++ 6.0 Professional? Or are there still more differences?
- OLE DB Templates (new)
- Code optimization
- Profiler
- Static linking to the MFC Library
- Databound controls (RemoteData)
- InstallShield
- Custom AppWizard
- Visual Database Tools
|
|
|
|
|
Hi, everyone!
Suppose class foo have a member variable named "array" whose type is
an integer array. I wondered when the memory space of the array is allocated?
In my opinion, when creating an object of a class, the only action to do
is in ctor. Since the ctor does not allocate the space obviously, it really
puzzled me. Can anyone help?
Another question is, is it a correct way to initialize the array in ctor?
Any better solutions?
I have tried in my example that following statement results an error in VC 6.0.
--------
int array [100] = {1};
--------
So I wonder which is the best way to initialize the value of the array object.
Source Code:
--------
#include <iostream>
using namespace std;
class foo {
private:
int array [100];
public:
foo()
{
array [0] = 1;
}
void Dump()
{
cout << array [0] << endl;
}
};
int main()
{
foo f;
f.Dump(); //output is 1
return 1;
}
--------
Thanks in advance,
George
|
|
|
|
|
It is the constructor that will allocate memory.
However, you cannot initialize any member variable (array or otherwise) during declaration- you have to do it in a construcor.
AFAIK, your code is the only way to do it. Just out of curiosity, why do you want to do it otherwise- do you find this method awkward or something?
Vikram.
-----------------------------
My site due for a massive update
1. Don't ask unnecessary questions. You know what I mean?
2. Avoid redundancy at all costs.
3. Avoid redundancy at all costs.
"Do not give redundant error messages again and again." - A classmate of mine, while giving a class talk on error detection in compiler design.
|
|
|
|
|
Thanks, Vikram buddy!
As you said in your reply, "It is the constructor
that will allocate memory.", but I think in the ctor there
does not exist a statement which allocate the space for my
array. Can you show me the answer?
regards,
George
|
|
|
|
|
No, what I meant was that the constructor call and allocation of memory for the object go hand in hand.
You do not allocate space for the array explicitly. If you want to, you can- using a pointer. Like this:
class foo
{
int *p;//Pointer, but can be considered "array"
public:
foo()
{p=new int[1];}
};
Now you're ready to instantiate foo.
Hope this helps.
Any good book on C++ should be able to help you further. Try Schildt or Lafore. Even Bruce Eckel.
Vikram.
-----------------------------
My site due for a massive update
1. Don't ask unnecessary questions. You know what I mean?
2. Avoid redundancy at all costs.
3. Avoid redundancy at all costs.
"Do not give redundant error messages again and again." - A classmate of mine, while giving a class talk on error detection in compiler design.
|
|
|
|
|
Thanks, Vikram buddy!
Have you ever read Tim's reply. I think he is correct. Which means
the ctor does not do memory allocation in my case.
Do you agree with him ( her ) ?
regards,
George
|
|
|
|
|
Say you have a class
class abc
{
private:
char a[100];
} As you would expect, when a new instance is created using new, 100 bytes of memory have to be allocated.
You write
abc* p = new abc();
which can also be written as:
void* px = malloc(sizeof(abc));
abc* p = new (px) abc();
So, the new allocates memory and then calls the constructor to initialize the class. In the second case, we explicitly allocate the memory and ask new to use the allocated memory to place the class.
The placement parameter in new is optional; but it decides whether malloc will be called, or the user already allocated memory.
Thomas
My article on a reference-counted smart pointer that supports polymorphic objects and raw pointers
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Thanks, Thomas buddy!
You just covered the case of allocation on heap. But what about
the case of allocation on stack? Can you also show me an example?
(Since allocation on stack does not use "new" operator.)
regards,
George
|
|
|
|
|
|
In your example, the declaration of the variable or the usage of the "new" keyword will allocate the space for the variable. The ctor doesn't have anything to do with the allocation.
foo f; // allocates the variable on the stack
foo *pf = new foo; // allocates the variable in the heap
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Thanks, Tim buddy!
regards,
George
|
|
|
|
|
hi.
i had create a custom control and place it on my dialog based application.
may i noe:
(1) how can i remove that custom control during run-time (that is, after the dialog based application had shown up and drawn the custom control on itself).
(2) how can i disable message x received by that custom control during run-time. (initially, message x can be received and responded by custom control by specified in BEGIN_MESSAGE_MAP block)
thank you.
regards
yccheok
|
|
|
|