|
Anonymous wrote:
PS: nej, men jag pratar en lite, jag heter Måak
Be a member Moak!
BTW:
Ledsen, kan inte hjälpa dig!
(Sorry, can't help you)
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
UINT MyThreadProc( LPVOID pParam )
{
CMyDataStructure* pObject = (CMyDataStructure*)pParam;
// do something with 'pObject'
}
// inside a different function in the program
.
.
pNewObject = new CMyObject;
AfxBeginThread(MyThreadProc, pNewObjectPointer);
In my application, the main structure is simply a Dialog window. I placed the Dialog's pointer in the pObject and call the AfxBeginThread(MyThreadProc, pNewObject), however it always give me out run-time error when the Thread come to this line 'MyDialogPointer->UpdateData(false)'.
However if I replaced the line 'AfxBegnThread(MyThreadProc, pNewObject)' with MyThreadProc(pNewObjectPointer), no error come out.
Can anybody help me figure out what is the reason for it? And what should I do to sucessfully Perform UpdateData() of the Dialog by using Thread?
|
|
|
|
|
Sstar wrote:
I placed the Dialog's pointer in the pObject
That pointer should be allocated on the heap. Is your dialog staticly declared in the main thread?
rechi
|
|
|
|
|
Bogdan Rechi wrote:
That pointer should be allocated on the heap
Why?
He allocate memory in a function and then pass the address to that memory in AfxBeginThread (parameter to the thread func). In the thread function he create a new pointer (not on the heap) which will be assigned to the address that argument points to!?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
The pointer arriving in the thread function is correct. But the structure it points to has a pointer member (probably a CDialog * ) which is not allocated on the heap! That one is the pain, and it doesn't appear in his posting.
rechi
|
|
|
|
|
Each thread has its own message map. As a result, you can't pass MFC objects that refer to windows between threads. The best you can do is pass the window handle between threads.
Software Zen: delete this;
|
|
|
|
|
I want to change value of y axix
i have tried following code
for(int x = 1 ; x < 10; x++)
{
m_Chart.SetColumn(x);
CString str1;
str1.Format("%d",x);
m_Chart.SetColumnLabel(str1);
}
but it doesnt work can anybody help me? thanx in advance
bye chan
|
|
|
|
|
hello @all,
i have a mdi program. in the mainframe you have for example:
File -> Close
i would like to hide 'Close' to the users until the correct password entered.
enter password:
View -> Password
the 'Close' should not be gray or something like that. the user should not see that there is something like the 'Close', until he enter the right password.
i hope you can help me.
thank you very much
MFC
|
|
|
|
|
Off the top of my head, you could have a ON_COMMAND_UPDATE for the mdi child (which is where the
close command ends up) and use pCmdUI->SetText (m_bCanClose ? "Close" : "Password") to change the
text. You would also need a command handler to change the behaviour between password entry and the
normal closing.
For a "proper" app, you should load the menu strings from a resource rather than hardwired as above,
but you get the idea?
Iain.
|
|
|
|
|
thanks for reply.
i think i know what you mean, but i don´t know, how i should program it.
can you give me an example or explain it in more detail?
thank you very much
mfc
|
|
|
|
|
perhaps I misunderstood something, but the desired GUI design sounds wired.
|
|
|
|
|
I'd like to insert a checkbox in the dialog created by SHBrowseForFolder. Any hint, please ?
Thanks in advance
Mav Rossi
|
|
|
|
|
Straight from MSDN:
If you implement a callback function, you will receive a handle to the dialog box. One use of this window handle is to modify the layout or contents of the dialog box. Because it is not resizable, modifying the old-style dialog box is relatively straightforward. Modifying the new-style dialog box is much more difficult, and not recommended. Not only does it have a different size and layout than the old style, but its dimensions and the positions of its controls change every time it is resized by the user.
Jason Henderson start page ; articles
henderson is coming
henderson is an opponent's worst nightmare
* googlism *
|
|
|
|
|
Hi
can anybody guide me to load Toolbar dependent bitmaps in my popup menu
which will appear on RButtonClick in a formview.will be so thankful if you give me
the code.
thanks and regards
ThomasKennedy
ThomasKennedyBose
|
|
|
|
|
Hi !
Somebody knows about a software (or an option in VC++) which would only display the code contained in precompiler instructions ?
I mean:
#ifdef hello
int i=9;
#else
int j=10;
#endif
would only be displayed as
int i=9; if hello is defined. Otherwise, it would dispaly
int j=9; of course.
Reason is, in my new job, i have to do with realtime applications, and the code is full of precompiler instructions, so it is quite unreadable .
Thankxx
RaGE
|
|
|
|
|
See /E, /P and /EP compiler switches. This is not exactly what you need, but can help. You can also use Go to Definition function to see what precompiler value is defined.
|
|
|
|
|
How can I see if my app delete the memory?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
When running a debug build using "Go"(F5), the debug output window shows memory leaks after the termination of the app.
Commercial products are considerably more sophisticated, but tend to be expensive and complicated.
|
|
|
|
|
In debug mode you can see the memory leaks only if you have created your application using the wizard and MFC.
Not everybody uses MFC and/or the built-in wizards.
What you have to do is either something like:
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
Which is done automatically in MFC and WIZARDS.
Or you could overide the new/delete (and their array versions) and provide your own memory leak checks.
|
|
|
|
|
ihaml wrote:
Not everybody uses MFC and/or the built-in wizards
But everybody who has to ask such a basic question definitly should.
Please get me right:
I am not attacking the question on memory leak detection, but the implication in the answer that beginners should not be using the Wizard. We can discuss about MFC, but the Wizard is definitely a good thing to get your Project going: Setting up the whole mess is very error prone.
|
|
|
|
|
ihaml wrote:
Not everybody uses MFC
And I'm one of them!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
jhwurmbach wrote:
Commercial products are considerably more sophisticated, but tend to be expensive and complicated.
We had a long discussion about that on the forum in June 2002, and it came out that one of the best software with a free demoversion was Glowcode. You may take a look at it.
++
RaGE
|
|
|
|
|
Use something like Boundschecker.
Or write a wrapper that reference counts memory allocation and memory freeing.
Michael
Life’s not a song.
Life isn’t bliss.
Life is just this.
It’s living. -- Buffy the Vampire Slayer: Once more, with feeling
|
|
|
|
|
Michael P Butler wrote:
Use something like Boundschecker.
I will try that and Glowcount!
Michael P Butler wrote:
Or write a wrapper that reference counts memory allocation and memory freeing
That was a pretty good idea!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Hi,
Is there anyway to hide the thumb in the slider control?
Regards
Neha
|
|
|
|