|
But wouldn't that create another window? I have this also in the file, doesn't this create the window?
<br />
class C489guiApp: public CWinApp {<br />
public:<br />
BOOL InitInstance() {<br />
m_pMainWnd = new C489guiFrame;<br />
m_pMainWnd->ShowWindow(SW_SHOW);<br />
m_pMainWnd->UpdateWindow();<br />
<br />
return TRUE;<br />
}<br />
...<br />
}<br />
When I want to set the text, can't I say m_pMainWnd->setStatusBarText(sizeInfo); ? I'm trying that which should be in my derived class but it's not in the little list.
|
|
|
|
|
LighthouseJ wrote:
But wouldn't that create another window?
My intension was to give an example of how to access a non-static member function. Sorry if this was confusing.
OK given the information you have supplied.
The problem is that m_pMainWnd is a pointer to a CWnd object. You need to cast it to a C489guiFrame object.
You can either do
C489guiFrame* pFrame = reinterpret_cast<C489guiFrame*>(m_pMainWnd);<br />
ASSERT(pFrame != NULL);
from within the CWinApp derived class
or
C489guiFrame* pFrame = reinterpret_cast<C489guiFrame*>(AfxGetMainWnd());<br />
ASSERT(pFrame != NULL);
from other classes
then use pFrame to call its member function
pFrame->setStatusBarText(sizeInfo);
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 Walliams (Little Britain)
|
|
|
|
|
How can I disable MRU list from my SDI application. I have tried ON_UPDATE_COMMAND_UI_RANGE and ON_UPDATE_COMMAND_UI but nothing seems to work. when I put these message handlers, the MRU list totally vanishes. I am a bit stuck here.
Nick in Progress
My Articles
|
|
|
|
|
Hi,
First you call CWinApp's LoadStdProfileSettings(0) in InitInstance. And remove all MRU menu items from the resource menus.
Regards,
Selvam
|
|
|
|
|
I know this method but I wanted to disable the MRU items temporarily during some operation. By doing this, it will show and MRU list with 0 items so its of no use to me.
Anyways, I have done this by writing a custom Message Handler.
Thanx for your response.
Nick in Progress
My Articles
|
|
|
|
|
Hi:
I need to capture an image made in my window (with MoveTo and LineTo functions) and stretched it to another size.
How can I make it?
thanks,
|
|
|
|
|
|
Thanks,
but is it not another easier solution without saving first the image to a file?
|
|
|
|
|
Hello everybody!
I´m using CreateProcess to create a new process, with the CREATE_NEW_PROCESS_GROUP
flag set in the argument "dwCreationFlags", to create a new process group.
Let´s call PROCESS_A the one which calls CreateProcess, and PROCESS_B
the one which is created.
MSDN says in "CreateProcess" function:
------------------------------------------------------
CREATE_NEW_PROCESS_GROUP:
The new process is the root process of a new process group. The process
group includes all processes that are descendants of this root process.
The process identifier of the new process group is the same as the process
identifier, which is returned in the lpProcessInformation parameter.
Process groups are used by the GenerateConsoleCtrlEvent function to enable
sending a ctrl+c or ctrl+break signal to a group of console processes.
------------------------------------------------------
I know that from PROCESS_A, I can get the PID of the PROCESS_B through
"lpProcessInformation", which is also the identifier of the new process
group. I also know that "GetCurrentProcessID" returns the PID of the
current process.
But I need that PROCESS_B knows the ID of its own process group, without
having to pass it in the command line arguments, when CreateProcess
is called.
-Is it possible to get the ID of a process group?
-How can PROCESS_B know the identifier of its own process group?
(without passing it in the command line when CreateProcess is called)
-Is there any function which returns process group ID of the calling
process, like "getpgid(0)" in Linux does?
Thanks all!.
|
|
|
|
|
Maybe I am not reading this correctly, but isn't this already your answer?
I know that from PROCESS_A, I can get the PID of the PROCESS_B through
"lpProcessInformation", which is also the identifier of the new process
group.
If the PROCESS GROUP ID is the same as the PROCESS ID for your ProcessB, then from within the ProcessB, just call GetProcessID() and that should match the process group identifier. Doesn't your statement above imply the new process group id is the same as the processB process identifier
MSND says same thing:
"The process identifier of the new process group is the same as the process identifier, which is returned in the lpProcessInformation parameter."
|
|
|
|
|
Unhandled exception at 0x0044c743 in NewMumsEngine.exe:0xC0000005: Access violation reading location 0xcdcdcddd.
This arises in the msgSendQueue method,when I use the semaphore class variable m_pSendLock to access the lockWait()method :
m_pSendLock->lockWait();
This happens after the script has been loaded and when the message has to be sent to the queue to be stored.We need to lock to allow only one thread access at a time.
Can anyone tell me how to solve this pr atleast what this sort of an error means.
Arjun Mukherjee
Software Engineer
Hewlett Packard
|
|
|
|
|
Hi There!
I think this type of error ususally come when Function pointer is not rightfully initialized or it try to use heap that out of it domainian.
aj1682 wrote:
m_pSendLock to access the lockWait()method :
m_pSendLock->lockWait();
Have you check m_pSendlock is rightfully
intialized,before calling of m_pSendLock->lockWait();
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi Alok,
Thanks for the help.
I checked the initialization,m_pSendLock is a semaphore class variable and this is initialised in another class.
I have declared a variable of this class and included the semaphore initialization in the constructor of this class.
then I have used this variable to access the function of this class where the statement
m_pSendLock->lockwait();
is used.
So i guess the constructor does the initialization of the semaphore class variable.
But I cannot understand the function pointer not rightfully initialised,or the heap out of domain.can u please explain this to me a little and tell me how to check it or any other way.
thanks,
arjun.
Arjun Mukherjee
Software Engineer
Hewlett Packard
|
|
|
|
|
Put a breakpoint (F9) just at the line m_pSendLock->lockwait(); and then debug your program (F5). Look at the state of the variable m_pSendLock to check if everything is correct.
|
|
|
|
|
Hi Cedric,
Thanks for the help.
I've already done all that,but how do I look at the state of the variable m_pSendLock().
Can u tell me how to do this and can u also tell me what to expect,or any examples that u can give me will be very helpful.
Thanks,
Arjun.
Arjun Mukherjee
Software Engineer
Hewlett Packard
|
|
|
|
|
When your program is stopped on your breakpoint, right click on the variable, and click on QuickWatch. Then you will have a window that will show you the state (and value and mamber variables...) of your class. Look if it well instancied (the adress pointer must look something else than 0x000000 or 0xccccccc or 0xcdcdcdcd ...) something like a 'valid' adress (I cannot tell you what exactly is a 'valid' adress). If this is not the case, maybe your semaphore is not instancied...
|
|
|
|
|
aj1682 wrote:
I cannot understand the function pointer not rightfully initialised
Ususally this Case arise when we Dynamically Load Function from DLL usig LoadLibrary and GetProcAddress.
and Function Pointer is Not properly intialized.
aj1682 wrote:
the heap out of domain
Simple,when function tried to acces heap or memory location which out of it access or not properly initialized.
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
is the debugger pointing to the line of code that calls lockWait()? Are you sure that m_pSendLock was initialized properly? Usually, that type of crash is associated with a pointer that is A) uninitialized (not set to NULL by default) and B) never set to actually point to an object. xCDCDCDDD is the kind of number that variables sometimes get set to if they were never initialized to 0 or NULL in a class constructor. Always initialize pointers to 0. In this case, obviously, you have to set the pointer to point to some valid object.
Are you doing something like the below code to setup your pointer somewhere?
m_pSendLock = &theSemaphoreObject; or
m_pSendLock = new CSemaphore;
If so, what specifically are you doing to set the pointer? Is the crash occurring when your application exits? Another kind of situation that occurs is when you have a thread that doesn't terminate before your class is destroyed (on exit). The object gets destroyed but the thread continues to execuate and then trys to call a function with an invalid pointer.
|
|
|
|
|
Hi
Yeah the debugger is pointing to m_pSendLock->lockwait();when it gives me the error and breaks.
I checked the state of the m_pSendLock variable ,I dont think its initialised,even though I did initialize the class variable(that m_pSendLock is a prt of) to NULL,but it still din't work.
The constructor contains the code m_pSendLock = new CXSemaphore(...
But then I've used a previously declared and initialised pointer of the same class and then referenced m_pSendLock and all other methods,and it seems to work.I do not understand y so.Anyway, as of now I have solved the problem,even though I do not understand y and how.
Thanks a lot.
Arjun Mukherjee
Software Engineer
Hewlett Packard
|
|
|
|
|
For future reference, it sure would help to see some code snips of your class declaration, constructor implementation, and maybe some snips of where the instantiated object is used.
Regards,
Shawn
|
|
|
|
|
hi,
well the problem i am facing is that i have a class say A..which has the following declaration
class A: public CFontDialog
{
....
}
now in the initinstance of the dialog i want to get the resource id of dialog.
Can anyone please help me on the issue!
PS. i have tried GetWindowLong( GWL_ID )... but it returns 0. ......
please help.
lid.
|
|
|
|
|
|
well as i told earlier... i have this class manually defined and not defined against a dialog resource.... the member A::IDD you mentioned is defined by the new dlg wizard and is not present in case of CCustomDialogs more specifically CFontDialog ... so if you have anything else in mind. please update me..
thankx for the time and consideration.
lid
|
|
|
|
|
otherwise, you can have the hWnd pointer with :
CFontDialog fontDlg();
CWnd pWnd = fontDlg->m_hWnd;
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hi
It might be in the CDialog::m_lpszTemplateName parameter.
HTH
Martin
|
|
|
|